spec/audited_spec_helpers.rb in audited-4.2.2 vs spec/audited_spec_helpers.rb in audited-4.3.0
- old
+ new
@@ -1,36 +1,20 @@
module AuditedSpecHelpers
- def create_user(use_mongo = false, attrs = {})
- klass = use_mongo ? Models::MongoMapper::User : Models::ActiveRecord::User
- klass.create({:name => 'Brandon', :username => 'brandon', :password => 'password'}.merge(attrs))
+ def create_user(attrs = {})
+ Models::ActiveRecord::User.create({name: 'Brandon', username: 'brandon', password: 'password'}.merge(attrs))
end
- def build_user(use_mongo = false, attrs = {})
- klass = use_mongo ? Models::MongoMapper::User : Models::ActiveRecord::User
- klass.new({:name => 'darth', :username => 'darth', :password => 'noooooooo'}.merge(attrs))
+ def build_user(attrs = {})
+ Models::ActiveRecord::User.new({name: 'darth', username: 'darth', password: 'noooooooo'}.merge(attrs))
end
- def create_versions(n = 2, use_mongo = false)
- klass = use_mongo ? Models::MongoMapper::User : Models::ActiveRecord::User
-
- klass.create(:name => 'Foobar 1').tap do |u|
+ def create_versions(n = 2)
+ Models::ActiveRecord::User.create(name: 'Foobar 1').tap do |u|
(n - 1).times do |i|
u.update_attribute :name, "Foobar #{i + 2}"
end
u.reload
end
- end
-
- def create_active_record_user(attrs = {})
- create_user(false, attrs)
- end
-
- def create_mongo_user(attrs = {})
- create_user(true, attrs)
- end
-
- def create_mongo_versions(n = 2)
- create_versions(n, true)
end
end