cucumber_factory 1.7.1 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gem 'rails', '=2.3.8'
4
- gem "cucumber_factory", :path => '.'
5
4
  gem 'rspec', '=1.2.9'
6
5
  gem 'rspec-rails', '=1.2.9'
7
- gem 'cucumber', '=0.8.3'
6
+ gem 'cucumber', '=0.9.3'
7
+ gem 'jeweler'
data/Gemfile.lock CHANGED
@@ -1,8 +1,3 @@
1
- PATH
2
- remote: .
3
- specs:
4
- cucumber_factory (1.7.0)
5
-
6
1
  GEM
7
2
  remote: http://rubygems.org/
8
3
  specs:
@@ -17,15 +12,23 @@ GEM
17
12
  activesupport (= 2.3.8)
18
13
  activesupport (2.3.8)
19
14
  builder (2.1.2)
20
- cucumber (0.8.3)
15
+ cucumber (0.9.3)
21
16
  builder (~> 2.1.2)
22
17
  diff-lcs (~> 1.1.2)
23
- gherkin (~> 2.0.2)
24
- json_pure (~> 1.4.3)
25
- term-ansicolor (~> 1.0.4)
18
+ gherkin (~> 2.2.9)
19
+ json (~> 1.4.6)
20
+ term-ansicolor (~> 1.0.5)
26
21
  diff-lcs (1.1.2)
27
- gherkin (2.0.2)
28
- trollop (~> 1.16.2)
22
+ gemcutter (0.6.1)
23
+ gherkin (2.2.9)
24
+ json (~> 1.4.6)
25
+ term-ansicolor (~> 1.0.5)
26
+ git (1.2.5)
27
+ jeweler (1.4.0)
28
+ gemcutter (>= 0.1.0)
29
+ git (>= 1.2.5)
30
+ rubyforge (>= 2.0.0)
31
+ json (1.4.6)
29
32
  json_pure (1.4.6)
30
33
  rack (1.1.0)
31
34
  rails (2.3.8)
@@ -40,15 +43,16 @@ GEM
40
43
  rspec-rails (1.2.9)
41
44
  rack (>= 1.0.0)
42
45
  rspec (>= 1.2.9)
46
+ rubyforge (2.0.4)
47
+ json_pure (>= 1.1.7)
43
48
  term-ansicolor (1.0.5)
44
- trollop (1.16.2)
45
49
 
46
50
  PLATFORMS
47
51
  ruby
48
52
 
49
53
  DEPENDENCIES
50
- cucumber (= 0.8.3)
51
- cucumber_factory!
54
+ cucumber (= 0.9.3)
55
+ jeweler
52
56
  rails (= 2.3.8)
53
57
  rspec (= 1.2.9)
54
58
  rspec-rails (= 1.2.9)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.7.1
