cucumber-rails 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,10 @@
1
+ == 0.4.1 2011-04-05
2
+
3
+ === Bugfixes
4
+ * Fixed incorrect warning in generated files. (#115 Emanuele Vicentini)
5
+ * Fixed incorrect hooks for DatabaseCleaner (#113 Markus Bengts)
6
+ * Throw an error if the user forgot to add DatabaseCleaner to the Gemfile, allowing them to decide whether or not to use it. (#36 Aslak Hellesøy, Ryan Bigg)
7
+
1
8
  == 0.4.0 2011-03-20
2
9
 
3
10
  === New Features
@@ -23,6 +23,8 @@ Gem::Specification.new do |s|
23
23
  s.add_development_dependency('webrat', Cucumber::Rails::DEPS['webrat'])
24
24
  s.add_development_dependency('database_cleaner', Cucumber::Rails::DEPS['database_cleaner'])
25
25
  s.add_development_dependency('mongoid', Cucumber::Rails::DEPS['mongoid'])
26
+ s.add_development_dependency('bson_ext', Cucumber::Rails::DEPS['bson_ext'])
27
+ s.add_development_dependency('akephalos', Cucumber::Rails::DEPS['akephalos'])
26
28
 
27
29
  s.rubygems_version = ">= 1.6.1"
28
30
  s.files = `git ls-files`.split("\n")
@@ -0,0 +1,42 @@
1
+ Feature: Capybara Javascript Drivers
2
+
3
+ Background: A simple calendar app
4
+ Given I have created a new Rails 3 app "rails-3-app" with cucumber-rails support
5
+ And I successfully run `bundle exec rails g scaffold appointment name:string when:datetime`
6
+ And I write to "features/create_appointment.feature" with:
7
+ """
8
+ @javascript
9
+ Feature: Create appointments
10
+ Scenario: Constitution on May 17
11
+ Given I am on the new appointment page
12
+ And I fill in "Norway's constitution" for "Name"
13
+ And I select "2009-02-20 15:10:00 UTC" as the "When" date and time
14
+ And I press "Create Appointment"
15
+ Then I should see "Norway's constitution"
16
+ And I should see "2009-02-20 15:10:00 UTC"
17
+
18
+ """
19
+
20
+ Scenario Outline: Use a particular driver
21
+ Given I append to "Gemfile" with:
22
+ """
23
+ <Gemfile extra>
24
+
25
+ """
26
+ And I append to "features/support/env.rb" with:
27
+ """
28
+ <env.rb extra>
29
+
30
+ """
31
+
32
+ When I run `bundle exec rake db:migrate cucumber`
33
+ Then it should pass with:
34
+ """
35
+ 1 scenario (1 passed)
36
+ 6 steps (6 passed)
37
+ """
38
+
39
+ Examples:
40
+ | Gemfile extra | env.rb extra |
41
+ | gem "akephalos", :group => :test | require 'akephalos' ; Capybara.javascript_driver = :akephalos |
42
+
@@ -2,10 +2,10 @@ Feature: Select dates
2
2
 
3
3
  Background: A simple calendar app
4
4
  Given I have created a new Rails 3 app "rails-3-app" with cucumber-rails support
5
- And I successfully run `bundle exec rails g scaffold appointment name:string when:datetime`
6
5
 
7
- Scenario: Select dates
8
- Given I write to "features/create_appointment.feature" with:
6
+ Scenario: Select date and time
7
+ Given I successfully run `bundle exec rails g scaffold appointment name:string when:datetime`
8
+ And I write to "features/create_appointment.feature" with:
9
9
  """
10
10
  Feature: Create appointments
11
11
  Scenario: Constitution on May 17
@@ -22,4 +22,39 @@ Feature: Select dates
22
22
  1 scenario (1 passed)
23
23
  6 steps (6 passed)
24
24
  """
25
-
25
+
26
+ Scenario: Select date with label pointing to first select
27
+ Given I successfully run `bundle exec rails g scaffold appointment name:string when:date`
28
+ And I write to "features/create_appointment.feature" with:
29
+ """
30
+ Feature: Create appointments
31
+ Scenario: Constitution on May 17
32
+ Given I am on the new appointment page
33
+ And I fill in "Norway's constitution" for "Name"
34
+ And I select "2009-02-20" as the "When" date
35
+ And I press "Create Appointment"
36
+ Then I should see "Norway's constitution"
37
+ And I should see "2009-02-20"
38
+ """
39
+ And I write to "app/views/appointments/_form.html.erb" with:
40
+ """
41
+ <%= form_for(@appointment) do |f| %>
42
+ <div class="field">
43
+ <%= f.label :name %><br />
44
+ <%= f.text_field :name %>
45
+ </div>
46
+ <div class="field">
47
+ <%= f.label :when, :for => "appointment_when_1i" %><br />
48
+ <%= f.date_select :when %>
49
+ </div>
50
+ <div class="actions">
51
+ <%= f.submit %>
52
+ </div>
53
+ <% end %>
54
+ """
55
+ When I run `bundle exec rake db:migrate cucumber`
56
+ Then it should pass with:
57
+ """
58
+ 1 scenario (1 passed)
59
+ 6 steps (6 passed)
60
+ """
@@ -12,6 +12,7 @@ Given /^I have created a new Rails 3 app "([^"]*)" with cucumber\-rails support$
12
12
  gem "capybara", :group => :test
13
13
  gem "rspec-rails", :group => :test
14
14
  gem "database_cleaner", :group => :test
15
+
15
16
  """
16
17
  And I successfully run `bundle exec rails generate cucumber:install`
17
18
  }
@@ -26,11 +27,13 @@ Given /^a project without ActiveRecord$/ do
26
27
  gem "cucumber-rails", :group => :test, :path => "../../.."
27
28
  gem "capybara", :group => :test
28
29
  gem "rspec-rails", :group => :test
30
+
29
31
  """
30
32
  And I successfully run `bundle exec rails generate cucumber:install`
31
33
  And I overwrite "features/support/env.rb" with:
32
34
  """
33
35
  require 'cucumber/rails'
36
+
34
37
  """
35
38
 
36
39
  And I write to "config/application.rb" with:
@@ -50,6 +53,7 @@ Given /^a project without ActiveRecord$/ do
50
53
  config.filter_parameters += [:password]
51
54
  end
52
55
  end
56
+
53
57
  """
54
58
  And I remove the file "config/database.yml"
55
59
  }
@@ -62,6 +66,7 @@ And /^a cukes resource$/ do
62
66
  CukeApp::Application.routes.draw do
63
67
  resources :cukes
64
68
  end
69
+
65
70
  """
66
71
  And I write to "app/controllers/cukes_controller.rb" with:
67
72
  """
@@ -69,6 +74,7 @@ And /^a cukes resource$/ do
69
74
  def index
70
75
  end
71
76
  end
77
+
72
78
  """
73
79
  }
