cucumber-rails 0.1.1.rc6 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +27 -1
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/cucumber-rails.gemspec +6 -6
- data/generators/cucumber/cucumber_generator.rb +15 -0
- data/generators/cucumber/templates/environments/cucumber.rb.erb +4 -4
- data/generators/cucumber/templates/step_definitions/capybara_steps.rb.erb +11 -70
- data/generators/cucumber/templates/support/edit_warning.txt +2 -1
- data/generators/feature/templates/feature.erb +3 -3
- data/lib/cucumber/rails/active_record.rb +2 -2
- metadata +5 -5
data/History.txt
CHANGED
@@ -1,4 +1,30 @@
|
|
1
|
-
==
|
1
|
+
== 0.2.0
|
2
|
+
|
3
|
+
This is the first release of cucumber-rails, which was factored out of cucumber.
|
4
|
+
We're calling it 0.2.0 just because we did some prereleases in the 0.1 series,
|
5
|
+
and to celebrate that cucumber-rails now supports Capybara as an alternative to Webrat.
|
6
|
+
|
7
|
+
=== UPGRADING FROM A PREVIOUS CUCUMBER SETUP
|
8
|
+
|
9
|
+
1) Remove your features/support/version_check.rb
|
10
|
+
2) Remove your features/step_definitions/webrat_steps.rb
|
11
|
+
If you have added your own custom step definitions to this file,
|
12
|
+
put them in a different file under features/step_definitions
|
13
|
+
3) run "ruby script/generate cucumber --help" to see what options you have.
|
14
|
+
4) run "ruby script/generate cucumber" - plus whatever options you think fit for you.
|
15
|
+
Answer "n" (no) when asked to overwrite paths.rb.
|
16
|
+
Answer "y" (yes) when asked to overwrite other files, but do "d" (diff) first.
|
17
|
+
If you have edits in some of these files that you want to keep, store the diff
|
18
|
+
in a temporary file and reapply after you have overwritten the file. ALso consider
|
19
|
+
adding your custom code to another file that won't be overwritten the next time
|
20
|
+
you upgrade.
|
21
|
+
|
22
|
+
Many people have edits in their env.rb file. This is something you should try
|
23
|
+
to avoid in the future. Instead, keep your custom setup in a different file
|
24
|
+
under features/support - Cucumber loads all files under features/**/*.rb anyway.
|
25
|
+
|
26
|
+
If you have a Spork setup, see the end of this thread:
|
27
|
+
http://groups.google.com/group/cukes/browse_thread/thread/475385cc26377215
|
2
28
|
|
3
29
|
=== New features
|
4
30
|
* Added an @emulate_rails_javascript tag that will emulate onclick with Capybara (Aslak Hellesøy, Rob Holland)
|
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ begin
|
|
9
9
|
gemspec.authors = ["Dennis Blöte", "Aslak Hellesøy", "Rob Holland"]
|
10
10
|
gemspec.homepage = "http://github.com/dbloete/cucumber-rails"
|
11
11
|
|
12
|
-
gemspec.add_dependency 'cucumber', '>= 0.
|
12
|
+
gemspec.add_dependency 'cucumber', '>= 0.5.0'
|
13
13
|
end
|
14
14
|
Jeweler::GemcutterTasks.new
|
15
15
|
rescue LoadError
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/cucumber-rails.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{cucumber-rails}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dennis Bl\303\266te", "Aslak Helles\303\270y", "Rob Holland"]
|
12
|
-
s.date = %q{2009-12-
|
12
|
+
s.date = %q{2009-12-15}
|
13
13
|
s.description = %q{Cucumber Generators and Runtime for Rails}
|
14
14
|
s.email = %q{cukes@googlegroups.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -71,12 +71,12 @@ Gem::Specification.new do |s|
|
|
71
71
|
s.specification_version = 3
|
72
72
|
|
73
73
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
74
|
-
s.add_runtime_dependency(%q<cucumber>, [">= 0.
|
74
|
+
s.add_runtime_dependency(%q<cucumber>, [">= 0.5.0"])
|
75
75
|
else
|
76
|
-
s.add_dependency(%q<cucumber>, [">= 0.
|
76
|
+
s.add_dependency(%q<cucumber>, [">= 0.5.0"])
|
77
77
|
end
|
78
78
|
else
|
79
|
-
s.add_dependency(%q<cucumber>, [">= 0.
|
79
|
+
s.add_dependency(%q<cucumber>, [">= 0.5.0"])
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
@@ -17,6 +17,17 @@ class CucumberGenerator < Rails::Generator::Base
|
|
17
17
|
|
18
18
|
def manifest
|
19
19
|
record do |m|
|
20
|
+
if File.exist?('features/step_definitions/webrat_steps.rb')
|
21
|
+
STDERR.puts "Please remove features/step_definitions/webrat_steps.rb\n" +
|
22
|
+
"See upgrading instructions for 0.2.0 in History.txt"
|
23
|
+
exit(1)
|
24
|
+
end
|
25
|
+
if File.exist?('features/support/version_check.rb')
|
26
|
+
STDERR.puts "Please remove features/support/version_check\n" +
|
27
|
+
"See upgrading instructions for 0.2.0 in History.txt"
|
28
|
+
exit(1)
|
29
|
+
end
|
30
|
+
|
20
31
|
m.template 'config/cucumber.yml.erb', 'config/cucumber.yml'
|
21
32
|
|
22
33
|
m.template 'environments/cucumber.rb.erb', 'config/environments/cucumber.rb'
|
@@ -70,6 +81,10 @@ class CucumberGenerator < Rails::Generator::Base
|
|
70
81
|
ERB.new(IO.read(template), nil, '-').result(binding).gsub(/^/, indent)
|
71
82
|
end
|
72
83
|
|
84
|
+
def version
|
85
|
+
IO.read(File.dirname(__FILE__) + '/../../VERSION').chomp
|
86
|
+
end
|
87
|
+
|
73
88
|
private
|
74
89
|
|
75
90
|
def first_loadable(libraries)
|
@@ -21,11 +21,11 @@ config.action_controller.allow_forgery_protection = false
|
|
21
21
|
# ActionMailer::Base.deliveries array.
|
22
22
|
config.action_mailer.delivery_method = :test
|
23
23
|
|
24
|
-
config.gem 'cucumber',
|
24
|
+
config.gem 'cucumber-rails', :lib => false, :version => '>=<%= version %>' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber-rails'))
|
25
25
|
<% if driver == :capybara -%>
|
26
|
-
config.gem 'capybara', :lib => false, :version => '>=0.
|
26
|
+
config.gem 'capybara', :lib => false, :version => '>=0.2.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/capybara'))
|
27
27
|
<% else -%>
|
28
|
-
config.gem 'webrat', :lib => false, :version => '>=0.
|
28
|
+
config.gem 'webrat', :lib => false, :version => '>=0.6.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
|
29
29
|
<% end -%>
|
30
30
|
<% if framework == :rspec -%>
|
31
31
|
config.gem 'rspec', :lib => false, :version => '>=1.2.9' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
|
@@ -34,5 +34,5 @@ config.gem 'rspec-rails', :lib => false, :version => '>=1.2.9' unless File.
|
|
34
34
|
config.gem 'database_cleaner', :lib => false, :version => '>=0.2.3' unless File.directory?(File.join(Rails.root, 'vendor/plugins/database_cleaner'))
|
35
35
|
<% end %>
|
36
36
|
<% if spork? -%>
|
37
|
-
config.gem 'spork', :lib => false, :version => '>=0.7.
|
37
|
+
config.gem 'spork', :lib => false, :version => '>=0.7.4' unless File.directory?(File.join(Rails.root, 'vendor/plugins/spork'))
|
38
38
|
<% end %>
|
@@ -66,65 +66,6 @@ When /^(?:|I )select "([^\"]*)" from "([^\"]*)"(?: within "([^\"]*)")?$/ do |val
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
# Use this step in conjunction with Rail's datetime_select helper. For example:
|
70
|
-
# When I select "December 25, 2008 10:00" as the date and time
|
71
|
-
When /^(?:|I )select "([^\"]*)" as the date and time(?: within "([^\"]*)")?$/ do |time, selector|
|
72
|
-
with_scope(selector) do
|
73
|
-
select_datetime(time)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
# Use this step when using multiple datetime_select helpers on a page or
|
78
|
-
# you want to specify which datetime to select. Given the following view:
|
79
|
-
# <%%= f.label :preferred %><br />
|
80
|
-
# <%%= f.datetime_select :preferred %>
|
81
|
-
# <%%= f.label :alternative %><br />
|
82
|
-
# <%%= f.datetime_select :alternative %>
|
83
|
-
# The following steps would fill out the form:
|
84
|
-
# When I select "November 23, 2004 11:20" as the "Preferred" date and time
|
85
|
-
# And I select "November 25, 2004 10:30" as the "Alternative" date and time
|
86
|
-
When /^(?:|I )select "([^\"]*)" as the "([^\"]*)" date and time(?: within "([^\"]*)")?$/ do |datetime, datetime_label, selector|
|
87
|
-
with_scope(selector) do
|
88
|
-
select_datetime(datetime, :from => datetime_label)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
# Use this step in conjunction with Rail's time_select helper. For example:
|
93
|
-
# When I select "2:20PM" as the time
|
94
|
-
# Note: Rail's default time helper provides 24-hour time-- not 12 hour time. Webrat
|
95
|
-
# will convert the 2:20PM to 14:20 and then select it.
|
96
|
-
When /^(?:|I )select "([^\"]*)" as the time(?: within "([^\"]*)")?$/ do |time, selector|
|
97
|
-
with_scope(selector) do
|
98
|
-
select_time(time)
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
# Use this step when using multiple time_select helpers on a page or you want to
|
103
|
-
# specify the name of the time on the form. For example:
|
104
|
-
# When I select "7:30AM" as the "Gym" time
|
105
|
-
When /^(?:|I )select "([^\"]*)" as the "([^\"]*)" time(?: within "([^\"]*)")?$/ do |time, time_label, selector|
|
106
|
-
with_scope(selector) do
|
107
|
-
select_time(time, :from => time_label)
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
# Use this step in conjunction with Rail's date_select helper. For example:
|
112
|
-
# When I select "February 20, 1981" as the date
|
113
|
-
When /^(?:|I )select "([^\"]*)" as the date(?: within "([^\"]*)")?$/ do |date, selector|
|
114
|
-
with_scope(selector) do
|
115
|
-
select_date(date)
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
# Use this step when using multiple date_select helpers on one page or
|
120
|
-
# you want to specify the name of the date on the form. For example:
|
121
|
-
# When I select "April 26, 1982" as the "Date of Birth" date
|
122
|
-
When /^(?:|I )select "([^\"]*)" as the "([^\"]*)" date(?: within "([^\"]*)")?$/ do |date, date_label, selector|
|
123
|
-
with_scope(selector) do
|
124
|
-
select_date(date, :from => date_label)
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
69
|
When /^(?:|I )check "([^\"]*)"(?: within "([^\"]*)")?$/ do |field, selector|
|
129
70
|
with_scope(selector) do
|
130
71
|
check(field)
|
@@ -152,9 +93,9 @@ end
|
|
152
93
|
Then /^(?:|I )should see "([^\"]*)"(?: within "([^\"]*)")?$/ do |text, selector|
|
153
94
|
with_scope(selector) do
|
154
95
|
if defined?(Spec::Rails::Matchers)
|
155
|
-
|
96
|
+
page.should have_content(text)
|
156
97
|
else
|
157
|
-
assert has_content?(text)
|
98
|
+
assert page.has_content?(text)
|
158
99
|
end
|
159
100
|
end
|
160
101
|
end
|
@@ -163,9 +104,9 @@ Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^\"]*)")?$/ do |regexp, selec
|
|
163
104
|
regexp = Regexp.new(regexp)
|
164
105
|
with_scope(selector) do
|
165
106
|
if defined?(Spec::Rails::Matchers)
|
166
|
-
|
107
|
+
page.should have_xpath('//*', :text => regexp)
|
167
108
|
else
|
168
|
-
assert has_xpath('//*', :text => regexp)
|
109
|
+
assert page.has_xpath?('//*', :text => regexp)
|
169
110
|
end
|
170
111
|
end
|
171
112
|
end
|
@@ -173,9 +114,9 @@ end
|
|
173
114
|
Then /^(?:|I )should not see "([^\"]*)"(?: within "([^\"]*)")?$/ do |text, selector|
|
174
115
|
with_scope(selector) do
|
175
116
|
if defined?(Spec::Rails::Matchers)
|
176
|
-
|
117
|
+
page.should_not have_content(text)
|
177
118
|
else
|
178
|
-
assert_not has_content?(text)
|
119
|
+
assert_not page.has_content?(text)
|
179
120
|
end
|
180
121
|
end
|
181
122
|
end
|
@@ -184,9 +125,9 @@ Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^\"]*)")?$/ do |regexp, s
|
|
184
125
|
regexp = Regexp.new(regexp)
|
185
126
|
with_scope(selector) do
|
186
127
|
if defined?(Spec::Rails::Matchers)
|
187
|
-
|
128
|
+
page.should_not have_xpath('//*', :text => regexp)
|
188
129
|
else
|
189
|
-
assert_not has_xpath?('//*', :text => regexp)
|
130
|
+
assert_not page.has_xpath?('//*', :text => regexp)
|
190
131
|
end
|
191
132
|
end
|
192
133
|
end
|
@@ -194,7 +135,7 @@ end
|
|
194
135
|
Then /^the "([^\"]*)" field(?: within "([^\"]*)")? should contain "([^\"]*)"$/ do |field, selector, value|
|
195
136
|
with_scope(selector) do
|
196
137
|
if defined?(Spec::Rails::Matchers)
|
197
|
-
|
138
|
+
find_field(field).value.should =~ /#{value}/
|
198
139
|
else
|
199
140
|
assert_match(/#{value}/, field_labeled(field).value)
|
200
141
|
end
|
@@ -214,7 +155,7 @@ end
|
|
214
155
|
Then /^the "([^\"]*)" checkbox(?: within "([^\"]*)")? should be checked$/ do |label, selector|
|
215
156
|
with_scope(selector) do
|
216
157
|
if defined?(Spec::Rails::Matchers)
|
217
|
-
|
158
|
+
find_field(label)['checked'].should == 'checked'
|
218
159
|
else
|
219
160
|
assert field_labeled(label)['checked'] == 'checked'
|
220
161
|
end
|
@@ -224,7 +165,7 @@ end
|
|
224
165
|
Then /^the "([^\"]*)" checkbox(?: within "([^\"]*)")? should not be checked$/ do |label, selector|
|
225
166
|
with_scope(selector) do
|
226
167
|
if defined?(Spec::Rails::Matchers)
|
227
|
-
|
168
|
+
find_field(label)['checked'].should_not == 'checked'
|
228
169
|
else
|
229
170
|
assert field_labeled(label)['checked'] != 'checked'
|
230
171
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
2
2
|
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
3
|
# newer version of cucumber-rails. Consider adding your own code to a new file
|
4
|
-
# instead of editing this one.
|
4
|
+
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
|
+
# files.
|
@@ -29,9 +29,9 @@ Feature: Manage <%= plural_name %>
|
|
29
29
|
# Javascript events. Only Culerity supports confirmation dialogs.
|
30
30
|
#
|
31
31
|
# cucumber-rails will turn off transactions for scenarios tagged with
|
32
|
-
# @culerity, @javascript or @no-txn and clean the database with
|
33
|
-
# after the scenario has finished. This is to prevent data
|
34
|
-
# the next scenario.
|
32
|
+
# @selenium, @culerity, @javascript or @no-txn and clean the database with
|
33
|
+
# DatabaseCleaner after the scenario has finished. This is to prevent data
|
34
|
+
# from leaking into the next scenario.
|
35
35
|
#
|
36
36
|
# Culerity has some performance overhead, and there are two alternatives to using
|
37
37
|
# Culerity:
|
@@ -3,11 +3,11 @@ if defined?(ActiveRecord::Base)
|
|
3
3
|
$__cucumber_global_use_txn = !!Cucumber::Rails::World.use_transactional_fixtures if $__cucumber_global_use_txn.nil?
|
4
4
|
end
|
5
5
|
|
6
|
-
Before('~@no-txn', '~@culerity', '~@javascript') do
|
6
|
+
Before('~@no-txn', '~@selenium', '~@culerity', '~@javascript') do
|
7
7
|
Cucumber::Rails::World.use_transactional_fixtures = $__cucumber_global_use_txn
|
8
8
|
end
|
9
9
|
|
10
|
-
Before('@no-txn', '@culerity', '@javascript') do
|
10
|
+
Before('@no-txn', '@selenium', '@culerity', '@javascript') do
|
11
11
|
Cucumber::Rails::World.use_transactional_fixtures = false
|
12
12
|
end
|
13
13
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Dennis Bl\xC3\xB6te"
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2009-12-
|
14
|
+
date: 2009-12-15 00:00:00 +01:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
requirements:
|
23
23
|
- - ">="
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version: 0.
|
25
|
+
version: 0.5.0
|
26
26
|
version:
|
27
27
|
description: Cucumber Generators and Runtime for Rails
|
28
28
|
email: cukes@googlegroups.com
|
@@ -89,9 +89,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
89
|
version:
|
90
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
|
-
- - "
|
92
|
+
- - ">="
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version:
|
94
|
+
version: "0"
|
95
95
|
version:
|
96
96
|
requirements: []
|
97
97
|
|