factory_loader 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -75,7 +75,7 @@ require 'find'
75
75
  # * Dave Crosby at Atomic Object
76
76
  # * Ryan Fogle at Atomic Object
77
77
  class FactoryLoader
78
- VERSION = "0.1.1"
78
+ VERSION = "0.1.2"
79
79
 
80
80
  # Constructs a FactoryLoader. The passed in factory_paths are searched recursively.
81
81
  def initialize(*factory_paths)
@@ -110,8 +110,8 @@ class FactoryLoader
110
110
  unless Object.const_defined?(factory_name)
111
111
  eval <<-CODE
112
112
  class ::#{factory_name}
113
- def create(options={})
114
- #{object_name}.new options
113
+ def create(*options)
114
+ #{object_name}.new *options
115
115
  end
116
116
  end
117
117
  CODE
@@ -57,11 +57,20 @@ describe FactoryLoader, "#load" do
57
57
  ::Dog.stub!(:new).and_return(@object)
58
58
  end
59
59
 
60
- it "creates a presenter passing along any options" do
61
- ::Dog.should_receive(:new).with(:foo => :bar)
62
- ::DogFactory.new.create(:foo => :bar)
60
+ describe "when constructor arguments are supplied" do
61
+ it "creates a presenter passing along any options" do
62
+ ::Dog.should_receive(:new).with(:foo => :bar)
63
+ ::DogFactory.new.create(:foo => :bar)
64
+ end
63
65
  end
64
66
 
67
+ describe "when constructor arguments are not supplied" do
68
+ it "creates a presenter passing along no options" do
69
+ ::Dog.should_receive(:new).with
70
+ ::DogFactory.new.create
71
+ end
72
+ end
73
+
65
74
  it "returns the newly created presenter" do
66
75
  ::DogFactory.new.create.should == @object
67
76
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factory_loader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Dennis