74
80
  end
@@ -28,7 +28,7 @@ module Cucumber
28
28
 
29
29
  # @example "event_starts_at_"
30
30
  def get_base_dom_id_from_label_tag(field)
31
- find(:xpath, "//label[contains(., '#{field}')]")['for'].gsub(/(1i)$/, '')
31
+ find(:xpath, "//label[contains(., '#{field}')]")['for'].gsub(/(_1i)$/, '')
32
32
  end
33
33
  end
34
34
  end
@@ -12,11 +12,11 @@ begin
12
12
  end
13
13
 
14
14
  Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
15
- DatabaseCleaner.strategy = :truncation
15
+ DatabaseCleaner.strategy = $__cucumber_global_database_cleaner_strategy
16
16
  end
17
17
 
18
18
  Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
19
- DatabaseCleaner.strategy = $__cucumber_global_database_cleaner_strategy
19
+ DatabaseCleaner.strategy = :truncation
20
20
  end
21
21
 
22
22
  Before do
@@ -1,6 +1,6 @@
1
1
  module Cucumber
2
2
  module Rails
3
- VERSION = '0.4.0'
3
+ VERSION = '0.4.1'
4
4
  DEPS = {
5
5
  'aruba' => '>= 0.3.4',
6
6
  'cucumber' => '>= 0.10.1',
@@ -8,13 +8,15 @@ module Cucumber
8
8
  'bundler' => '>= 1.0.10',
9
9
  'rack-test' => '>= 0.5.7',
10
10
  'nokogiri' => '>= 1.4.4',
11
- 'rails' => '>= 3.0.3',
11
+ 'rails' => '>= 3.0.5',
12
12
  'capybara' => '>= 0.4.1',
13
13
  'webrat' => '>= 0.7.3',
14
14
  'rspec-rails' => '>= 2.2.0',
15
15
  'database_cleaner' => '>= 0.6.0',
16
16
  'sqlite3-ruby' => '>= 1.3.3',
17
- 'mongoid' => '>= 2.0.0.rc.7'
17
+ 'mongoid' => '>= 2.0.0',
18
+ 'bson_ext' => '>= 1.3.0',
19
+ 'akephalos' => '>= 0.2.5'
18
20
  }
