cucumber-rails 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +15 -0
- data/README.rdoc +1 -1
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/cucumber-rails.gemspec +6 -5
- data/generators/cucumber/templates/environments/cucumber.rb.erb +5 -5
- data/generators/cucumber/templates/step_definitions/capybara_steps.rb.erb +7 -7
- data/generators/cucumber/templates/step_definitions/web_steps_cs.rb.erb +4 -4
- data/generators/cucumber/templates/step_definitions/web_steps_de.rb.erb +4 -4
- data/generators/cucumber/templates/step_definitions/web_steps_es.rb.erb +136 -0
- data/generators/cucumber/templates/step_definitions/web_steps_no.rb.erb +2 -2
- data/generators/cucumber/templates/step_definitions/web_steps_pt-BR.rb.erb +4 -4
- data/generators/cucumber/templates/step_definitions/webrat_steps.rb.erb +10 -8
- data/generators/cucumber/templates/support/webrat.rb +0 -1
- data/generators/feature/templates/feature.erb +5 -5
- data/lib/cucumber/rails/active_record.rb +2 -2
- data/lib/cucumber/rails/capybara_javascript_emulation.rb +27 -13
- data/lib/cucumber/rails/world.rb +7 -0
- metadata +4 -3
data/History.txt
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
== 0.2.4 2010-01-18
|
2
|
+
|
3
|
+
=== New Features
|
4
|
+
* Added Spanish translation (Gabriel)
|
5
|
+
|
6
|
+
=== Bugfixes
|
7
|
+
* Fixed some broken Webrat/Test::Unit step definitions. (Aslak Hellesøy)
|
8
|
+
* Better Javascript emulation with Capybara (#7 Thorbjørn Hermansen)
|
9
|
+
* Removed stray quote in i18n web_steps.rb (Gabriel)
|
10
|
+
* Update hooks to new boolean logic (#6 Jon Larkowski, Michael MacDonald)
|
11
|
+
* Fixed incompatibility with Rails 3 (Mutwin Kraus)
|
12
|
+
* Fixed broken "fill in the following" step for Capybara web_steps (Lenny Marks)
|
13
|
+
* Capybara web_steps.rb with_scope didn't work in nested steps (Lenny Marks)
|
14
|
+
* Fixed "should not see" steps in web_steps.rb to use the correct selector (Toni Tuominen)
|
15
|
+
|
1
16
|
== 0.2.3 2010-01-03
|
2
17
|
|
3
18
|
=== New Features
|
data/README.rdoc
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
= cucumber-rails
|
2
2
|
|
3
3
|
Extracted the Rails generators from the Cucumber gem, inspired by
|
4
|
-
{this posting}[http://groups.google.com/group/cukes/browse_thread/thread/b9b8ff6301393c19
|
4
|
+
{this posting}[http://groups.google.com/group/cukes/browse_thread/thread/b9b8ff6301393c19]
|
5
5
|
on the Cukes Mailing List.
|
6
6
|
|
7
7
|
The goal is to provide i18n of the webrat_steps.rb plus some other useful
|
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/aslakhellesoy/cucumber-rails"
|
11
11
|
|
12
|
-
gemspec.add_dependency 'cucumber', '>= 0.
|
12
|
+
gemspec.add_dependency 'cucumber', '>= 0.6.2'
|
13
13
|
end
|
14
14
|
Jeweler::GemcutterTasks.new
|
15
15
|
rescue LoadError
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
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.2.
|
8
|
+
s.version = "0.2.4"
|
9
9
|
|
10
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{2010-01-
|
12
|
+
s.date = %q{2010-01-18}
|
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 = [
|
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
"generators/cucumber/templates/step_definitions/capybara_steps.rb.erb",
|
31
31
|
"generators/cucumber/templates/step_definitions/web_steps_cs.rb.erb",
|
32
32
|
"generators/cucumber/templates/step_definitions/web_steps_de.rb.erb",
|
33
|
+
"generators/cucumber/templates/step_definitions/web_steps_es.rb.erb",
|
33
34
|
"generators/cucumber/templates/step_definitions/web_steps_no.rb.erb",
|
34
35
|
"generators/cucumber/templates/step_definitions/web_steps_pt-BR.rb.erb",
|
35
36
|
"generators/cucumber/templates/step_definitions/webrat_steps.rb.erb",
|
@@ -72,12 +73,12 @@ Gem::Specification.new do |s|
|
|
72
73
|
s.specification_version = 3
|
73
74
|
|
74
75
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
75
|
-
s.add_runtime_dependency(%q<cucumber>, [">= 0.
|
76
|
+
s.add_runtime_dependency(%q<cucumber>, [">= 0.6.2"])
|
76
77
|
else
|
77
|
-
s.add_dependency(%q<cucumber>, [">= 0.
|
78
|
+
s.add_dependency(%q<cucumber>, [">= 0.6.2"])
|
78
79
|
end
|
79
80
|
else
|
80
|
-
s.add_dependency(%q<cucumber>, [">= 0.
|
81
|
+
s.add_dependency(%q<cucumber>, [">= 0.6.2"])
|
81
82
|
end
|
82
83
|
end
|
83
84
|
|
@@ -22,16 +22,16 @@ config.action_controller.allow_forgery_protection = false
|
|
22
22
|
config.action_mailer.delivery_method = :test
|
23
23
|
|
24
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.
|
25
|
+
config.gem 'database_cleaner', :lib => false, :version => '>=0.4.3' unless File.directory?(File.join(Rails.root, 'vendor/plugins/database_cleaner'))
|
26
26
|
<% if driver == :capybara -%>
|
27
|
-
config.gem 'capybara', :lib => false, :version => '>=0.
|
27
|
+
config.gem 'capybara', :lib => false, :version => '>=0.3.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/capybara'))
|
28
28
|
<% else -%>
|
29
29
|
config.gem 'webrat', :lib => false, :version => '>=0.6.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
|
30
30
|
<% end -%>
|
31
31
|
<% if framework == :rspec -%>
|
32
|
-
config.gem 'rspec', :lib => false, :version => '>=1.
|
33
|
-
config.gem 'rspec-rails', :lib => false, :version => '>=1.2
|
32
|
+
config.gem 'rspec', :lib => false, :version => '>=1.3.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
|
33
|
+
config.gem 'rspec-rails', :lib => false, :version => '>=1.3.2' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
|
34
34
|
<% end %>
|
35
35
|
<% if spork? -%>
|
36
|
-
config.gem 'spork', :lib => false, :version => '>=0.7.
|
36
|
+
config.gem 'spork', :lib => false, :version => '>=0.7.5' unless File.directory?(File.join(Rails.root, 'vendor/plugins/spork'))
|
37
37
|
<% end %>
|
@@ -5,7 +5,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "pat
|
|
5
5
|
|
6
6
|
module WithinHelpers
|
7
7
|
def with_scope(locator)
|
8
|
-
within(locator
|
8
|
+
locator ? within(locator) { yield } : yield
|
9
9
|
end
|
10
10
|
end
|
11
11
|
World(WithinHelpers)
|
@@ -53,7 +53,7 @@ end
|
|
53
53
|
# TODO: Add support for checkbox, select og option
|
54
54
|
# based on naming conventions.
|
55
55
|
#
|
56
|
-
When /^(?:|I )fill in the following(?: within "([^\"]*)"
|
56
|
+
When /^(?:|I )fill in the following(?: within "([^\"]*)")?:$/ do |selector, fields|
|
57
57
|
with_scope(selector) do
|
58
58
|
fields.rows_hash.each do |name, value|
|
59
59
|
When %{I fill in "#{name}" with "#{value}"}
|
@@ -115,9 +115,9 @@ end
|
|
115
115
|
Then /^(?:|I )should not see "([^\"]*)"(?: within "([^\"]*)")?$/ do |text, selector|
|
116
116
|
with_scope(selector) do
|
117
117
|
if defined?(Spec::Rails::Matchers)
|
118
|
-
page.
|
118
|
+
page.should have_no_content(text)
|
119
119
|
else
|
120
|
-
|
120
|
+
assert page.has_no_content?(text)
|
121
121
|
end
|
122
122
|
end
|
123
123
|
end
|
@@ -126,9 +126,9 @@ Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^\"]*)")?$/ do |regexp, s
|
|
126
126
|
regexp = Regexp.new(regexp)
|
127
127
|
with_scope(selector) do
|
128
128
|
if defined?(Spec::Rails::Matchers)
|
129
|
-
page.
|
129
|
+
page.shoul have_not_xpath('//*', :text => regexp)
|
130
130
|
else
|
131
|
-
|
131
|
+
assert page.has_not_xpath?('//*', :text => regexp)
|
132
132
|
end
|
133
133
|
end
|
134
134
|
end
|
@@ -184,4 +184,4 @@ end
|
|
184
184
|
|
185
185
|
Then /^show me the page$/ do
|
186
186
|
save_and_open_page
|
187
|
-
end
|
187
|
+
end
|
@@ -44,7 +44,7 @@ When /^vyberu "([^\"]*)" jako datum a čas$/ do |time|
|
|
44
44
|
end
|
45
45
|
|
46
46
|
When /^vyberu "([^\"]*)" jako "([^\"]*)" datum a čas$/ do |datetime, datetime_label|
|
47
|
-
When %{I select "#{
|
47
|
+
When %{I select "#{datetime}" as the "#{datetime_label}" date and time}
|
48
48
|
end
|
49
49
|
|
50
50
|
When /^vyberu "([^\"]*)" jako čas$/ do |time|
|
@@ -120,11 +120,11 @@ Then /^pole "([^\"]*)" by nemělo obsahovat "([^\"]*)"$/ do |field, value|
|
|
120
120
|
end
|
121
121
|
|
122
122
|
Then /^pole "([^\"]*)" by mělo být zaškrtnuté$/ do |label|
|
123
|
-
Then %{the "#{label}" checkbox should be checked
|
123
|
+
Then %{the "#{label}" checkbox should be checked}
|
124
124
|
end
|
125
125
|
|
126
126
|
Then /^pole "([^\"]*)" by nemělo být zaškrtnuté$/ do |label|
|
127
|
-
Then %{the "#{label}" checkbox should not be checked
|
127
|
+
Then %{the "#{label}" checkbox should not be checked}
|
128
128
|
end
|
129
129
|
|
130
130
|
Then /^(?:|také )bych měl být na (.+)$/ do |page_name|
|
@@ -133,4 +133,4 @@ end
|
|
133
133
|
|
134
134
|
Then /^(?:|také )mi ukaž stránku$/ do
|
135
135
|
Then %{show me the page}
|
136
|
-
end
|
136
|
+
end
|
@@ -44,7 +44,7 @@ When /^(?:|ich )"([^\"]*)" als Datum und Uhrzeit auswähle$/ do |time|
|
|
44
44
|
end
|
45
45
|
|
46
46
|
When /^(?:|ich )"([^\"]*)" als "([^\"]*)" Datum und Uhrzeit auswähle$/ do |datetime, datetime_label|
|
47
|
-
When %{I select "#{
|
47
|
+
When %{I select "#{datetime}" as the "#{datetime_label}" date and time}
|
48
48
|
end
|
49
49
|
|
50
50
|
When /^(?:|ich )"([^\"]*)" als Uhrzeit auswähle$/ do |time|
|
@@ -120,11 +120,11 @@ Then /^sollte das "([^\"]*)" Feld nicht "([^\"]*)" enthalten$/ do |field, value|
|
|
120
120
|
end
|
121
121
|
|
122
122
|
Then /^sollte die "([^\"]*)" Checkbox angehakt sein$/ do |label|
|
123
|
-
Then %{the "#{label}" checkbox should be checked
|
123
|
+
Then %{the "#{label}" checkbox should be checked}
|
124
124
|
end
|
125
125
|
|
126
126
|
Then /^sollte die "([^\"]*)" Checkbox nicht angehakt sein$/ do |label|
|
127
|
-
Then %{the "#{label}" checkbox should not be checked
|
127
|
+
Then %{the "#{label}" checkbox should not be checked}
|
128
128
|
end
|
129
129
|
|
130
130
|
Then /^(?:|ich sollte |sollte (?:|ich )?)auf (.+) sein$/ do |page_name|
|
@@ -133,4 +133,4 @@ end
|
|
133
133
|
|
134
134
|
Then /^zeig mir die Seite$/ do
|
135
135
|
Then %{show me the page}
|
136
|
-
end
|
136
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
<%= embed_file('support/edit_warning.txt') %>
|
3
|
+
|
4
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
5
|
+
|
6
|
+
Dado /^que estoy en (.+)$/ do |page_name|
|
7
|
+
Given %{I am on #{page_name}}
|
8
|
+
end
|
9
|
+
|
10
|
+
Cuando /^voy a (.+)$/ do |page_name|
|
11
|
+
When %{I go to #{page_name}}
|
12
|
+
end
|
13
|
+
|
14
|
+
Cuando /^apreto "([^\"]*)"$/ do |button|
|
15
|
+
When %{I press "#{button}"}
|
16
|
+
end
|
17
|
+
|
18
|
+
Cuando /^clickeo "([^\"]*)"$/ do |link|
|
19
|
+
When %{I follow "#{link}"}
|
20
|
+
end
|
21
|
+
|
22
|
+
Cuando /^clickeo "([^\"]*)" dentro de "([^\"]*)"$/ do |link, parent|
|
23
|
+
When %{I follow "#{link}" within "#{parent}"}
|
24
|
+
end
|
25
|
+
|
26
|
+
Cuando /^completo "([^\"]*)" con "([^\"]*)"$/ do |field, value|
|
27
|
+
When %{I fill in "#{field}" with "#{value}"}
|
28
|
+
end
|
29
|
+
|
30
|
+
Cuando /^completo "([^\"]*)" para "([^\"]*)"$/ do |value, field|
|
31
|
+
When %{I fill in "#{value}" for "#{field}"}
|
32
|
+
end
|
33
|
+
|
34
|
+
Cuando /^completo lo siguiente:$/ do |fields|
|
35
|
+
When %{I fill in the following:}, fields
|
36
|
+
end
|
37
|
+
|
38
|
+
Cuando /^selecciono "([^\"]*)" de "([^\"]*)"$/ do |value, field|
|
39
|
+
When %{I select "#{value}" from "#{field}"}
|
40
|
+
end
|
41
|
+
|
42
|
+
Cuando /^selecciono "([^\"]*)" como la fecha y la hora$/ do |time|
|
43
|
+
When %{I select "#{time}" as the date and time}
|
44
|
+
end
|
45
|
+
|
46
|
+
Cuando /^selecciono "([^\"]*)" como la fecha y la hora "([^\"]*)"$/ do |datetime, datetime_label|
|
47
|
+
When %{I select "#{datetime}" as the "#{datetime_label}" date and time}
|
48
|
+
end
|
49
|
+
|
50
|
+
Cuando /^selecciono "([^\"]*)" como la hora$/ do |time|
|
51
|
+
When %{I select "#{time}" as the time}
|
52
|
+
end
|
53
|
+
|
54
|
+
Cuando /^selecciono "([^\"]*)" como la hora "([^\"]*)"$/ do |time, time_label|
|
55
|
+
When %{I select "#{time}" as the "#{time_label}" time}
|
56
|
+
end
|
57
|
+
|
58
|
+
Cuando /^selecciono "([^\"]*)" como la fecha$/ do |date|
|
59
|
+
When %{I select "#{date}" as the date}
|
60
|
+
end
|
61
|
+
|
62
|
+
Cuando /^selecciono "([^\"]*)" como la fecha "([^\"]*)"$/ do |date, date_label|
|
63
|
+
When %{I select "#{date}" as the "#{date_label}" date}
|
64
|
+
end
|
65
|
+
|
66
|
+
Cuando /^marco "([^\"]*)"$/ do |field|
|
67
|
+
When %{I check "#{field}"}
|
68
|
+
end
|
69
|
+
|
70
|
+
Cuando /^desmarco "([^\"]*)"$/ do |field|
|
71
|
+
When %{I uncheck "#{field}"}
|
72
|
+
end
|
73
|
+
|
74
|
+
Cuando /^elijo "([^\"]*)"$/ do |field|
|
75
|
+
When %{I choose "#{field}"}
|
76
|
+
end
|
77
|
+
|
78
|
+
Cuando /^adjunto el archivo "([^\"]*)" a "([^\"]*)"$/ do |path, field|
|
79
|
+
When %{I attach the file "#{path}" to "#{field}"}
|
80
|
+
end
|
81
|
+
|
82
|
+
Entonces /^debería ver "([^\"]*)"$/ do |text|
|
83
|
+
Then %{I should see "#{text}"}
|
84
|
+
end
|
85
|
+
|
86
|
+
Entonces /^debería ver "([^\"]*)" dentro de "([^\"]*)"$/ do |text, selector|
|
87
|
+
Then %{I should see "#{text}" within "#{selector}"}
|
88
|
+
end
|
89
|
+
|
90
|
+
Entonces /^debería ver \/([^\/]*)\/$/ do |regexp|
|
91
|
+
Then %{I should see /#{regexp}/}
|
92
|
+
end
|
93
|
+
|
94
|
+
Entonces /^debería ver \/([^\/]*)\/ dentro de "([^\"]*)"$/ do |regexp, selector|
|
95
|
+
Then %{I should see /#{regexp}/ within "#{selector}"}
|
96
|
+
end
|
97
|
+
|
98
|
+
Entonces /^no debería ver "([^\"]*)"$/ do |text|
|
99
|
+
Then %{I should not see "#{text}"}
|
100
|
+
end
|
101
|
+
|
102
|
+
Entonces /^no debería ver "([^\"]*)" dentro de "([^\"]*)"$/ do |text, selector|
|
103
|
+
Then %{I should not see "#{text}" within "#{selector}"}
|
104
|
+
end
|
105
|
+
|
106
|
+
Entonces /^no debería ver \/([^\/]*)\/$/ do |regexp|
|
107
|
+
Then %{I should not see /#{regexp}/}
|
108
|
+
end
|
109
|
+
|
110
|
+
Entonces /^no debería ver \/([^\/]*)\/ dentro de "([^\"]*)"$/ do |regexp, selector|
|
111
|
+
Then %{I should not see /#{regexp}/ within "#{selector}"}
|
112
|
+
end
|
113
|
+
|
114
|
+
Entonces /^el campo "([^\"]*)" debería contener "([^\"]*)"$/ do |field, value|
|
115
|
+
Then %{the "#{field}" field should contain "#{value}"}
|
116
|
+
end
|
117
|
+
|
118
|
+
Entonces /^el campo "([^\"]*)" no debería contener "([^\"]*)"$/ do |field, value|
|
119
|
+
Then %{the "#{field}" field should not contain "#{value}"}
|
120
|
+
end
|
121
|
+
|
122
|
+
Entonces /^la checkbox "([^\"]*)" debería estar marcada$/ do |label|
|
123
|
+
Then %{the "#{label}" checkbox should be checked}
|
124
|
+
end
|
125
|
+
|
126
|
+
Entonces /^la checkbox "([^\"]*)" no debería estar marcada$/ do |label|
|
127
|
+
Then %{the "#{label}" checkbox should not be checked}
|
128
|
+
end
|
129
|
+
|
130
|
+
Entonces /^debería estar en (.+)$/ do |page_name|
|
131
|
+
Then %{I should be on #{page_name}}
|
132
|
+
end
|
133
|
+
|
134
|
+
Entonces /^mostrame la página$/ do
|
135
|
+
Then %{show me the page}
|
136
|
+
end
|
@@ -98,11 +98,11 @@ Så /^(?:skal ) "([^\"]*)" feltet (?:skal )ikke inneholde "([^\"]*)"$/ do |field
|
|
98
98
|
end
|
99
99
|
|
100
100
|
Så /^(?:skal ) "([^\"]*)" avkrysningsboksen (?:skal )være krysset av$/ do |label|
|
101
|
-
Then %{the "#{label}" checkbox should be checked
|
101
|
+
Then %{the "#{label}" checkbox should be checked}
|
102
102
|
end
|
103
103
|
|
104
104
|
Så /^(?:skal ) "([^\"]*)" avkrysningsboksen (?:skal )ikke være krysset av$/ do |label|
|
105
|
-
Then %{the "#{label}" checkbox should not be checked
|
105
|
+
Then %{the "#{label}" checkbox should not be checked}
|
106
106
|
end
|
107
107
|
|
108
108
|
Så /^(?:skal jeg|jeg skal) komme til (.+)$/ do |page_name|
|
@@ -44,7 +44,7 @@ Quando /^eu seleciono "([^\"]*)" como a data e a hora$/ do |time|
|
|
44
44
|
end
|
45
45
|
|
46
46
|
Quando /^eu seleciono "([^\"]*)" como a data e a hora "([^\"]*)"$/ do |datetime, datetime_label|
|
47
|
-
When %{I select "#{
|
47
|
+
When %{I select "#{datetime}" as the "#{datetime_label}" date and time}
|
48
48
|
end
|
49
49
|
|
50
50
|
Quando /^eu seleciono "([^\"]*)" como a hora$/ do |time|
|
@@ -124,11 +124,11 @@ Então /^o campo "([^\"]*)" não deve conter "([^\"]*)"$/ do |field, value|
|
|
124
124
|
end
|
125
125
|
|
126
126
|
Então /^o checkbox "([^\"]*)" deve estar marcado$/ do |label|
|
127
|
-
Then %{the "#{label}" checkbox should be checked
|
127
|
+
Then %{the "#{label}" checkbox should be checked}
|
128
128
|
end
|
129
129
|
|
130
130
|
Então /^o checkbox "([^\"]*)" não deve estar marcado$/ do |label|
|
131
|
-
Then %{the "#{label}" checkbox should not be checked
|
131
|
+
Then %{the "#{label}" checkbox should not be checked}
|
132
132
|
end
|
133
133
|
|
134
134
|
Então /^eu devo estar na (.+)$/ do |page_name|
|
@@ -137,4 +137,4 @@ end
|
|
137
137
|
|
138
138
|
Então /^mostre-me a página$/ do
|
139
139
|
Then %{show me the page}
|
140
|
-
end
|
140
|
+
end
|
@@ -147,7 +147,8 @@ Then /^(?:|I )should see "([^\"]*)" within "([^\"]*)"$/ do |text, selector|
|
|
147
147
|
if defined?(Spec::Rails::Matchers)
|
148
148
|
content.should contain(text)
|
149
149
|
else
|
150
|
-
|
150
|
+
hc = Webrat::Matchers::HasContent.new(text)
|
151
|
+
assert hc.matches?(content), hc.failure_message
|
151
152
|
end
|
152
153
|
end
|
153
154
|
end
|
@@ -157,7 +158,7 @@ Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
|
|
157
158
|
if defined?(Spec::Rails::Matchers)
|
158
159
|
response.should contain(regexp)
|
159
160
|
else
|
160
|
-
|
161
|
+
assert_match(regexp, response_body)
|
161
162
|
end
|
162
163
|
end
|
163
164
|
|
@@ -167,7 +168,7 @@ Then /^(?:|I )should see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, selector|
|
|
167
168
|
if defined?(Spec::Rails::Matchers)
|
168
169
|
content.should contain(regexp)
|
169
170
|
else
|
170
|
-
|
171
|
+
assert_match(regexp, content)
|
171
172
|
end
|
172
173
|
end
|
173
174
|
end
|
@@ -176,16 +177,17 @@ Then /^(?:|I )should not see "([^\"]*)"$/ do |text|
|
|
176
177
|
if defined?(Spec::Rails::Matchers)
|
177
178
|
response.should_not contain(text)
|
178
179
|
else
|
179
|
-
assert_not_contain
|
180
|
+
assert_not_contain(text)
|
180
181
|
end
|
181
182
|
end
|
182
183
|
|
183
184
|
Then /^(?:|I )should not see "([^\"]*)" within "([^\"]*)"$/ do |text, selector|
|
184
185
|
within(selector) do |content|
|
185
186
|
if defined?(Spec::Rails::Matchers)
|
186
|
-
|
187
|
+
content.should_not contain(text)
|
187
188
|
else
|
188
|
-
|
189
|
+
hc = Webrat::Matchers::HasContent.new(text)
|
190
|
+
assert !hc.matches?(content), hc.negative_failure_message
|
189
191
|
end
|
190
192
|
end
|
191
193
|
end
|
@@ -195,7 +197,7 @@ Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
|
|
195
197
|
if defined?(Spec::Rails::Matchers)
|
196
198
|
response.should_not contain(regexp)
|
197
199
|
else
|
198
|
-
assert_not_contain
|
200
|
+
assert_not_contain(regexp)
|
199
201
|
end
|
200
202
|
end
|
201
203
|
|
@@ -205,7 +207,7 @@ Then /^(?:|I )should not see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, select
|
|
205
207
|
if defined?(Spec::Rails::Matchers)
|
206
208
|
content.should_not contain(regexp)
|
207
209
|
else
|
208
|
-
|
210
|
+
assert_no_match(regexp, content)
|
209
211
|
end
|
210
212
|
end
|
211
213
|
end
|
@@ -7,11 +7,11 @@ Feature: Manage <%= plural_name %>
|
|
7
7
|
Given I am on the new <%= singular_name %> page
|
8
8
|
<% keyword = 'When' -%>
|
9
9
|
<% named_args.each do |arg| -%>
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
<% if arg.type == 'boolean' -%>
|
11
|
+
<%= keyword %> I uncheck "<%= arg.name.humanize %>"
|
12
|
+
<% else -%>
|
13
|
+
<%= keyword %> I fill in "<%= arg.name.humanize %>" with "<%= arg.value(1) %>"
|
14
|
+
<% end -%>
|
15
15
|
<% keyword = 'And' -%>
|
16
16
|
<% end -%>
|
17
17
|
And I press "Create"
|
@@ -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', '~@selenium', '~@culerity', '~@javascript') do
|
6
|
+
Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
|
7
7
|
Cucumber::Rails::World.use_transactional_fixtures = $__cucumber_global_use_txn
|
8
8
|
end
|
9
9
|
|
10
|
-
Before('@no-txn
|
10
|
+
Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
|
11
11
|
Cucumber::Rails::World.use_transactional_fixtures = false
|
12
12
|
end
|
13
13
|
|
@@ -8,23 +8,37 @@ module Cucumber
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def click_with_rails_javascript_emulation
|
11
|
-
if
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
if link_with_onclick_from_rails?
|
12
|
+
Capybara::Driver::RackTest::Form.new(driver, js_form(self[:href], emulated_method)).submit(self)
|
13
|
+
else
|
14
|
+
click_without_rails_javascript_emulation
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
private
|
20
|
+
def js_form(action, emulated_method, method = 'POST')
|
21
|
+
js_form = node.document.create_element('form')
|
22
|
+
js_form['action'] = action
|
23
|
+
js_form['method'] = method
|
24
|
+
|
25
|
+
if emulated_method and emulated_method.downcase != method.downcase
|
18
26
|
input = node.document.create_element('input')
|
19
27
|
input['type'] = 'hidden'
|
20
28
|
input['name'] = '_method'
|
21
|
-
input['value'] =
|
29
|
+
input['value'] = emulated_method
|
22
30
|
js_form.add_child(input)
|
23
|
-
|
24
|
-
Capybara::Driver::RackTest::Form.new(driver, js_form).submit(self)
|
25
|
-
else
|
26
|
-
click_without_rails_javascript_emulation
|
27
31
|
end
|
32
|
+
|
33
|
+
js_form
|
34
|
+
end
|
35
|
+
|
36
|
+
def link_with_onclick_from_rails?
|
37
|
+
tag_name == 'a' and node['onclick'] =~ /var f = document\.createElement\('form'\); f\.style\.display = 'none';/
|
38
|
+
end
|
39
|
+
|
40
|
+
def emulated_method
|
41
|
+
node['onclick'][/m\.setAttribute\('value', '([^']*)'\)/, 1]
|
28
42
|
end
|
29
43
|
end
|
30
44
|
end
|
@@ -44,4 +58,4 @@ After('@emulate_rails_javascript') do
|
|
44
58
|
Capybara::Driver::RackTest::Node.class_eval do
|
45
59
|
alias_method :click, :click_without_rails_javascript_emulation
|
46
60
|
end
|
47
|
-
end
|
61
|
+
end
|
data/lib/cucumber/rails/world.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.4
|
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: 2010-01-
|
14
|
+
date: 2010-01-18 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.6.2
|
26
26
|
version:
|
27
27
|
description: Cucumber Generators and Runtime for Rails
|
28
28
|
email: cukes@googlegroups.com
|
@@ -47,6 +47,7 @@ files:
|
|
47
47
|
- generators/cucumber/templates/step_definitions/capybara_steps.rb.erb
|
48
48
|
- generators/cucumber/templates/step_definitions/web_steps_cs.rb.erb
|
49
49
|
- generators/cucumber/templates/step_definitions/web_steps_de.rb.erb
|
50
|
+
- generators/cucumber/templates/step_definitions/web_steps_es.rb.erb
|
50
51
|
- generators/cucumber/templates/step_definitions/web_steps_no.rb.erb
|
51
52
|
- generators/cucumber/templates/step_definitions/web_steps_pt-BR.rb.erb
|
52
53
|
- generators/cucumber/templates/step_definitions/webrat_steps.rb.erb
|