1
+ 1.7.2
@@ -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.1"
8
+ s.version = "1.7.2"
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-05}
12
+ s.date = %q{2010-11-17}
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 = [
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
25
25
  "VERSION",
26
26
  "cucumber_factory.gemspec",
27
27
  "lib/cucumber/factory.rb",
28
- "lib/cucumber/step_mother_ext.rb",
28
+ "lib/cucumber/runtime_ext.rb",
29
29
  "lib/cucumber_factory.rb",
30
30
  "spec/app_root/app/controllers/application_controller.rb",
31
31
  "spec/app_root/app/models/job_offer.rb",
@@ -53,8 +53,8 @@ Gem::Specification.new do |s|
53
53
  "spec/app_root/log/.gitignore",
54
54
  "spec/app_root/script/console",
55
55
  "spec/factory_spec.rb",
56
+ "spec/runtime_ext_spec.rb",
56
57
  "spec/spec_helper.rb",
57
- "spec/step_mother_ext_spec.rb",
58
58
  "spec/steps_spec.rb",
59
59
  "spec/support/rcov.opts",
60
60
  "spec/support/spec.opts"
@@ -62,7 +62,7 @@ Gem::Specification.new do |s|
62
62
  s.homepage = %q{http://github.com/makandra/cucumber_factory}
63
63
  s.rdoc_options = ["--charset=UTF-8"]
64
64
  s.require_paths = ["lib"]
65
- s.rubygems_version = %q{1.3.6}
65
+ s.rubygems_version = %q{1.3.7}
66
66
  s.summary = %q{Create records from Cucumber features without writing step definitions.}
67
67
  s.test_files = [
68
68
  "spec/app_root/app/controllers/application_controller.rb",
@@ -88,16 +88,16 @@ Gem::Specification.new do |s|
88
88
  "spec/app_root/db/migrate/004_create_actors.rb",
89
89
  "spec/app_root/lib/console_with_fixtures.rb",
90
90
  "spec/spec_helper.rb",
91
- "spec/step_mother_ext_spec.rb",
92
91
  "spec/factory_spec.rb",
93
- "spec/steps_spec.rb"
92
+ "spec/steps_spec.rb",
93
+ "spec/runtime_ext_spec.rb"
94
94
  ]
95
95
 
96
96
  if s.respond_to? :specification_version then
97
97
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
98
98
  s.specification_version = 3
99
99
 
100
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
100
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
101
101
  else
102
102
  end
103
103
  else
@@ -15,7 +15,7 @@ module Cucumber
15
15
 
16
16
  end
17
17
 
18
- class StepMother
18
+ (defined?(Runtime) ? Runtime : StepMother).class_eval do
19
19
 
20
20
  def step_match_with_factory_priority(*args)
21
21
  step_match_without_factory_priority(*args)
@@ -33,4 +33,3 @@ module Cucumber
33
33
  end
34
34
 
35
35
  end
36
-
@@ -1,2 +1,2 @@
1
1
  require 'cucumber/factory'
2
- require 'cucumber/step_mother_ext'
2
+ require 'cucumber/runtime_ext'
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/spec_helper'
3
3
  require 'cucumber'
4
4
  require 'cucumber/rb_support/rb_language'
5
5
 
6
- describe Cucumber::StepMother, 'extended with cucumber_factory' do
6
+ describe Cucumber::Runtime, 'extended with cucumber_factory' do
7
7
 
8
8
  before(:each) do
9
9
  prepare_cucumber_example
@@ -13,14 +13,14 @@ describe Cucumber::StepMother, 'extended with cucumber_factory' do
13
13
 
14
14
  it "should not raise an ambiguous step error and return the user step if the only other matching step is a factory step" do
15
15
  user_step = @main.Given(/^there is a movie with a funny tone/){}
16
- @step_mother.step_match('there is a movie with a funny tone').should == user_step
16
+ @runtime.step_match('there is a movie with a funny tone').should == user_step
17
17
  end
18
18
 
19
19
  it "should still raise an ambiguous step error if more than two non-factory steps match" do
20
20
  @main.Given(/^there is a movie with (.*?) tone/){}
21
21
  @main.Given(/^there is a movie with a funny tone/){}
22
22
  expect do
23
- @step_mother.step_match('there is a movie with a funny tone')
23
+ @runtime.step_match('there is a movie with a funny tone')
24
24
  end.to raise_error(Cucumber::Ambiguous)
25
25
  end
26
26
 
data/spec/spec_helper.rb CHANGED
@@ -20,8 +20,8 @@ Spec::Runner.configure do |config|
20
20
  end
21
21
 
22
22
  def prepare_cucumber_example
23
- @step_mother = Cucumber::StepMother.new
24
- language = @step_mother.load_programming_language('rb')
23
+ @runtime = Cucumber::Runtime.new
24
+ language = @runtime.load_programming_language('rb')
25
25
  scenario = stub('scenario', :language => 'en')
26
26
  language.send(:begin_scenario, scenario)
27
27
  @world = language.current_world
@@ -29,3 +29,7 @@ def prepare_cucumber_example
29
29
  @main.extend(Cucumber::RbSupport::RbDsl)
30
30
  Cucumber::Factory.add_steps(@main)
31
31
  end
32
+
33
+ def invoke_cucumber_step(step)
34
+ @runtime.step_match(step).invoke(nil) # nil means no multiline args
35
+ end
data/spec/steps_spec.rb CHANGED
@@ -19,69 +19,69 @@ describe 'steps provided by cucumber_factory' do
19
19
  movie = Movie.new
20
20
  Movie.should_receive(:new).with().and_return(movie)
21
21
  movie.should_receive(:save!)
22
- @step_mother.invoke("there is a movie")
22
+ invoke_cucumber_step("there is a movie")
23
23
  end
24
24
 
25
25
  it "should create models that have a machinist blueprint by calling #make" do
26
26
  MachinistModel.should_receive(:make).with({ :attribute => "foo"})
27
- @step_mother.invoke('there is a machinist model with the attribute "foo"')
27
+ invoke_cucumber_step('there is a machinist model with the attribute "foo"')
28
28
  end
29
29
 
30
- it "should be able to invoke machinist blueprint variants" do
30
+ it "should be able to step_match machinist blueprint variants" do
31
31
  MachinistModel.should_receive(:make).with(:variant, { :attribute => "foo"})
32
- @step_mother.invoke('there is a machinist model (variant) with the attribute "foo"')
32
+ invoke_cucumber_step('there is a machinist model (variant) with the attribute "foo"')
33
33
  end
34
34
 
35
- it "should be able to invoke machinist blueprint variants containing spaces or uppercase characters in prose" do
35
+ it "should be able to step_match machinist blueprint variants containing spaces or uppercase characters in prose" do
36
36
  MachinistModel.should_receive(:make).with(:variant_mark_two, { :attribute => "foo"})
37
- @step_mother.invoke('there is a machinist model (Variant Mark Two) with the attribute "foo"')
37
+ invoke_cucumber_step('there is a machinist model (Variant Mark Two) with the attribute "foo"')
38
38
  end
39
39
 
40
40
  it "should create models that have a factory_girl factory by calling #Factory.make(:model_name)" do
41
41
  Factory.should_receive(:factories).with().and_return({ :job_offer => :job_offer_factory }) # Fake factory look up in factory_girl
42
42
  Factory.should_receive(:create).with(:job_offer, { :title => "Awesome job" })
43
- @step_mother.invoke('there is a job offer with the title "Awesome job"')
43
+ invoke_cucumber_step('there is a job offer with the title "Awesome job"')
44
44
  end
45
45
 
46
46
  it "should instantiate plain ruby classes by calling #new" do
47
47
  PlainRubyClass.should_receive(:new).with({})
48
- @step_mother.invoke("there is a plain ruby class")
48
+ invoke_cucumber_step("there is a plain ruby class")
49
49
  end
50
50
 
51
51
  it "should instantiate classes with multiple words in their name" do
52
52
  JobOffer.should_receive(:new).with({})
53
- @step_mother.invoke("there is a job offer")
53
+ invoke_cucumber_step("there is a job offer")
54
54
  end
55
55
 
56
56
  it "should instantiate classes with uppercase characters in their name" do
57
57
  user = User.new
58
58
  User.should_receive(:new).and_return(user)
59
- @step_mother.invoke("there is a User")
59
+ invoke_cucumber_step("there is a User")
60
60
  end
61
61
 
62
62
  it "should instantiate namespaced classes" do
63
63
  actor = People::Actor.new
64
64
  People::Actor.should_receive(:new).and_return(actor)
65
- @step_mother.invoke("there is a people/actor")
65
+ invoke_cucumber_step("there is a people/actor")
66
66
  end
67
67
 
68
68
  it "should allow either 'a' or 'an' for the article" do
69
69
  Opera.should_receive(:new).with({})
70
- @step_mother.invoke("there is an opera")
70
+ invoke_cucumber_step("there is an opera")
71
71
  end
72
72
 
73
73
  it "should create records with attributes" do
74
74
  movie = Movie.new
75
75
  Movie.stub(:new => movie)
76
76
  movie.should_receive(:"attributes=").with({ :title => "Sunshine", :year => "2007" }, false)
77
- @step_mother.invoke('there is a movie with the title "Sunshine" and the year "2007"')
77
+ invoke_cucumber_step('there is a movie with the title "Sunshine" and the year "2007"')
78
78
  end
79
79
 
80
80
  it "should allow to join attribute lists with 'and's, commas and 'but's" do
81
81
  movie = Movie.new
82
82
  Movie.stub(:new => movie)
83
83
  movie.should_receive(:"attributes=").with({ :title => "Sunshine", :year => "2007", :box_office_result => "32000000" }, false)
84
- @step_mother.invoke('there is a movie with the title "Sunshine", the year "2007" but with the box office result "32000000"')
84
+ invoke_cucumber_step('there is a movie with the title "Sunshine", the year "2007" but with the box office result "32000000"')
85
85
  end
86
86
 
87
87
  it "should apply Cucumber transforms to attribute values" do
@@ -89,45 +89,45 @@ describe 'steps provided by cucumber_factory' do
89
89
  Movie.stub(:new => movie)
90
90
  @world.should_receive(:Transform).with("value").and_return("transformed value")
91
91
  movie.should_receive(:"attributes=").with({ :title => "transformed value" }, false)
92
- @step_mother.invoke('there is a movie with the title "value"')
92
+ invoke_cucumber_step('there is a movie with the title "value"')
93
93
  end
94
94
 
95
95
  it "should create records with attributes containing spaces" do
96
96
  movie = Movie.new
97
97
  Movie.stub(:new => movie)
98
98
  movie.should_receive(:"attributes=").with({ :box_office_result => "99999999" }, false)
99
- @step_mother.invoke('there is a movie with the box office result "99999999"')
99
+ invoke_cucumber_step('there is a movie with the box office result "99999999"')
100
100
  end
101
101
 
102
102
  it "should create records with attributes containing uppercase characters" do
103
103
  user = User.new
104
104
  User.stub(:new => user)
105
105
  user.should_receive(:"attributes=").with({ :name => "Susanne" }, false)
106
- @step_mother.invoke('there is a User with the Name "Susanne"')
106
+ invoke_cucumber_step('there is a User with the Name "Susanne"')
107
107
  end
108
108
 
109
109
  it "should override attr_accessible protection" do
110
- @step_mother.invoke('there is a payment with the amount "120" and the comment "Thanks for lending"')
110
+ invoke_cucumber_step('there is a payment with the amount "120" and the comment "Thanks for lending"')
111
111
  payment = Payment.last
112
112
  payment.amount.should == 120
113
113
  payment.comment.should == 'Thanks for lending'
114
114
  end
115
115
 
116
116
  it "should set instance variables in the world" do
117
- @step_mother.invoke('"Sunshine" is a movie with the title "Sunshine" and the year "2007"')
117
+ invoke_cucumber_step('"Sunshine" is a movie with the title "Sunshine" and the year "2007"')
118
118
  @world.instance_variable_get(:'@sunshine').title.should == "Sunshine"
119
119
  end
120
120
 
121
121
  it "should understand pointers to instance variables" do
122
- @step_mother.invoke('"Before Sunrise" is a movie with the title "Before Sunrise"')
123
- @step_mother.invoke('"Before Sunset" is a movie with the title "Before Sunset" and the prequel "Before Sunrise"')
122
+ invoke_cucumber_step('"Before Sunrise" is a movie with the title "Before Sunrise"')
123
+ invoke_cucumber_step('"Before Sunset" is a movie with the title "Before Sunset" and the prequel "Before Sunrise"')
124
124
  @world.instance_variable_get(:'@before_sunset').prequel.title.should == "Before Sunrise"
125
125
  end
126
126
 
127
127
  it "should allow to point to a previously created record through 'above'" do
128
- @step_mother.invoke('there is a user with the name "Jane"')
129
- @step_mother.invoke('there is a movie with the title "Before Sunrise"')
130
- @step_mother.invoke('there is a movie with the title "Before Sunset" and the reviewer above and the prequel above')
128
+ invoke_cucumber_step('there is a user with the name "Jane"')
129
+ invoke_cucumber_step('there is a movie with the title "Before Sunrise"')
130
+ invoke_cucumber_step('there is a movie with the title "Before Sunset" and the reviewer above and the prequel above')
131
131
  before_sunset = Movie.find_by_title!("Before Sunset")
132
132
  before_sunset.prequel.title.should == "Before Sunrise"
133
133
  before_sunset.reviewer.name.should == "Jane"
@@ -137,56 +137,56 @@ describe 'steps provided by cucumber_factory' do
137
137
  user = User.new
138
138
  User.stub(:new => user)
139
139
  user.should_receive(:attributes=).with({ :name => 'Jane', :deleted => true }, false)
140
- @step_mother.invoke('there is a user with the name "Jane" who is deleted')
140
+ invoke_cucumber_step('there is a user with the name "Jane" who is deleted')
141
141
  end
142
142
 
143
143
  it "should allow to set positive boolean attributes with 'which' after the attribute list" do
144
144
  user = User.new
145
145
  User.stub(:new => user)
146
146
  user.should_receive(:attributes=).with({ :name => 'Jane', :deleted => true }, false)
147
- @step_mother.invoke('there is a user with the name "Jane" which is deleted')
147
+ invoke_cucumber_step('there is a user with the name "Jane" which is deleted')
148
148
  end
149
149
 
150
150
  it "should allow to set positive boolean attributes with 'that' after the attribute list" do
151
151
  user = User.new
152
152
  User.stub(:new => user)
153
153
  user.should_receive(:attributes=).with({ :name => 'Jane', :deleted => true }, false)
154
- @step_mother.invoke('there is a user with the name "Jane" that is deleted')
154
+ invoke_cucumber_step('there is a user with the name "Jane" that is deleted')
155
155
  end
156
156
 
157
157
  it "should allow to set boolean attributes without regular attributes preceding them" do
158
158
  user = User.new
159
159
  User.stub(:new => user)
160
160
  user.should_receive(:attributes=).with({ :deleted => true }, false)
161
- @step_mother.invoke('there is a user who is deleted')
161
+ invoke_cucumber_step('there is a user who is deleted')
162
162
  end
163
163
 
164
164
  it "should allow to set negative boolean attribute" do
165
165
  user = User.new
166
166
  User.stub(:new => user)
167
167
  user.should_receive(:attributes=).with({ :deleted => false }, false)
168
- @step_mother.invoke('there is a user who is not deleted')
168
+ invoke_cucumber_step('there is a user who is not deleted')
169
169
  end
170
170
 
171
171
  it "should allow to set multiple boolean attributes" do
172
172
  user = User.new
173
173
  User.stub(:new => user)
174
174
  user.should_receive(:attributes=).with({ :locked => true, :deleted => false, :subscribed => true }, false)
175
- @step_mother.invoke('there is a user who is locked and not deleted and subscribed')
175
+ invoke_cucumber_step('there is a user who is locked and not deleted and subscribed')
176
176
  end
177
177
 
178
178
  it "should allow to set boolean attributes that are named from multiple words" do
179
179
  user = User.new
180
180
  User.stub(:new => user)
181
181
  user.should_receive(:attributes=).with({ :locked => true, :scared => false, :scared_by_spiders => true, :deleted => true }, false)
182
- @step_mother.invoke('there is a user who is locked and not scared and scared by spiders and deleted')
182
+ invoke_cucumber_step('there is a user who is locked and not scared and scared by spiders and deleted')
183
183
  end
184
184
 
185
185
  it "should allow to join boolean attribute lists with 'and's, commas and 'but's" do
186
186
  user = User.new
187
187
  User.stub(:new => user)
188
188
  user.should_receive(:attributes=).with({ :locked => true, :scared => true, :scared_by_spiders => true, :deleted => true }, false)
189
- @step_mother.invoke('there is a user who is locked, scared, but scared by spiders and deleted')
189
+ invoke_cucumber_step('there is a user who is locked, scared, but scared by spiders and deleted')
190
190
  end
191
191
 
192
192
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber_factory
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 15
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 7
8
- - 1
9
- version: 1.7.1
9
+ - 2
10
+ version: 1.7.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Henning Koch
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-11-05 00:00:00 +01:00
18
+ date: 2010-11-17 00:00:00 +01:00
18
19
  default_executable:
19
20
  dependencies: []
20
21
 
@@ -36,7 +37,7 @@ files:
36
37
  - VERSION
37
38
  - cucumber_factory.gemspec
38
39
  - lib/cucumber/factory.rb
39
- - lib/cucumber/step_mother_ext.rb
40
+ - lib/cucumber/runtime_ext.rb
40
41
  - lib/cucumber_factory.rb
41
42
  - spec/app_root/app/controllers/application_controller.rb
42
43
  - spec/app_root/app/models/job_offer.rb
@@ -64,8 +65,8 @@ files:
64
65
  - spec/app_root/log/.gitignore
65
66
  - spec/app_root/script/console
66
67
  - spec/factory_spec.rb
68
+ - spec/runtime_ext_spec.rb
67
69
  - spec/spec_helper.rb
68
- - spec/step_mother_ext_spec.rb
69
70
  - spec/steps_spec.rb
70
71
  - spec/support/rcov.opts
71
72
  - spec/support/spec.opts
@@ -79,23 +80,27 @@ rdoc_options:
79
80
  require_paths:
80
81
  - lib
81
82
  required_ruby_version: !ruby/object:Gem::Requirement
83
+ none: false
82
84
  requirements:
83
85
  - - ">="
84
86
  - !ruby/object:Gem::Version
87
+ hash: 3
85
88
  segments:
86
89
  - 0
87
90
  version: "0"
88
91
  required_rubygems_version: !ruby/object:Gem::Requirement
92
+ none: false
89
93
  requirements:
90
94
  - - ">="
91
95
  - !ruby/object:Gem::Version
96
+ hash: 3
92
97
  segments:
93
98
  - 0
94
99
  version: "0"
95
100
  requirements: []
96
101
 
97
102
  rubyforge_project:
98
- rubygems_version: 1.3.6
103
+ rubygems_version: 1.3.7
99
104
  signing_key:
100
105
  specification_version: 3
101
106
  summary: Create records from Cucumber features without writing step definitions.
@@ -123,6 +128,6 @@ test_files:
123
128
  - spec/app_root/db/migrate/004_create_actors.rb
124
129
  - spec/app_root/lib/console_with_fixtures.rb
125
130
  - spec/spec_helper.rb
126
- - spec/step_mother_ext_spec.rb
127
131
  - spec/factory_spec.rb
128
132
  - spec/steps_spec.rb
133
+ - spec/runtime_ext_spec.rb