cucumber_factory 1.7.3 → 1.7.4

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/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  doc
2
2
  pkg
3
3
  *.gem
4
+ .bundle
4
5
  .idea
5
-
6
+ .rvmrc
data/README.rdoc CHANGED
@@ -38,8 +38,6 @@ You can use named Machinist blueprint such as <tt>Movie.blueprint(:comedy)</tt>
38
38
 
39
39
  Given a movie (comedy) with the title "Groundhog Day"
40
40
 
41
- Inherited factory_girl factories are not supported yet.
42
-
43
41
  == Overriding factory steps
44
42
 
45
43
  If you want to override a factory step with your own version, just do so:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.7.3
1
+ 1.7.4
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cucumber_factory}
8
- s.version = "1.7.3"
8
+ s.version = "1.7.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Henning Koch"]
12
- s.date = %q{2010-11-17}
12
+ s.date = %q{2010-12-02}
13
13
  s.description = %q{Cucumber Factory allows you to create ActiveRecord models from your Cucumber features without writing step definitions for each model.}
14
14
  s.email = %q{github@makandra.de}
15
15
  s.extra_rdoc_files = [
@@ -89,8 +89,8 @@ Gem::Specification.new do |s|
89
89
  "spec/app_root/lib/console_with_fixtures.rb",
90
90
  "spec/spec_helper.rb",
91
91
  "spec/factory_spec.rb",
92
- "spec/steps_spec.rb",
93
- "spec/runtime_ext_spec.rb"
92
+ "spec/runtime_ext_spec.rb",
93
+ "spec/steps_spec.rb"
94
94
  ]
95
95
 
96
96
  if s.respond_to? :specification_version then
@@ -86,14 +86,14 @@ module Cucumber
86
86
  :"@#{name}"
87
87
  end
88
88
 
89
- def factory_girl_factory_name(model_class)
90
- model_class.to_s.underscore.to_sym
89
+ def factory_girl_factory_name(name)
90
+ name.to_s.underscore.to_sym
91
91
  end
92
92
 
93
93
  def create_record(model_class, variant, attributes)
94
- factory_name = factory_girl_factory_name(model_class)
95
- if defined?(::Factory) && factory = ::Factory.factories[factory_name]
96
- ::Factory.create(factory_name, attributes)
94
+ fg_factory_name = factory_girl_factory_name(variant || model_class)
95
+ if defined?(::Factory) && factory = ::Factory.factories[fg_factory_name]
96
+ ::Factory.create(fg_factory_name, attributes)
97
97
  elsif model_class.respond_to?(:make) # Machinist blueprint
98
98
  if variant.present?
99
99
  model_class.make(variant.to_sym, attributes)
data/spec/steps_spec.rb CHANGED
@@ -43,6 +43,12 @@ describe 'steps provided by cucumber_factory' do
43
43
  invoke_cucumber_step('there is a job offer with the title "Awesome job"')
44
44
  end
45
45
 
46
+ it "should create model variants that have a factory_girl factory by calling #Factory.make(:variant_name)" do
47
+ Factory.should_receive(:factories).with().and_return({ :tempting_job_offer => :tempting_job_offer_factory }) # Fake factory look up in factory_girl
48
+ Factory.should_receive(:create).with(:tempting_job_offer, { :title => "Awesomafiablyfantasmic job" })
49
+ invoke_cucumber_step('there is a job offer (tempting job offer) with the title "Awesomafiablyfantasmic job"')
50
+ end
51
+
46
52
  it "should instantiate plain ruby classes by calling #new" do
47
53
  PlainRubyClass.should_receive(:new).with({})
48
54
  invoke_cucumber_step("there is a plain ruby class")
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber_factory
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 7
9
- - 3
10
- version: 1.7.3
9
+ - 4
10
+ version: 1.7.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Henning Koch
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-17 00:00:00 +01:00
18
+ date: 2010-12-02 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -129,5 +129,5 @@ test_files:
129
129
  - spec/app_root/lib/console_with_fixtures.rb
130
130
  - spec/spec_helper.rb
131
131
  - spec/factory_spec.rb
132
- - spec/steps_spec.rb
133
132
  - spec/runtime_ext_spec.rb
133
+ - spec/steps_spec.rb