cucumber-rails 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,11 @@
1
+ == 0.5.1 2011-05-25
2
+
3
+ === Bugfixes
4
+ * Mixed DB access feature for @javascript drivers (#142 Alexander Mankuta)
5
+ * cucumber:feature and integers. not creating feature correctly (#30 John Ivanoff, Aslak Hellesøy)
6
+ * New project can't find capybara's "visit" (#143 Aslak Hellesøy)
7
+ * rails generate cucumber:install attempts double run (#140 Aslak Hellesøy)
8
+
1
9
  == 0.5.0 2011-05-17
2
10
 
3
11
  === Bugfixes
@@ -3,17 +3,18 @@ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'cucumber-rails'
6
- s.version = '0.5.0'
6
+ s.version = '0.5.1'
7
7
  s.authors = ["Aslak Hellesøy", "Dennis Blöte", "Rob Holland"]
8
8
  s.description = "Cucumber Generators and Runtime for Rails"
9
9
  s.summary = "#{s.name}-#{s.version}"
10
10
  s.email = 'cukes@googlegroups.com'
11
11
  s.homepage = "http://cukes.info"
12
12
 
13
- s.add_dependency('cucumber', '>= 0.10.2')
13
+ s.add_dependency('cucumber', '>= 0.10.3')
14
14
  s.add_dependency('rack-test', '>= 0.5.7')
15
15
  s.add_dependency('nokogiri', '>= 1.4.4')
16
16
  s.add_dependency('capybara', '>= 1.0.0.beta1')
17
+ s.add_development_dependency('rake', '= 0.8.7') # Until Rails 3 supports rake 0.9.0. Rakefile needs TheApp::Application.send(:include, Rake::DSL)
17
18
  s.add_development_dependency('bundler', '>= 1.0.13')
18
19
  s.add_development_dependency('aruba', '>= 0.3.6')
19
20
  s.add_development_dependency('rails', '>= 3.0.7')
@@ -22,7 +23,7 @@ Gem::Specification.new do |s|
22
23
  s.add_development_dependency('rspec-rails', '>= 2.6.0')
23
24
  s.add_development_dependency('factory_girl', '>= 2.0.0.beta2')
24
25
  s.add_development_dependency('database_cleaner', '>= 0.6.7')
25
- s.add_development_dependency('mongoid', '>= 2.0.1')
26
+ s.add_development_dependency('mongoid', '>= 2.0.2')
26
27
  s.add_development_dependency('bson_ext', '>= 1.3.0')
27
28
  # s.add_development_dependency('akephalos', '>= 0.2.5')
28
29
 
@@ -1,10 +1,11 @@
1
- @broken
2
1
  Feature: Capybara Javascript Drivers
3
2
 
4
3
  Background: A simple calendar app
5
4
  Given I have created a new Rails 3 app "rails-3-app" with cucumber-rails support
6
5
  And I successfully run `bundle exec rails g scaffold appointment name:string when:datetime`
7
- And I write to "features/create_appointment.feature" with:
6
+
7
+ Scenario Outline: Use a particular driver
8
+ Given I write to "features/create_appointment.feature" with:
8
9
  """
9
10
  @javascript
10
11
  Feature: Create appointments
@@ -17,9 +18,7 @@ Feature: Capybara Javascript Drivers
17
18
  And I should see "2009-02-20 15:10:00 UTC"
18
19
 
19
20
  """
20
-
21
- Scenario Outline: Use a particular driver
22
- Given I append to "Gemfile" with:
21
+ And I append to "Gemfile" with:
23
22
  """
24
23
  <Gemfile extra>
25
24
 
@@ -36,8 +35,51 @@ Feature: Capybara Javascript Drivers
36
35
  1 scenario (1 passed)
37
36
  6 steps (6 passed)
38
37
  """
39
-
38
+
39
+ Examples:
40
+ | Gemfile extra | env.rb extra |
41
+ | gem "capybara", :group => :test | require 'capybara' |
42
+
43
+ Scenario Outline: Mixed DB access
44
+ Given I write to "features/create_appointment.feature" with:
45
+ """
46
+ @javascript
47
+ Feature: Create appointments
48
+ Scenario: Constitution on May 17
49
+ Given a random appointment
50
+ And I am viewing random appointment
51
+ Then I should see "Random appointment"
52
+
53
+ """
54
+ And I write to "features/step_definitions/custom_steps.rb" with:
55
+ """
56
+ Given /^a random appointment$/ do
57
+ @appointment = Appointment.create!(:name => 'Random appointment', :when => DateTime.now)
58
+ end
59
+
60
+ Given /^I am viewing random appointment$/ do
61
+ visit appointment_path(@appointment)
62
+ end
63
+ """
64
+ And I append to "Gemfile" with:
65
+ """
66
+ <Gemfile extra>
67
+
68
+ """
69
+ And I append to "features/support/env.rb" with:
70
+ """
71
+ <env.rb extra>
72
+
73
+ """
74
+
75
+ When I run `bundle exec rake db:migrate cucumber`
76
+ Then it should pass with:
77
+ """
78
+ 1 scenario (1 passed)
79
+ 3 steps (3 passed)
80
+ """
81
+
40
82
  Examples:
41
- | Gemfile extra | env.rb extra |
42
- | gem "akephalos", :group => :test | require 'akephalos' ; Capybara.javascript_driver = :akephalos |
43
-
83
+ | Gemfile extra | env.rb extra |
84
+ | gem "capybara", :group => :test | require 'capybara' |
85
+
@@ -1,16 +1,16 @@
1
1
  Feature: Emulate Javascript
2
2
 
3
- Scenario: Delete a widget
3
+ Scenario: See a widget
4
4
  Given I have created a new Rails 3 app "widgets" with cucumber-rails support
5
5
  And I successfully run `rails generate scaffold widget name:string`
6
6
  And I write to "features/f.feature" with:
7
7
  """
8
+ @javascript
8
9
  Feature: Widget inventory
9
10
  Scenario: Delete a widget
10
11
  Given there is a widget named "wrench"
11
12
  When I go to the widgets page
12
- And I follow "Destroy"
13
- Then I should not see "wrench"
13
+ Then I should see "wrench"
14
14
  """
15
15
  And I write to "features/step_definitions/s.rb" with:
16
16
  """
@@ -28,6 +28,6 @@ Feature: Emulate Javascript
28
28
  Then it should pass with:
29
29
  """
30
30
  1 scenario (1 passed)
31
- 4 steps (4 passed)
31
+ 3 steps (3 passed)
32
32
  """
33
33
 
@@ -2,9 +2,9 @@ Feature: Inspect query string
2
2
 
3
3
  Scenario: Inspect query string
4
4
  Given I have created a new Rails 3 app "rails-3-app" with cucumber-rails support
5
- And I successfully run `rails generate cucumber:feature post title:string body:text published:boolean`
6
- And I successfully run `rails generate scaffold post title:string body:text published:boolean`
7
- And I successfully run `rails generate scaffold cukes name:string`
5
+ And I successfully run `rails generate cucumber:feature post title:string body:text number:integer published:boolean`
6
+ And I successfully run `rails generate scaffold post title:string body:text number:integer published:boolean`
7
+ And I successfully run `rails generate scaffold cuke name:string`
8
8
  And I overwrite "app/controllers/cukes_controller.rb" with:
9
9
  """
10
10
  class CukesController < ApplicationController
@@ -31,6 +31,6 @@ Feature: Inspect query string
31
31
  Then it should pass with:
32
32
  """
33
33
  3 scenarios (3 passed)
34
- 14 steps (14 passed)
34
+ 16 steps (16 passed)
35
35
  """
36
36
 
@@ -5,6 +5,6 @@ require 'rspec/expectations'
5
5
  require 'aruba/cucumber'
6
6
 
7
7
  Before do
8
- @aruba_timeout_seconds = 60 # A long time needed some times to install gems (bundle install)
8
+ @aruba_timeout_seconds = 120 # A long time needed some times
9
9
  unset_bundler_env_vars
10
10
  end
@@ -1,7 +1,6 @@
1
- if defined?(Capybara)
2
- require 'capybara/rails'
3
- require 'capybara/cucumber'
4
- require 'capybara/session'
5
- require 'cucumber/rails/capybara/javascript_emulation'
6
- require 'cucumber/rails/capybara/select_dates_and_times'
7
- end
1
+ require 'capybara'
2
+ require 'capybara/rails'
3
+ require 'capybara/cucumber'
4
+ require 'capybara/session'
5
+ require 'cucumber/rails/capybara/javascript_emulation'
6
+ require 'cucumber/rails/capybara/select_dates_and_times'
@@ -1,3 +1,4 @@
1
+ require 'cucumber/rails/hooks/active_record'
1
2
  require 'cucumber/rails/hooks/database_cleaner'
2
3
  require 'cucumber/rails/hooks/allow_rescue'
3
4
  require 'cucumber/rails/hooks/mail'
@@ -0,0 +1,14 @@
1
+ if defined?(ActiveRecord::Base)
2
+ require 'cucumber/rails3/active_record'
3
+
4
+ Before('@javascript') do
5
+ # Forces all threads to share the same connection. This works on
6
+ # Capybara because it starts the web server in a thread.
7
+ ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
8
+ end
9
+
10
+ Before('~@javascript') do
11
+ # Do not use a shared connection unless we're in a @javascript scenario
12
+ ActiveRecord::Base.shared_connection = nil
13
+ end
14
+ end
@@ -0,0 +1,8 @@
1
+ class ActiveRecord::Base
2
+ mattr_accessor :shared_connection
3
+ @@shared_connection = nil
4
+
5
+ def self.connection
6
+ @@shared_connection || retrieve_connection
7
+ end
8
+ end
@@ -9,6 +9,8 @@ class NamedArg
9
9
  def value(n)
10
10
  if @type == 'boolean'
11
11
  (n % 2) == 0
12
+ elsif @type == 'integer'
13
+ n
12
14
  else
13
15
  "#{@name} #{n}"
14
16
  end
@@ -7,9 +7,9 @@ Description:
7
7
  Also see the cucumber:feature generator.
8
8
 
9
9
  Examples:
10
- `script/rails generate cucumber:install`
10
+ `rails generate cucumber:install`
11
11
 
12
- `script/rails generate cucumber:install --help`
12
+ `rails generate cucumber:install --help`
13
13
 
14
- You can also provide a language argument for localized webrat_steps:
15
- `script/rails generate cucumber:install de`
14
+ You can also provide a language argument for localized web_steps:
15
+ `rails generate cucumber:install de`
@@ -15,15 +15,6 @@ module Cucumber
15
15
 
16
16
  attr_reader :framework
17
17
 
18
- def generate
19
- create_templates
20
- create_scripts
21
- create_step_definitions
22
- create_feature_support
23
- create_tasks
24
- create_database unless options[:skip_database]
25
- end
26
-
27
18
  def create_templates
28
19
  template 'config/cucumber.yml.erb', 'config/cucumber.yml'
29
20
  end
@@ -27,7 +27,7 @@ end
27
27
  # See the DatabaseCleaner documentation for details. Example:
28
28
  #
29
29
  # Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
30
- # DatabaseCleaner.strategy = :truncation, :except => %w[widgets]
30
+ # DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]}
31
31
  # end
32
32
  #
33
33
  # Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
@@ -1,4 +1,3 @@
1
- require 'capybara'
2
1
  # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
3
2
  # order to ease the transition to Capybara we set the default here. If you'd
4
3
  # prefer to use XPath just remove this line and adjust any selectors in your
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: cucumber-rails
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.0
5
+ version: 0.5.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - "Aslak Helles\xC3\xB8y"
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2011-05-17 00:00:00 +01:00
15
+ date: 2011-05-25 00:00:00 +01:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
@@ -22,7 +22,7 @@ dependencies:
22
22
  requirements:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: 0.10.2
25
+ version: 0.10.3
26
26
  type: :runtime
27
27
  prerelease: false
28
28
  version_requirements: *id001
@@ -60,62 +60,62 @@ dependencies:
60
60
  prerelease: false
61
61
  version_requirements: *id004
62
62
  - !ruby/object:Gem::Dependency
63
- name: bundler
63
+ name: rake
64
64
  requirement: &id005 !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
67
- - - ">="
67
+ - - "="
68
68
  - !ruby/object:Gem::Version
69
- version: 1.0.13
69
+ version: 0.8.7
70
70
  type: :development
71
71
  prerelease: false
72
72
  version_requirements: *id005
73
73
  - !ruby/object:Gem::Dependency
74
- name: aruba
74
+ name: bundler
75
75
  requirement: &id006 !ruby/object:Gem::Requirement
76
76
  none: false
77
77
  requirements:
78
78
  - - ">="
79
79
  - !ruby/object:Gem::Version
80
- version: 0.3.6
80
+ version: 1.0.13
81
81
  type: :development
82
82
  prerelease: false
83
83
  version_requirements: *id006
84
84
  - !ruby/object:Gem::Dependency
85
- name: rails
85
+ name: aruba
86
86
  requirement: &id007 !ruby/object:Gem::Requirement
87
87
  none: false
88
88
  requirements:
89
89
  - - ">="
90
90
  - !ruby/object:Gem::Version
91
- version: 3.0.7
91
+ version: 0.3.6
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: *id007
95
95
  - !ruby/object:Gem::Dependency
96
- name: sqlite3-ruby
96
+ name: rails
97
97
  requirement: &id008 !ruby/object:Gem::Requirement
98
98
  none: false
99
99
  requirements:
100
100
  - - ">="
101
101
  - !ruby/object:Gem::Version
102
- version: 1.3.3
102
+ version: 3.0.7
103
103
  type: :development
104
104
  prerelease: false
105
105
  version_requirements: *id008
106
106
  - !ruby/object:Gem::Dependency
107
- name: rspec
107
+ name: sqlite3-ruby
108
108
  requirement: &id009 !ruby/object:Gem::Requirement
109
109
  none: false
110
110
  requirements:
111
111
  - - ">="
112
112
  - !ruby/object:Gem::Version
113
- version: 2.6.0
113
+ version: 1.3.3
114
114
  type: :development
115
115
  prerelease: false
116
116
  version_requirements: *id009
117
117
  - !ruby/object:Gem::Dependency
118
- name: rspec-rails
118
+ name: rspec
119
119
  requirement: &id010 !ruby/object:Gem::Requirement
120
120
  none: false
121
121
  requirements:
@@ -126,49 +126,60 @@ dependencies:
126
126
  prerelease: false
127
127
  version_requirements: *id010
128
128
  - !ruby/object:Gem::Dependency
129
- name: factory_girl
129
+ name: rspec-rails
130
130
  requirement: &id011 !ruby/object:Gem::Requirement
131
131
  none: false
132
132
  requirements:
133
133
  - - ">="
134
134
  - !ruby/object:Gem::Version
135
- version: 2.0.0.beta2
135
+ version: 2.6.0
136
136
  type: :development
137
137
  prerelease: false
138
138
  version_requirements: *id011
139
139
  - !ruby/object:Gem::Dependency
140
- name: database_cleaner
140
+ name: factory_girl
141
141
  requirement: &id012 !ruby/object:Gem::Requirement
142
142
  none: false
143
143
  requirements:
144
144
  - - ">="
145
145
  - !ruby/object:Gem::Version
146
- version: 0.6.7
146
+ version: 2.0.0.beta2
147
147
  type: :development
148
148
  prerelease: false
149
149
  version_requirements: *id012
150
150
  - !ruby/object:Gem::Dependency
151
- name: mongoid
151
+ name: database_cleaner
152
152
  requirement: &id013 !ruby/object:Gem::Requirement
153
153
  none: false
154
154
  requirements:
155
155
  - - ">="
156
156
  - !ruby/object:Gem::Version
157
- version: 2.0.1
157
+ version: 0.6.7
158
158
  type: :development
159
159
  prerelease: false
160
160
  version_requirements: *id013
161
161
  - !ruby/object:Gem::Dependency
162
- name: bson_ext
162
+ name: mongoid
163
163
  requirement: &id014 !ruby/object:Gem::Requirement
164
164
  none: false
165
165
  requirements:
166
166
  - - ">="
167
167
  - !ruby/object:Gem::Version
168
- version: 1.3.0
168
+ version: 2.0.2
169
169
  type: :development
170
170
  prerelease: false
171
171
  version_requirements: *id014
172
+ - !ruby/object:Gem::Dependency
173
+ name: bson_ext
174
+ requirement: &id015 !ruby/object:Gem::Requirement
175
+ none: false
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: 1.3.0
180
+ type: :development
181
+ prerelease: false
182
+ version_requirements: *id015
172
183
  description: Cucumber Generators and Runtime for Rails
173
184
  email: cukes@googlegroups.com
174
185
  executables: []
@@ -215,6 +226,7 @@ files:
215
226
  - lib/cucumber/rails/capybara/javascript_emulation.rb
216
227
  - lib/cucumber/rails/capybara/select_dates_and_times.rb
217
228
  - lib/cucumber/rails/hooks.rb
229
+ - lib/cucumber/rails/hooks/active_record.rb
218
230
  - lib/cucumber/rails/hooks/allow_rescue.rb
219
231
  - lib/cucumber/rails/hooks/database_cleaner.rb
220
232
  - lib/cucumber/rails/hooks/mail.rb
@@ -222,6 +234,7 @@ files:
222
234
  - lib/cucumber/rails/world.rb
223
235
  - lib/cucumber/rails3.rb
224
236
  - lib/cucumber/rails3/action_controller.rb
237
+ - lib/cucumber/rails3/active_record.rb
225
238
  - lib/cucumber/rails3/application.rb
226
239
  - lib/cucumber/web/tableish.rb
227
240
  - lib/generators/cucumber/feature/USAGE
@@ -232,7 +245,6 @@ files:
232
245
  - lib/generators/cucumber/install/USAGE
233
246
  - lib/generators/cucumber/install/install_generator.rb
234
247
  - lib/generators/cucumber/install/templates/config/cucumber.yml.erb
235
- - lib/generators/cucumber/install/templates/environments/cucumber.rb.erb
236
248
  - lib/generators/cucumber/install/templates/script/cucumber
237
249
  - lib/generators/cucumber/install/templates/step_definitions/web_steps.rb.erb
238
250
  - lib/generators/cucumber/install/templates/step_definitions/web_steps_cs.rb.erb
@@ -269,7 +281,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
269
281
  requirements:
270
282
  - - ">="
271
283
  - !ruby/object:Gem::Version
272
- hash: 3249523460490055111
284
+ hash: 3273597867549986785
273
285
  segments:
274
286
  - 0
275
287
  version: "0"
@@ -278,7 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
278
290
  requirements:
279
291
  - - ">="
280
292
  - !ruby/object:Gem::Version
281
- hash: 3249523460490055111
293
+ hash: 3273597867549986785
282
294
  segments:
283
295
  - 0
284
296
  version: "0"
@@ -288,7 +300,7 @@ rubyforge_project:
288
300
  rubygems_version: 1.6.2
289
301
  signing_key:
290
302
  specification_version: 3
291
- summary: cucumber-rails-0.5.0
303
+ summary: cucumber-rails-0.5.1
292
304
  test_files:
293
305
  - features/allow_rescue.feature
294
306
  - features/capybara_javascript_drivers.feature
@@ -1,33 +0,0 @@
1
- # Edit at your own peril - it's recommended to regenerate this file
2
- # in the future when you upgrade to a newer version of Cucumber.
3
-
4
- # IMPORTANT: Setting config.cache_classes to false is known to
5
- # break Cucumber's use_transactional_fixtures method.
6
- # For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165
7
- config.cache_classes = true
8
-
9
- # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
11
-
12
- # Show full error reports and disable caching
13
- config.action_controller.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
15
-
16
- # Disable request forgery protection in test environment
17
- config.action_controller.allow_forgery_protection = false
18
-
19
- # Tell Action Mailer not to deliver emails to the real world.
20
- # The :test delivery method accumulates sent emails in the
21
- # ActionMailer::Base.deliveries array.
22
- config.action_mailer.delivery_method = :test
23
-
24
- config.gem 'cucumber-rails', :lib => false, :version => '>=<%= version %>' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber-rails'))
25
- config.gem 'database_cleaner', :lib => false, :version => '>=0.5.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/database_cleaner'))
26
- config.gem 'capybara', :lib => false, :version => '>=0.3.5' unless File.directory?(File.join(Rails.root, 'vendor/plugins/capybara'))
27
- <% if framework == :rspec -%>
28
- config.gem 'rspec', :lib => false, :version => '>=1.3.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
29
- config.gem 'rspec-rails', :lib => false, :version => '>=1.3.2' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
30
- <% end %>
31
- <% if spork? -%>
32
- config.gem 'spork', :lib => false, :version => '>=0.7.5' unless File.directory?(File.join(Rails.root, 'vendor/plugins/spork'))
33
- <% end %>