dima-exe-factory_girl 1.1.5.0 → 1.1.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -111,9 +111,10 @@ class Factory
111
111
  add_attribute(name, *args, &block)
112
112
  end
113
113
 
114
- def self.method_missing(*args, &block)
115
- chain = args[0].to_s
116
- name = args[1]
114
+ def self.method_missing(chain, *args, &block)
115
+ name = args[0]
116
+ chain = chain.to_s
117
+ options = args.extract_options!
117
118
  factory = Factory.factories[name.to_sym]
118
119
  super(*args, &block) unless factory
119
120
 
@@ -133,7 +134,7 @@ class Factory
133
134
  end
134
135
 
135
136
  raise ScopeNotFoundError, "Can't found scope with name '#{chain}'" unless chain.empty?
136
- Factory(name.to_sym, assigned)
137
+ Factory(name.to_sym, assigned.merge(options))
137
138
  end
138
139
 
139
140
  # Adds an attribute that builds an association. The associated instance will
data/test/factory_test.rb CHANGED
@@ -504,6 +504,13 @@ class FactoryTest < Test::Unit::TestCase
504
504
  assert_equal 1, factory.status
505
505
  assert_equal 1, factory.rotations
506
506
  end
507
+
508
+ should "assign scope with options" do
509
+ factory = Factory.approved_radio(@name, :status => 2, :broadcast => :bogus)
510
+ assert_equal 1, factory.rotations
511
+ assert_equal 2, factory.status
512
+ assert_equal :bogus, factory.broadcast
513
+ end
507
514
  end
508
515
 
509
516
  def self.context_in_directory_with_files(*files)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dima-exe-factory_girl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5.0
4
+ version: 1.1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Ferris