aboutsummaryrefslogtreecommitdiffstats
path: root/spec/support/devise.rb
diff options
context:
space:
mode:
authorLuc Donnet2015-01-05 14:56:12 +0100
committerLuc Donnet2015-01-05 14:56:12 +0100
commit3bc6d313bebdc1f03e4021aabbc774a0cd97d938 (patch)
treeac5b8c6d8309012136606d9fd9b9a00290f486a8 /spec/support/devise.rb
parente632a4634b1762f4c73d11f1e5b127de9832a1ff (diff)
downloadchouette-core-3bc6d313bebdc1f03e4021aabbc774a0cd97d938.tar.bz2
Initialize rails 4 migration
Diffstat (limited to 'spec/support/devise.rb')
-rw-r--r--spec/support/devise.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/spec/support/devise.rb b/spec/support/devise.rb
index 8713e96fa..cd5782f36 100644
--- a/spec/support/devise.rb
+++ b/spec/support/devise.rb
@@ -2,7 +2,7 @@ module DeviseRequestHelper
include Warden::Test::Helpers
def login_user
- organisation = Organisation.find_by_name("first") || create(:organisation, :name => "first")
+ organisation = Organisation.where(:name => "first").first_or_create(attributes_for(:organisation))
@user ||= create(:user, :organisation => organisation)
@user.confirm!
login_as @user, :scope => :user
@@ -34,7 +34,7 @@ module DeviseControllerHelper
def login_user
before(:each) do
@request.env["devise.mapping"] = Devise.mappings[:user]
- organisation = Organisation.find_by_name("first") || create(:organisation, :name => "first")
+ organisation = Organisation.where(:name => "first").first_or_create(attributes_for(:organisation))
user = create(:user, :organisation => organisation)
user.confirm!
sign_in user
@@ -47,4 +47,5 @@ RSpec.configure do |config|
config.extend DeviseControllerHelper, :type => :controller
config.include DeviseRequestHelper, :type => :request
+ config.include DeviseRequestHelper, :type => :feature
end