cucumber-rails 0.4.1 → 0.5.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/History.txt +9 -0
  2. data/README.md +74 -0
  3. data/config/cucumber.yml +1 -0
  4. data/cucumber-rails.gemspec +18 -18
  5. data/features/capybara_javascript_drivers.feature +1 -0
  6. data/features/emulate_javascript.feature +33 -0
  7. data/features/multiple_databases.feature +74 -0
  8. data/features/no_database.feature +1 -0
  9. data/features/pseduo_class_selectors.feature +24 -0
  10. data/features/select_dates.feature +36 -0
  11. data/features/step_definitions/cucumber_rails_steps.rb +1 -0
  12. data/lib/cucumber/rails.rb +1 -5
  13. data/lib/cucumber/rails/capybara/javascript_emulation.rb +4 -4
  14. data/lib/cucumber/rails/capybara/select_dates_and_times.rb +1 -1
  15. data/lib/cucumber/rails/hooks/database_cleaner.rb +0 -25
  16. data/lib/generators/cucumber/feature/feature_generator.rb +7 -16
  17. data/{templates/feature → lib/generators/cucumber/feature/templates}/feature.erb +0 -0
  18. data/{templates/feature → lib/generators/cucumber/feature/templates}/steps.erb +0 -0
  19. data/lib/generators/cucumber/install/install_generator.rb +68 -23
  20. data/{templates/install → lib/generators/cucumber/install/templates}/config/cucumber.yml.erb +0 -0
  21. data/{templates/install → lib/generators/cucumber/install/templates}/environments/cucumber.rb.erb +0 -4
  22. data/{templates/install → lib/generators/cucumber/install/templates}/script/cucumber +0 -0
  23. data/{templates/install/step_definitions/capybara_steps.rb.erb → lib/generators/cucumber/install/templates/step_definitions/web_steps.rb.erb} +2 -2
  24. data/{templates/install → lib/generators/cucumber/install/templates}/step_definitions/web_steps_cs.rb.erb +0 -0
  25. data/{templates/install → lib/generators/cucumber/install/templates}/step_definitions/web_steps_da.rb.erb +0 -0
  26. data/{templates/install → lib/generators/cucumber/install/templates}/step_definitions/web_steps_de.rb.erb +15 -24
  27. data/{templates/install → lib/generators/cucumber/install/templates}/step_definitions/web_steps_es.rb.erb +0 -0
  28. data/{templates/install → lib/generators/cucumber/install/templates}/step_definitions/web_steps_ja.rb.erb +0 -0
  29. data/{templates/install → lib/generators/cucumber/install/templates}/step_definitions/web_steps_ko.rb.erb +0 -0
  30. data/{templates/install → lib/generators/cucumber/install/templates}/step_definitions/web_steps_no.rb.erb +0 -0
  31. data/{templates/install → lib/generators/cucumber/install/templates}/step_definitions/web_steps_pt-BR.rb.erb +0 -0
  32. data/{templates/install → lib/generators/cucumber/install/templates}/support/_rails_each_run.rb.erb +12 -0
  33. data/{templates/install → lib/generators/cucumber/install/templates}/support/_rails_prefork.rb.erb +0 -0
  34. data/{templates/install → lib/generators/cucumber/install/templates}/support/capybara.rb +0 -0
  35. data/{templates/install → lib/generators/cucumber/install/templates}/support/edit_warning.txt +0 -0
  36. data/{templates/install → lib/generators/cucumber/install/templates}/support/paths.rb +3 -3
  37. data/{templates/install → lib/generators/cucumber/install/templates}/support/rails.rb.erb +1 -1
  38. data/{templates/install → lib/generators/cucumber/install/templates}/support/rails_spork.rb.erb +1 -1
  39. data/{templates/install → lib/generators/cucumber/install/templates}/support/selectors.rb +3 -3
  40. data/{templates/install → lib/generators/cucumber/install/templates}/support/web_steps_warning.txt +0 -0
  41. data/{templates/install → lib/generators/cucumber/install/templates}/tasks/cucumber.rake.erb +0 -0
  42. metadata +64 -73
  43. data/HACKING.rdoc +0 -22
  44. data/README.rdoc +0 -68
  45. data/VERSION +0 -1
  46. data/generators/cucumber/USAGE +0 -13
  47. data/generators/cucumber/cucumber_generator.rb +0 -46
  48. data/generators/feature/USAGE +0 -12
  49. data/generators/feature/feature_generator.rb +0 -47
  50. data/lib/cucumber/rails/version.rb +0 -22
  51. data/lib/cucumber/rails2.rb +0 -16
  52. data/lib/cucumber/rails2/action_controller.rb +0 -29
  53. data/lib/generators/cucumber/feature/feature_base.rb +0 -29
  54. data/lib/generators/cucumber/install/install_base.rb +0 -149
  55. data/templates/install/step_definitions/webrat_steps.rb.erb +0 -277
  56. data/templates/install/support/webrat.rb +0 -8
