rahoulb-object-factory 0.1.0

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/README.rdoc ADDED
@@ -0,0 +1,40 @@
1
+ = Object-factory
2
+
3
+ A ruby gem designed to make it simple to create test objects within your test framework, so you don't need to use nasty fixtures.
4
+
5
+ If you don't use the a_saved method then it should work with any type of model, if you do use a_saved then it will work with any model that has a save method (that returns false on failure - so ActiveRecord and DataMapper should be OK).
6
+
7
+ == Install
8
+
9
+ gem install rahoulb-object-factory --source http://gems.github.com/
10
+
11
+ == Usage
12
+
13
+ See the wiki page at http://github.com/rahoulb/object-factory/wikis/home for the latest docs.
14
+
15
+ However, it works something like this:
16
+
17
+ Object.factory.when_creating_a Person, :auto_generate => :employee_code
18
+
19
+ @person = a Person, :first_name => 'John', :last_name => 'Smith', :employee_code => '12345'
20
+ puts @person.employee_code # will show 12345
21
+
22
+ And your options are:
23
+
24
+ * :auto_generate => [:field1, :field2]: generates a unique string value for the given field name or array of field names
25
+ * :auto_confirm => :password: generates a unique string value for the given field name or array of field names and also sets field_name_confirmation to the same value
26
+ * :generate_email_address => :email: generates a randomised email address for the given field name or array of field names
27
+ * :set => { :field3 => 'value3', :field4 => 'value4' }: sets the given fields to the supplied static values
28
+ * :generate => { :field5 => lambda { Date.today } }: sets the given fields to the supplied dynamic values
29
+
30
+ == Released under the MIT Licence
31
+
32
+ Copyright (c) 2008 Brightbox Systems Ltd
33
+
34
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
35
+
36
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
37
+
38
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39
+
40
+ See http://www.brightbox.co.uk/ for contact details.
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('object-factory', '0.1.0') do | config |
6
+ config.description = 'A simple object factory to help you build valid objects in your tests'
7
+ config.url = 'http://github.com/rahoub/object-factory'
8
+ config.author = 'Brightbox Systems Ltd'
9
+ config.email = 'hello@brightbox.co.uk'
10
+ config.ignore_pattern = ['tmp/*', 'script/*']
11
+ config.dependencies = ['rahoulb-rujitsu']
12
+ config.development_dependencies = []
13
+ end
14
+
15
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each do | rake_file |
16
+ load rake_file
17
+ end
@@ -0,0 +1,167 @@
1
+ require 'rubygems'
2
+ require 'rujitsu'
3
+
4
+ class Object
5
+ # return an instance of an Object::Factory
6
+ def self.factory
7
+ @@object_factory ||= Factory.new
8
+ end
9
+
10
+ # Factory allows test suites to build new instances of objects, specifying some simple constraints on certain fields
11
+ # If a new instance is created via the factory then that instance can have specialist values automatically applied to given fields, meaning that it should be possible for test cases to build valid objects without having to specify a full valid field-set
12
+ # The factory should not be created directly, but instead accessed through the Object#factory method.
13
+ # Expected usage:
14
+ # Object.factory.configure Person, :auto_generate => [:email, :telephone], :auto_confirm => :password
15
+ # instance = a Person
16
+ # instance will have a unique value for :email and :telephone and will ensure that :password and :password_confirmation have the same value.
17
+ class Factory
18
+ attr_accessor :generator
19
+
20
+ def initialize
21
+ reset
22
+ end
23
+
24
+ # Set this factory back to its pristine state, with no objects configured
25
+ def reset
26
+ @confirmed_fields = {}
27
+ @generators = {}
28
+ end
29
+
30
+ # Create a new instance of the given class with the given parameters and apply the auto-generated fields, according to the configured rules
31
+ def create_a klass, parameters = {}
32
+ instance = klass.new parameters
33
+
34
+ generate_confirmations_for instance, parameters
35
+ generate_values_for instance, parameters
36
+
37
+ return instance
38
+ end
39
+
40
+ # Create a new instance of the given class with the given parameters, auto-generate the field values and then call save!
41
+ def create_and_save_a klass, parameters = {}
42
+ instance = create_a klass, parameters
43
+ raise CannotSaveError unless instance.save
44
+ return instance
45
+ end
46
+
47
+ # Set up the required auto-generated fields for the given class.
48
+ # Object.factory.when_creating_a MyClass, :auto_generate => [:field1, :field2], :auto_confirm => :password, :generate_email_address => :email_address, :set => { :field3 => 'value3', :field4 => 'value4' }, :generator => { :field5 => lambda {Date.today}, :field6 => lambda {Time.now} }
49
+ # Options are:
50
+ # * :auto_generate specifies a field name or array of field names that are to have unique string values assigned to them
51
+ # * :auto_confirm specifies a field name or array of field names that are to be set to a unique value; with the same value being assigned to field_name_confirmation
52
+ # * :generate_email_address specifies a field name or array of field names that are set to be randomised email addresses
53
+ # * :set specifies a Hash of field names and fixed values
54
+ # * :generate specifies a Hash of field names and lambdas that are used to generate a dynamic value
55
+ def when_creating_a klass, options = {}
56
+ need_to_generate_values_for klass, options[:auto_generate] unless options[:auto_generate].nil?
57
+ need_to_confirm_values_for klass, options[:auto_confirm] unless options[:auto_confirm].nil?
58
+ need_to_generate_email_addresses_for klass, options[:generate_email_address] unless options[:generate_email_address].nil?
59
+ need_to_set_values_for klass, options[:set] unless options[:set].nil?
60
+ need_to_set_generators_for klass, options[:generate] unless options[:generate].nil?
61
+ end
62
+
63
+ alias :when_creating_an :when_creating_a
64
+ alias :create_and_save_an :create_and_save_a
65
+
66
+ # An Object::Factory::ValueGenerator that is used to actually build the unique values used to populate the required fields
67
+ def generator
68
+ @generator ||= ValueGenerator.new
69
+ end
70
+
71
+ # A simple class that generates unique values
72
+ class ValueGenerator
73
+ def initialize
74
+ @counter = 0
75
+ end
76
+
77
+ def unique_integer
78
+ @counter += 1
79
+ end
80
+
81
+ def value_for klass, field
82
+ "#{klass.name.to_s}-#{field.to_s}-#{unique_integer}"
83
+ end
84
+ end
85
+
86
+ #�Error raised when create_and_save_a cannot save the object
87
+ class CannotSaveError < RuntimeError; end
88
+
89
+ private
90
+
91
+ def symbol_for object
92
+ klass = object.is_a?(Class) ? object : object.class
93
+ return klass.name.to_sym
94
+ end
95
+
96
+ def need_to_generate_values_for klass, fields
97
+ fields = [fields] unless fields.respond_to?(:each)
98
+ fields.each do | field |
99
+ add_generator_for klass, field, lambda { generator.value_for(klass, field) }
100
+ end
101
+ end
102
+
103
+ def need_to_confirm_values_for klass, fields
104
+ fields = [fields] unless fields.respond_to?(:each)
105
+ @confirmed_fields[symbol_for(klass)] = fields
106
+ end
107
+
108
+ def need_to_generate_email_addresses_for klass, fields
109
+ fields = [fields] unless fields.respond_to?(:each)
110
+ fields.each do | field |
111
+ add_generator_for klass, field, lambda { 6.random_letters + '@' + 10.random_letters + '.com' }
112
+ end
113
+ end
114
+
115
+ def need_to_set_values_for klass, fields_and_values
116
+ fields_and_values.each do | field, value |
117
+ add_generator_for klass, field, lambda { value }
118
+ end
119
+ end
120
+
121
+ def add_generator_for klass, field, generator
122
+ @generators[symbol_for(klass)] ||= {}
123
+ @generators[symbol_for(klass)][field] = generator
124
+ end
125
+
126
+ def need_to_set_generators_for klass, fields_and_generators
127
+ fields_and_generators.each do | field, generator |
128
+ add_generator_for klass, field, generator
129
+ end
130
+ end
131
+
132
+ def generate_confirmations_for instance, parameters
133
+ field_names = @confirmed_fields[symbol_for(instance)]
134
+ return if field_names.nil?
135
+ field_names.each do | field_name |
136
+ confirmation_field_name = "#{field_name}_confirmation"
137
+ value = generator.value_for(instance.class, field_name)
138
+ instance.send("#{field_name.to_s}=".to_sym, value) unless parameters.has_key?(field_name.to_sym)
139
+ instance.send("#{confirmation_field_name.to_s}=".to_sym, value) unless parameters.has_key?(confirmation_field_name.to_sym)
140
+ end
141
+ end
142
+
143
+ def generate_values_for instance, parameters
144
+ fields_and_generators = @generators[symbol_for(instance)]
145
+ return if fields_and_generators.nil?
146
+ fields_and_generators.each do | field_name, proc |
147
+ value = proc.call
148
+ instance.send("#{field_name.to_sym}=".to_sym, value) unless parameters.has_key?(field_name.to_sym)
149
+ end
150
+ end
151
+ end
152
+ end
153
+
154
+ # Short-cut method for Object::Factory#create_a
155
+ # Also aliased as an, for class names that start with a vowel.
156
+ # instance = a Thingy
157
+ # another_instance = an OtherThingy
158
+ def a klass, parameters = {}
159
+ Object.factory.create_a klass, parameters
160
+ end
161
+
162
+ alias an a
163
+
164
+ # Short-cut method for Object::Factory#create_and_save_a
165
+ def a_saved klass, parameters = {}
166
+ Object.factory.create_and_save_a klass, parameters
167
+ end
@@ -0,0 +1,34 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{object-factory}
5
+ s.version = "0.1.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Brightbox Systems Ltd"]
9
+ s.date = %q{2008-11-24}
10
+ s.description = %q{A simple object factory to help you build valid objects in your tests}
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"]
14
+ s.has_rdoc = true
15
+ s.homepage = %q{http://github.com/rahoub/object-factory}
16
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Object-factory", "--main", "README.rdoc"]
17
+ s.require_paths = ["lib"]
18
+ s.rubyforge_project = %q{object-factory}
19
+ s.rubygems_version = %q{1.3.1}
20
+ s.summary = %q{A simple object factory to help you build valid objects in your tests}
21
+
22
+ if s.respond_to? :specification_version then
23
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
+ s.specification_version = 2
25
+
26
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
27
+ s.add_runtime_dependency(%q<rahoulb-rujitsu>, [">= 0"])
28
+ else
29
+ s.add_dependency(%q<rahoulb-rujitsu>, [">= 0"])
30
+ end
31
+ else
32
+ s.add_dependency(%q<rahoulb-rujitsu>, [">= 0"])
33
+ end
34
+ end
@@ -0,0 +1,271 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../lib/object_factory.rb')
2
+
3
+ class TestClass
4
+ attr_accessor :field, :another_field, :password, :password_confirmation, :other, :other_confirmation
5
+ def initialize parameters = nil
6
+ self.field = parameters[:field]
7
+ self.another_field = parameters[:another_field]
8
+ self.password = parameters[:password]
9
+ self.password_confirmation = parameters[:password_confirmation]
10
+ end
11
+ end
12
+
13
+ class AnotherTestClass
14
+
15
+ end
16
+
17
+ describe Object, "with RSpec/Rails extensions" do
18
+ describe "accessing the factory" do
19
+ it "should return an object factory" do
20
+ Object.factory.class.should == Object::Factory
21
+ end
22
+
23
+ it "should use a single instance" do
24
+ @first_factory = Object.factory
25
+ @second_factory = Object.factory
26
+
27
+ @first_factory.should == @second_factory
28
+ end
29
+ end
30
+ end
31
+
32
+ describe Object::Factory::ValueGenerator do
33
+ it "should generate a unique string value for a given class and field" do
34
+ @generator = Object::Factory::ValueGenerator.new
35
+
36
+ @value = @generator.value_for TestClass, :field
37
+ @value.should match(/TestClass\-field\-(\d+)/)
38
+ end
39
+
40
+ it "should generate a unique integer value" do
41
+ @generator = Object::Factory::ValueGenerator.new
42
+
43
+ @first_value = @generator.unique_integer
44
+ @second_value = @generator.unique_integer
45
+
46
+ @first_value.should_not == @second_value
47
+ end
48
+
49
+ end
50
+
51
+ describe Object::Factory, "creating simple instances" do
52
+
53
+ before :each do
54
+ Object.factory.reset
55
+ end
56
+
57
+ it "should create an instance of the given class with no provided parameters" do
58
+ @test_instance = mock('Test Instance')
59
+ TestClass.should_receive(:new).with({}).and_return(@test_instance)
60
+
61
+ @created_instance = Object.factory.create_a(TestClass)
62
+ @created_instance.should == @test_instance
63
+ end
64
+
65
+ it "should create an instance of the given class with the given parameters" do
66
+ @test_instance = mock('Test Instance')
67
+ TestClass.should_receive(:new).with({:some => :values}).and_return(@test_instance)
68
+
69
+ @created_instance = Object.factory.create_a(TestClass, :some => :values)
70
+ @created_instance.should == @test_instance
71
+ end
72
+
73
+ it "should allow 'a' as a short-cut to creating objects" do
74
+ @test_instance = mock('Test Instance')
75
+ TestClass.should_receive(:new).with({}).and_return(@test_instance)
76
+
77
+ @created_instance = a TestClass
78
+ @created_instance.should == @test_instance
79
+ end
80
+
81
+ it "should allow 'an' as a short-cut to creating objects" do
82
+ @test_instance = mock('Test Instance')
83
+ AnotherTestClass.should_receive(:new).with({}).and_return(@test_instance)
84
+
85
+ @created_instance = an AnotherTestClass
86
+ @created_instance.should == @test_instance
87
+ end
88
+
89
+ it "should auto-save the created object" do
90
+ @test_instance = mock('Test Instance')
91
+ TestClass.should_receive(:new).with({:some => :values}).and_return(@test_instance)
92
+ @test_instance.should_receive(:save).and_return(true)
93
+
94
+ @created_instance = Object.factory.create_and_save_a(TestClass, :some => :values)
95
+ end
96
+
97
+ it "should raise an exception if the auto-saved object cannot be saved" do
98
+ @test_instance = mock('Test Instance')
99
+ TestClass.should_receive(:new).with({:some => :values}).and_return(@test_instance)
100
+ @test_instance.should_receive(:save).and_return(false)
101
+
102
+ lambda {
103
+ Object.factory.create_and_save_a(TestClass, :some => :values)
104
+ }.should raise_error(Object::Factory::CannotSaveError)
105
+ end
106
+
107
+ it "should allow 'a_saved' as a short-cut to creating and saving an object" do
108
+ @test_instance = mock('Test Instance')
109
+ TestClass.should_receive(:new).with({:some => :values}).and_return(@test_instance)
110
+ @test_instance.should_receive(:save).and_return(true)
111
+
112
+ @created_instance = a_saved(TestClass, :some => :values)
113
+ end
114
+ end
115
+
116
+ describe Object::Factory, "creating instances with generated values" do
117
+
118
+ before :each do
119
+ Object.factory.reset
120
+ end
121
+
122
+ it "should auto-generate a unique value for a configured field" do
123
+ Object.factory.generator.should_receive(:value_for).with(TestClass, :field).and_return("TestClass-field-1")
124
+
125
+ Object.factory.when_creating_a TestClass, :auto_generate => :field
126
+ @instance = Object.factory.create_a TestClass
127
+ @instance.field.should == 'TestClass-field-1'
128
+ end
129
+
130
+ it "should auto-generate unique values for multiple configured fields" do
131
+ Object.factory.generator.should_receive(:value_for).with(TestClass, :field).and_return("TestClass-field-1")
132
+ Object.factory.generator.should_receive(:value_for).with(TestClass, :another_field).and_return("TestClass-another_field-1")
133
+
134
+ Object.factory.when_creating_a TestClass, :auto_generate => [:field, :another_field]
135
+
136
+ @instance = Object.factory.create_a TestClass
137
+ @instance.field.should match(/TestClass-field-(\d+)/)
138
+ @instance.another_field.should match(/TestClass-another_field-(\d+)/)
139
+ end
140
+
141
+ it "should allow you to override generated values" do
142
+ Object.factory.when_creating_a TestClass, :auto_generate => :field
143
+
144
+ @instance = Object.factory.create_a TestClass, :field => 'My Override Value'
145
+ @instance.field.should == 'My Override Value'
146
+ end
147
+
148
+ it "should allow you to override generated values with nils" do
149
+ Object.factory.when_creating_a TestClass, :auto_generate => :field
150
+
151
+ @instance = Object.factory.create_a TestClass, :field => nil
152
+ @instance.field.should be_nil
153
+ end
154
+ end
155
+
156
+ describe Object::Factory, "creating instances with confirmed values" do
157
+
158
+ before :each do
159
+ Object.factory.reset
160
+ end
161
+
162
+ it "should auto-generate a unique value for a configured field and its confirmation field" do
163
+ Object.factory.generator.should_receive(:value_for).with(TestClass, :password).and_return("TestClass-password-1")
164
+
165
+ Object.factory.when_creating_a TestClass, :auto_confirm => :password
166
+
167
+ @instance = Object.factory.create_a TestClass
168
+ @instance.password.should == 'TestClass-password-1'
169
+ @instance.password_confirmation.should == @instance.password
170
+ end
171
+
172
+ it "should auto-generate unique values for multiple configured fields and confirmation fields" do
173
+ Object.factory.generator.should_receive(:value_for).with(TestClass, :password).and_return("TestClass-password-1")
174
+ Object.factory.generator.should_receive(:value_for).with(TestClass, :other).and_return("TestClass-other-1")
175
+
176
+ Object.factory.when_creating_a TestClass, :auto_confirm => [:password, :other]
177
+
178
+ @instance = Object.factory.create_a TestClass
179
+ @instance.password.should match(/TestClass-password-(\d+)/)
180
+ @instance.password_confirmation.should == @instance.password
181
+ @instance.other.should match(/TestClass-other-(\d+)/)
182
+ @instance.other_confirmation.should == @instance.other
183
+ end
184
+
185
+ it "should allow you to override confirmed original values" do
186
+ Object.factory.when_creating_a TestClass, :auto_confirm => :password
187
+
188
+ @instance = Object.factory.create_a TestClass, :password => 'My Override Value'
189
+ @instance.password.should == 'My Override Value'
190
+ @instance.password_confirmation.should_not == @instance.password
191
+ end
192
+
193
+ it "should allow you to override confirmed confirmation fields" do
194
+ Object.factory.when_creating_a TestClass, :auto_confirm => :password
195
+
196
+ @instance = Object.factory.create_a TestClass, :password_confirmation => 'My Override Value'
197
+ @instance.password_confirmation.should == 'My Override Value'
198
+ @instance.password_confirmation.should_not == @instance.password
199
+ end
200
+
201
+ it "should allow you to override confirmed values with nils" do
202
+ Object.factory.when_creating_a TestClass, :auto_confirm => :password
203
+
204
+ @instance = Object.factory.create_a TestClass, :password => nil
205
+ @instance.password.should be_nil
206
+ @instance.password_confirmation.should_not == @instance.password
207
+ end
208
+
209
+ it "should allow you to override confirmed confirmation fields with nils" do
210
+ Object.factory.when_creating_a TestClass, :auto_confirm => :password
211
+
212
+ @instance = Object.factory.create_a TestClass, :password_confirmation => nil
213
+ @instance.password_confirmation.should be_nil
214
+ @instance.password_confirmation.should_not == @instance.password
215
+ end
216
+ end
217
+
218
+ describe Object::Factory, "setting static values" do
219
+ before :each do
220
+ Object.factory.reset
221
+ end
222
+
223
+ it "should set a static value for a configured field" do
224
+ Object.factory.when_creating_a TestClass, :set => { :field => 'hello' }
225
+ @instance = Object.factory.create_a TestClass
226
+ @instance.field.should == 'hello'
227
+ end
228
+
229
+ it "should set static values for multiple configured fields" do
230
+ Object.factory.when_creating_a TestClass, :set => { :field => 'hello', :another_field => 'world' }
231
+
232
+ @instance = Object.factory.create_a TestClass
233
+ @instance.field.should == 'hello'
234
+ @instance.another_field.should == 'world'
235
+ end
236
+ end
237
+
238
+ describe Object::Factory, "generating email addresses" do
239
+ before :each do
240
+ Object.factory.reset
241
+ end
242
+
243
+ it "should generate a random email address for a configured field" do
244
+ Object.factory.when_creating_a TestClass, :generate_email_address => :field
245
+
246
+ @instance = Object.factory.create_a TestClass
247
+ @instance.field.should match(/(.*)@(.*)\.com/)
248
+ end
249
+
250
+ it "should generate random email addresses for multiple configured fields" do
251
+ Object.factory.when_creating_a TestClass, :generate_email_address => [:field, :another_field]
252
+
253
+ @instance = Object.factory.create_a TestClass
254
+ @instance.field.should match(/(.*)@(.*)\.com/)
255
+ @instance.another_field.should match(/(.*)@(.*)\.com/)
256
+ end
257
+ end
258
+
259
+ describe Object::Factory, "using lambdas to generate values" do
260
+ before :each do
261
+ Object.factory.reset
262
+ end
263
+
264
+ it "should set a lambda-generator for configured fields" do
265
+ Object.factory.when_creating_a TestClass, :generate => { :field => lambda { "poop" }, :another_field => lambda { Date.today.to_s } }
266
+
267
+ @instance = Object.factory.create_a TestClass
268
+ @instance.field.should == 'poop'
269
+ @instance.another_field.should == Date.today.to_s
270
+ end
271
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1,4 @@
1
+ --colour
2
+ --format progress
3
+ --loadby mtime
4
+ --reverse
data/tasks/rspec.rake ADDED
@@ -0,0 +1,24 @@
1
+ # Borrowed from http://github.com/rsim/ruby-plsql/tree/master/tasks/rspec.rake
2
+ # Github++
3
+ begin
4
+ require "spec"
5
+ rescue LoadError
6
+ require "rubygems"
7
+ require "spec"
8
+ end
9
+
10
+ begin
11
+ require "spec/rake/spectask"
12
+ rescue LoadError
13
+ puts <<-EOS
14
+ To use rspec for testing you must install rspec gem:
15
+ [sudo] gem install rspec
16
+ EOS
17
+ exit(0)
18
+ end
19
+
20
+ desc "Run the specs under spec/*"
21
+ Spec::Rake::SpecTask.new do |t|
22
+ t.spec_opts = ["--options", "spec/spec.opts"]
23
+ t.spec_files = FileList["spec/*_spec.rb"]
24
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rahoulb-object-factory
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Brightbox Systems Ltd
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-11-24 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rahoulb-rujitsu
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: "0"
23
+ version:
24
+ description: A simple object factory to help you build valid objects in your tests
25
+ email: hello@brightbox.co.uk
26
+ executables: []
27
+
28
+ extensions: []
29
+
30
+ extra_rdoc_files:
31
+ - lib/object_factory.rb
32
+ - README.rdoc
33
+ - tasks/rspec.rake
34
+ files:
35
+ - lib/object_factory.rb
36
+ - Manifest
37
+ - object-factory.gemspec
38
+ - Rakefile
39
+ - README.rdoc
40
+ - spec/object_spec.rb
41
+ - spec/spec.opts
42
+ - tasks/rspec.rake
43
+ has_rdoc: true
44
+ homepage: http://github.com/rahoub/object-factory
45
+ post_install_message:
46
+ rdoc_options:
47
+ - --line-numbers
48
+ - --inline-source
49
+ - --title
50
+ - Object-factory
51
+ - --main
52
+ - README.rdoc
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: "0"
60
+ version:
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: "1.2"
66
+ version:
67
+ requirements: []
68
+
69
+ rubyforge_project: object-factory
70
+ rubygems_version: 1.2.0
71
+ signing_key:
72
+ specification_version: 2
73
+ summary: A simple object factory to help you build valid objects in your tests
74
+ test_files: []
75
+