rahoulb-object-factory 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +5 -0
- data/Rakefile +1 -1
- data/lib/object_factory.rb +7 -0
- data/object-factory.gemspec +3 -3
- data/spec/object_spec.rb +11 -1
- metadata +3 -1
data/CHANGELOG
ADDED
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('object-factory', '0.1.
|
5
|
+
Echoe.new('object-factory', '0.1.1') do | config |
|
6
6
|
config.description = 'A simple object factory to help you build valid objects in your tests'
|
7
7
|
config.url = 'http://github.com/rahoub/object-factory'
|
8
8
|
config.author = 'Brightbox Systems Ltd'
|
data/lib/object_factory.rb
CHANGED
@@ -165,3 +165,10 @@ alias an a
|
|
165
165
|
def a_saved klass, parameters = {}
|
166
166
|
Object.factory.create_and_save_a klass, parameters
|
167
167
|
end
|
168
|
+
|
169
|
+
# Short-cut method for Object::Factory#when_creating_a
|
170
|
+
def when_creating_a klass, options = {}
|
171
|
+
Object.factory.when_creating_a klass, options
|
172
|
+
end
|
173
|
+
|
174
|
+
alias when_creating_an when_creating_a
|
data/object-factory.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{object-factory}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Brightbox Systems Ltd"]
|
9
9
|
s.date = %q{2008-11-24}
|
10
10
|
s.description = %q{A simple object factory to help you build valid objects in your tests}
|
11
11
|
s.email = %q{hello@brightbox.co.uk}
|
12
|
-
s.extra_rdoc_files = ["lib/object_factory.rb", "README.rdoc", "tasks/rspec.rake"]
|
13
|
-
s.files = ["lib/object_factory.rb", "Manifest", "object-factory.gemspec", "Rakefile", "README.rdoc", "spec/object_spec.rb", "spec/spec.opts", "tasks/rspec.rake"]
|
12
|
+
s.extra_rdoc_files = ["CHANGELOG", "lib/object_factory.rb", "README.rdoc", "tasks/rspec.rake"]
|
13
|
+
s.files = ["CHANGELOG", "lib/object_factory.rb", "Manifest", "object-factory.gemspec", "Rakefile", "README.rdoc", "spec/object_spec.rb", "spec/spec.opts", "tasks/rspec.rake"]
|
14
14
|
s.has_rdoc = true
|
15
15
|
s.homepage = %q{http://github.com/rahoub/object-factory}
|
16
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Object-factory", "--main", "README.rdoc"]
|
data/spec/object_spec.rb
CHANGED
@@ -103,7 +103,7 @@ describe Object::Factory, "creating simple instances" do
|
|
103
103
|
Object.factory.create_and_save_a(TestClass, :some => :values)
|
104
104
|
}.should raise_error(Object::Factory::CannotSaveError)
|
105
105
|
end
|
106
|
-
|
106
|
+
|
107
107
|
it "should allow 'a_saved' as a short-cut to creating and saving an object" do
|
108
108
|
@test_instance = mock('Test Instance')
|
109
109
|
TestClass.should_receive(:new).with({:some => :values}).and_return(@test_instance)
|
@@ -113,6 +113,16 @@ describe Object::Factory, "creating simple instances" do
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
+
describe Object::Factory, "configuring a class" do
|
117
|
+
it "should allow 'when_creating_a' as a short-cut to configuring a class" do
|
118
|
+
Object.factory.should_receive(:when_creating_a)
|
119
|
+
|
120
|
+
when_creating_a TestClass, :auto_generate => :employee_code
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
end
|
125
|
+
|
116
126
|
describe Object::Factory, "creating instances with generated values" do
|
117
127
|
|
118
128
|
before :each do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rahoulb-object-factory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brightbox Systems Ltd
|
@@ -28,10 +28,12 @@ executables: []
|
|
28
28
|
extensions: []
|
29
29
|
|
30
30
|
extra_rdoc_files:
|
31
|
+
- CHANGELOG
|
31
32
|
- lib/object_factory.rb
|
32
33
|
- README.rdoc
|
33
34
|
- tasks/rspec.rake
|
34
35
|
files:
|
36
|
+
- CHANGELOG
|
35
37
|
- lib/object_factory.rb
|
36
38
|
- Manifest
|
37
39
|
- object-factory.gemspec
|