@@ -1,277 +0,0 @@
1
- <%= embed_file('support/web_steps_warning.txt') %>
2
-
3
- require 'uri'
4
- require 'cgi'
5
- require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
6
- require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "selectors"))
7
-
8
- # Commonly used webrat steps
9
- # http://github.com/brynary/webrat
10
-
11
- Given /^(?:|I )am on (.+)$/ do |page_name|
12
- visit path_to(page_name)
13
- end
14
-
15
- When /^(?:|I )go to (.+)$/ do |page_name|
16
- visit path_to(page_name)
17
- end
18
-
19
- When /^(?:|I )press "([^"]*)"$/ do |button|
20
- click_button(button)
21
- end
22
-
23
- When /^(?:|I )follow "([^"]*)"$/ do |link|
24
- click_link(link)
25
- end
26
-
27
- When /^(?:|I )follow "([^"]*)" within (.*)$/ do |link, parent|
28
- click_link_within(selector_for(parent), link)
29
- end
30
-
31
- When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value|
32
- fill_in(field, :with => value)
33
- end
34
-
35
- When /^(?:|I )fill in "([^"]*)" for "([^"]*)"$/ do |value, field|
36
- fill_in(field, :with => value)
37
- end
38
-
39
- # Use this to fill in an entire form with data from a table. Example:
40
- #
41
- # When I fill in the following:
42
- # | Account Number | 5002 |
43
- # | Expiry date | 2009-11-01 |
44
- # | Note | Nice guy |
45
- # | Wants Email? | |
46
- #
47
- # TODO: Add support for checkbox, select og option
48
- # based on naming conventions.
49
- #
50
- When /^(?:|I )fill in the following:$/ do |fields|
51
- fields.rows_hash.each do |name, value|
52
- When %{I fill in "#{name}" with "#{value}"}
53
- end
54
- end
55
-
56
- When /^(?:|I )select "([^"]*)" from "([^"]*)"$/ do |value, field|
57
- select(value, :from => field)
58
- end
59
-
60
- # Use this step in conjunction with Rail's datetime_select helper. For example:
61
- # When I select "December 25, 2008 10:00" as the date and time
62
- When /^(?:|I )select "([^"]*)" as the date and time$/ do |time|
63
- select_datetime(time)
64
- end
65
-
66
- # Use this step when using multiple datetime_select helpers on a page or
67
- # you want to specify which datetime to select. Given the following view:
68
- # <%%= f.label :preferred %><br />
69
- # <%%= f.datetime_select :preferred %>
70
- # <%%= f.label :alternative %><br />
71
- # <%%= f.datetime_select :alternative %>
72
- # The following steps would fill out the form:
73
- # When I select "November 23, 2004 11:20" as the "Preferred" date and time
74
- # And I select "November 25, 2004 10:30" as the "Alternative" date and time
75
- When /^(?:|I )select "([^"]*)" as the "([^"]*)" date and time$/ do |datetime, datetime_label|
76
- select_datetime(datetime, :from => datetime_label)
77
- end
78
-
79
- # Use this step in conjunction with Rail's time_select helper. For example:
80
- # When I select "2:20PM" as the time
81
- # Note: Rail's default time helper provides 24-hour time-- not 12 hour time. Webrat
82
- # will convert the 2:20PM to 14:20 and then select it.
83
- When /^(?:|I )select "([^"]*)" as the time$/ do |time|
84
- select_time(time)
85
- end
86
-
87
- # Use this step when using multiple time_select helpers on a page or you want to
88
- # specify the name of the time on the form. For example:
89
- # When I select "7:30AM" as the "Gym" time
90
- When /^(?:|I )select "([^"]*)" as the "([^"]*)" time$/ do |time, time_label|
91
- select_time(time, :from => time_label)
92
- end
93
-
94
- # Use this step in conjunction with Rail's date_select helper. For example:
95
- # When I select "February 20, 1981" as the date
96
- When /^(?:|I )select "([^"]*)" as the date$/ do |date|
97
- select_date(date)
98
- end
99
-
100
- # Use this step when using multiple date_select helpers on one page or
101
- # you want to specify the name of the date on the form. For example:
102
- # When I select "April 26, 1982" as the "Date of Birth" date
103
- When /^(?:|I )select "([^"]*)" as the "([^"]*)" date$/ do |date, date_label|
104
- select_date(date, :from => date_label)
105
- end
106
-
107
- When /^(?:|I )check "([^"]*)"$/ do |field|
108
- check(field)
109
- end
110
-
111
- When /^(?:|I )uncheck "([^"]*)"$/ do |field|
112
- uncheck(field)
113
- end
114
-
115
- When /^(?:|I )choose "([^"]*)"$/ do |field|
116
- choose(field)
117
- end
118
-
119
- # Adds support for validates_attachment_content_type. Without the mime-type getting
120
- # passed to attach_file() you will get a "Photo file is not one of the allowed file types."
121
- # error message
122
- When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field|
123
- type = path.split(".")[1]
124
-
125
- case type
126
- when "jpg"
127
- type = "image/jpg"
128
- when "jpeg"
129
- type = "image/jpeg"
130
- when "png"
131
- type = "image/png"
132
- when "gif"
133
- type = "image/gif"
134
- end
135
-
136
- attach_file(field, path, type)
137
- end
138
-
139
- Then /^(?:|I )should see "([^"]*)"$/ do |text|
140
- if response.respond_to? :should
141
- response.should contain(text)
142
- else
143
- assert_contain text
144
- end
145
- end
146
-
147
- Then /^(?:|I )should see "([^"]*)" within (.*)$/ do |text, parent|
148
- within(selector_for(parent)) do |content|
149
- if content.respond_to? :should
150
- content.should contain(text)
151
- else
152
- hc = Webrat::Matchers::HasContent.new(text)
153
- assert hc.matches?(content), hc.failure_message
154
- end
155
- end
156
- end
157
-
158
- Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
159
- regexp = Regexp.new(regexp)
160
- if response.respond_to? :should
161
- response.should contain(regexp)
162
- else
163
- assert_match(regexp, response_body)
164
- end
165
- end
166
-
167
- Then /^(?:|I )should see \/([^\/]*)\/ within (.*)$/ do |regexp, parent|
168
- within(selector_for(parent)) do |content|
169
- regexp = Regexp.new(regexp)
170
- if content.respond_to? :should
171
- content.should contain(regexp)
172
- else
173
- assert_match(regexp, content)
174
- end
175
- end
176
- end
177
-
178
- Then /^(?:|I )should not see "([^"]*)"$/ do |text|
179
- if response.respond_to? :should_not
180
- response.should_not contain(text)
181
- else
182
- assert_not_contain(text)
183
- end
184
- end
185
-
186
- Then /^(?:|I )should not see "([^"]*)" within (.*)$/ do |text, parent|
187
- within(selector_for(parent)) do |content|
188
- if content.respond_to? :should_not
189
- content.should_not contain(text)
190
- else
191
- hc = Webrat::Matchers::HasContent.new(text)
192
- assert !hc.matches?(content), hc.negative_failure_message
193
- end
194
- end
195
- end
196
-
197
- Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
198
- regexp = Regexp.new(regexp)
199
- if response.respond_to? :should_not
200
- response.should_not contain(regexp)
201
- else
202
- assert_not_contain(regexp)
203
- end
204
- end
205
-
206
- Then /^(?:|I )should not see \/([^\/]*)\/ within (.*)$/ do |regexp, parent|
207
- within(selector_for(parent)) do |content|
208
- regexp = Regexp.new(regexp)
209
- if content.respond_to? :should_not
210
- content.should_not contain(regexp)
211
- else
212
- assert_no_match(regexp, content)
213
- end
214
- end
215
- end
216
-
217
- Then /^the "([^"]*)" field should contain "([^"]*)"$/ do |field, value|
218
- field_value = field_labeled(field).value
219
- if field_value.respond_to? :should
220
- field_value.should =~ /#{value}/
221
- else
222
- assert_match(/#{value}/, field_value)
223
- end
224
- end
225
-
226
- Then /^the "([^"]*)" field should not contain "([^"]*)"$/ do |field, value|
227
- field_value = field_labeled(field).value
228
- if field_value.respond_to? :should_not
229
- field_value.should_not =~ /#{value}/
230
- else
231
- assert_no_match(/#{value}/, field_value)
232
- end
233
- end
234
-
235
- Then /^the "([^"]*)" checkbox should be checked$/ do |label|
236
- field = field_labeled(label)
237
- if field.respond_to? :should
238
- field.should be_checked
239
- else
240
- assert field.checked?
241
- end
242
- end
243
-
244
- Then /^the "([^"]*)" checkbox should not be checked$/ do |label|
245
- field = field_labeled(label)
246
- if field.respond_to? :should_not
247
- field.should_not be_checked
248
- else
249
- assert !field.checked?
250
- end
251
- end
252
-
253
- Then /^(?:|I )should be on (.+)$/ do |page_name|
254
- current_path = URI.parse(current_url).path
255
- if current_path.respond_to? :should
256
- current_path.should == path_to(page_name)
257
- else
258
- assert_equal path_to(page_name), current_path
259
- end
260
- end
261
-
262
- Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
263
- query = URI.parse(current_url).query
264
- actual_params = query ? CGI.parse(query) : {}
265
- expected_params = {}
266
- expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
267
-
268
- if actual_params.respond_to? :should
269
- actual_params.should == expected_params
270
- else
271
- assert_equal expected_params, actual_params
272
- end
273
- end
274
-
275
- Then /^show me the page$/ do
276
- save_and_open_page
277
- end
@@ -1,8 +0,0 @@
1
- require 'webrat'
2
- require 'webrat/core/matchers'
3
-
4
- Webrat.configure do |config|
5
- config.mode = :rails
6
- config.open_error_files = false # Set to true if you want error pages to pop up in the browser
7
- end
8
-