19
21
  end
20
22
  end
@@ -1,4 +1,4 @@
1
- <%= embed_file('support/edit_warning.txt') %>
1
+ <%= embed_file('support/web_steps_warning.txt') %>
2
2
 
3
3
  require 'uri'
4
4
  require 'cgi'
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- <%= embed_file('support/edit_warning.txt') %>
2
+ <%= embed_file('support/web_steps_warning.txt') %>
3
3
 
4
4
  require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
5
5
  require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "selectors"))
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- <%= embed_file('support/edit_warning.txt') %>
2
+ <%= embed_file('support/web_steps_warning.txt') %>
3
3
 
4
4
  require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
5
5
  require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "selectors"))
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- <%= embed_file('support/edit_warning.txt') %>
2
+ <%= embed_file('support/web_steps_warning.txt') %>
3
3
 
4
4
  require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
5
5
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- <%= embed_file('support/edit_warning.txt') %>
2
+ <%= embed_file('support/web_steps_warning.txt') %>
3
3
 
4
4
  require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
5
5
  require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "selectors"))
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- <%= embed_file('support/edit_warning.txt') %>
2
+ <%= embed_file('support/web_steps_warning.txt') %>
3
3
 
4
4
  require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
5
5
  require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "selectors"))
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- <%= embed_file('support/edit_warning.txt') %>
2
+ <%= embed_file('support/web_steps_warning.txt') %>
3
3
 
4
4
  require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
5
5
  require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "selectors"))
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- <%= embed_file('support/edit_warning.txt') %>
2
+ <%= embed_file('support/web_steps_warning.txt') %>
3
3
 
4
4
  require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
5
5
  require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "selectors"))
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- <%= embed_file('support/edit_warning.txt') %>
2
+ <%= embed_file('support/web_steps_warning.txt') %>
3
3
 
4
4
  require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
5
5
  require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "selectors"))
@@ -1,4 +1,4 @@
1
- <%= embed_file('support/edit_warning.txt') %>
1
+ <%= embed_file('support/web_steps_warning.txt') %>
2
2
 
3
3
  require 'uri'
4
4
  require 'cgi'
@@ -144,7 +144,7 @@ Then /^(?:|I )should see "([^"]*)"$/ do |text|
144
144
  end
145
145
  end
146
146
 
147
- Then /^(?:|I )should see "([^"]*)" within "([^"]*)"$/ do |text, parent|
147
+ Then /^(?:|I )should see "([^"]*)" within (.*)$/ do |text, parent|
148
148
  within(selector_for(parent)) do |content|
149
149
  if content.respond_to? :should
150
150
  content.should contain(text)
@@ -15,6 +15,10 @@
15
15
  #
16
16
  ActionController::Base.allow_rescue = false
17
17
 
18
- # Remove this line if your app doesn't have a database.
18
+ # Remove/comment out the lines below if your app doesn't have a database.
19
19
  # For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
20
- DatabaseCleaner.strategy = :transaction
20
+ begin
21
+ DatabaseCleaner.strategy = :transaction
22
+ rescue NameError
23
+ raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
24
+ end
@@ -1,19 +1,5 @@
1
- # TL;DR: YOU SHOULD DELETE THIS FILE
2
- #
3
- # This file iwas generated by Cucumber-Rails and is only here to get you a head start
4
- # These step definitions are thin wrappers around the Capybara/Webrat API that lets you
5
- # visit pages, interact with widgets and make assertions about page content.
6
- #
7
- # If you use these step definitions as basis for your features you will quickly end up
8
- # with features that are:
9
- #
10
- # * Hard to maintain
11
- # * Verbose to read
12
- #
13
- # A much better approach is to write your own higher level step definitions, following
14
- # the advice in the following blog posts:
15
- #
16
- # * http://benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories.html
17
- # * http://dannorth.net/2011/01/31/whose-domain-is-it-anyway/
18
- # * http://elabs.se/blog/15-you-re-cuking-it-wrong
19
- #
1
+ # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2
+ # It is recommended to regenerate this file in the future when you upgrade to a
3
+ # newer version of cucumber-rails. Consider adding your own code to a new file
4
+ # instead of editing this one. Cucumber will automatically load all features/**/*.rb
5
+ # files.
@@ -16,7 +16,7 @@ module HtmlSelectorsHelpers
16
16
  #
17
17
  # when /the (notice|error|info) flash/
18
18
  # ".flash.#{$1}"
19
-
19
+
20
20
  # You can also return an array to use a different selector
21
21
  # type, like:
22
22
  #
@@ -36,4 +36,4 @@ module HtmlSelectorsHelpers
36
36
  end
37
37
  end
38
38
 
39
- World(HtmlSelectorsHelpers)
39
+ World(HtmlSelectorsHelpers)
@@ -0,0 +1,19 @@
1
+ # TL;DR: YOU SHOULD DELETE THIS FILE
2
+ #
3
+ # This file was generated by Cucumber-Rails and is only here to get you a head start
4
+ # These step definitions are thin wrappers around the Capybara/Webrat API that lets you
5
+ # visit pages, interact with widgets and make assertions about page content.
6
+ #
7
+ # If you use these step definitions as basis for your features you will quickly end up
8
+ # with features that are:
9
+ #
10
+ # * Hard to maintain
11
+ # * Verbose to read
12
+ #
13
+ # A much better approach is to write your own higher level step definitions, following
14
+ # the advice in the following blog posts:
15
+ #
16
+ # * http://benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories.html
17
+ # * http://dannorth.net/2011/01/31/whose-domain-is-it-anyway/
18
+ # * http://elabs.se/blog/15-you-re-cuking-it-wrong
19
+ #
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: cucumber-rails
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.0
5
+ version: 0.4.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-03-20 00:00:00 +00:00
15
+ date: 2011-04-05 00:00:00 +01:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
@@ -77,7 +77,7 @@ dependencies:
77
77
  requirements:
78
78
  - - ">="
79
79
  - !ruby/object:Gem::Version
80
- version: 3.0.3
80
+ version: 3.0.5
81
81
  type: :development
82
82
  prerelease: false
83
83
  version_requirements: *id006
@@ -143,10 +143,32 @@ dependencies:
143
143
  requirements:
144
144
  - - ">="
145
145
  - !ruby/object:Gem::Version
146
- version: 2.0.0.rc.7
146
+ version: 2.0.0
147
147
  type: :development
148
148
  prerelease: false
149
149
  version_requirements: *id012
150
+ - !ruby/object:Gem::Dependency
151
+ name: bson_ext
152
+ requirement: &id013 !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: 1.3.0
158
+ type: :development
159
+ prerelease: false
160
+ version_requirements: *id013
161
+ - !ruby/object:Gem::Dependency
162
+ name: akephalos
163
+ requirement: &id014 !ruby/object:Gem::Requirement
164
+ none: false
165
+ requirements:
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ version: 0.2.5
169
+ type: :development
170
+ prerelease: false
171
+ version_requirements: *id014
150
172
  description: Cucumber Generators and Runtime for Rails
151
173
  email: cukes@googlegroups.com
152
174
  executables: []
@@ -173,6 +195,7 @@ files:
173
195
  - dev_tasks/cucumber.rake
174
196
  - dev_tasks/rspec.rake
175
197
  - features/allow_rescue.feature
198
+ - features/capybara_javascript_drivers.feature
176
199
  - features/inspect_query_string.feature
177
200
  - features/install_cucumber_rails.feature
178
201
  - features/mongoid.feature
@@ -237,6 +260,7 @@ files:
237
260
  - templates/install/support/rails.rb.erb
238
261
  - templates/install/support/rails_spork.rb.erb
239
262
  - templates/install/support/selectors.rb
263
+ - templates/install/support/web_steps_warning.txt
240
264
  - templates/install/support/webrat.rb
241
265
  - templates/install/tasks/cucumber.rake.erb
242
266
  has_rdoc: true
@@ -253,7 +277,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
253
277
  requirements:
254
278
  - - ">="
255
279
  - !ruby/object:Gem::Version
256
- hash: -74222375310759087
280
+ hash: 1785260491327493469
257
281
  segments:
258
282
  - 0
259
283
  version: "0"
@@ -262,7 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
262
286
  requirements:
263
287
  - - ">="
264
288
  - !ruby/object:Gem::Version
265
- hash: -74222375310759087
289
+ hash: 1785260491327493469
266
290
  segments:
267
291
  - 0
268
292
  version: "0"
@@ -272,9 +296,10 @@ rubyforge_project:
272
296
  rubygems_version: 1.6.2
273
297
  signing_key:
274
298
  specification_version: 3
275
- summary: cucumber-rails-0.4.0
299
+ summary: cucumber-rails-0.4.1
276
300
  test_files:
277
301
  - features/allow_rescue.feature
302
+ - features/capybara_javascript_drivers.feature
278
303
  - features/inspect_query_string.feature
279
304
  - features/install_cucumber_rails.feature
280
305
  - features/mongoid.feature