cucumber-rails 0.0.0 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.1.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cucumber-rails}
8
- s.version = "0.0.0"
8
+ s.version = "0.1.0"
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"]
12
- s.date = %q{2009-11-07}
12
+ s.date = %q{2009-11-08}
13
13
  s.description = %q{Rails Generators for Cucumber}
14
14
  s.email = %q{mail@dennisbloete.de}
15
15
  s.extra_rdoc_files = [
@@ -31,7 +31,8 @@ Gem::Specification.new do |s|
31
31
  "rails_generators/cucumber/templates/paths.rb",
32
32
  "rails_generators/cucumber/templates/spork_env.rb",
33
33
  "rails_generators/cucumber/templates/version_check.rb",
34
- "rails_generators/cucumber/templates/webrat_steps.rb",
34
+ "rails_generators/cucumber/templates/webrat_steps/webrat_steps_de.rb",
35
+ "rails_generators/cucumber/templates/webrat_steps/webrat_steps_en.rb",
35
36
  "rails_generators/feature/USAGE",
36
37
  "rails_generators/feature/feature_generator.rb",
37
38
  "rails_generators/feature/templates/feature.erb",
@@ -9,3 +9,6 @@ Description:
9
9
 
10
10
  Examples:
11
11
  `./script/generate cucumber`
12
+
13
+ You can also provide a language argument for localized webrat_steps:
14
+ `./script/generate cucumber de`
@@ -7,11 +7,18 @@ class CucumberGenerator < Rails::Generator::Base
7
7
  Config::CONFIG['ruby_install_name'])
8
8
 
9
9
  attr_accessor :framework
10
-
10
+ attr_reader :language
11
+
12
+ def initialize(runtime_args, runtime_options = {})
13
+ super
14
+ @language = @args.empty? ? 'en' : @args.first
15
+ end
16
+
11
17
  def manifest
12
18
  record do |m|
13
19
  m.directory 'features/step_definitions'
14
- m.template 'webrat_steps.rb', 'features/step_definitions/webrat_steps.rb'
20
+
21
+ m.template "webrat_steps/webrat_steps_#{language}.rb", 'features/step_definitions/webrat_steps.rb'
15
22
  m.template'cucumber_environment.rb', 'config/environments/cucumber.rb',
16
23
  :assigns => { :cucumber_version => ::Cucumber::VERSION }
17
24
 
@@ -74,7 +81,7 @@ protected
74
81
  end
75
82
 
76
83
  def banner
77
- "Usage: #{$0} cucumber"
84
+ "Usage: #{$0} cucumber (language)"
78
85
  end
79
86
 
80
87
  def after_generate
@@ -0,0 +1,241 @@
1
+ # IMPORTANT: This file was generated by Cucumber <%= Cucumber::VERSION %>
2
+ # Edit at your own peril - it's recommended to regenerate this file
3
+ # in the future When you upgrade to a newer version of Cucumber.
4
+ # Consider adding your own code to a new file instead of editing this one.
5
+
6
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
7
+
8
+ # Commonly used webrat steps
9
+ # http://github.com/brynary/webrat
10
+
11
+ Given /^(?:|ich )bin auf (.+)$/ do |page_name|
12
+ visit path_to(page_name)
13
+ end
14
+
15
+ When /^(?:|ich )auf (.+) gehe$/ do |page_name|
16
+ visit path_to(page_name)
17
+ end
18
+
19
+ When /^(?:|ich ) "([^\"]*)" drücke$/ do |button|
20
+ click_button(button)
21
+ end
22
+
23
+ When /^(?:|ich ) "([^\"]*)" klicke$/ do |link|
24
+ click_link(link)
25
+ end
26
+
27
+ When /^(?:|ich ) "([^\"]*)" innerhalb "([^\"]*)" klicke$/ do |link, parent|
28
+ click_link_within(parent, link)
29
+ end
30
+
31
+ When /^(?:|ich ) "([^\"]*)" mit "([^\"]*)" ausfülle$/ do |field, value|
32
+ fill_in(field, :with => value)
33
+ end
34
+
35
+ When /^(?:|ich ) "([^\"]*)" in "([^\"]*)" eingebe$/ 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 /^(?:|ich )folgendes eingebe:$/ do |fields|
51
+ fields.rows_hash.each do |name, value|
52
+ When %{ich "#{name}" mit "#{value}" ausfülle}
53
+ end
54
+ end
55
+
56
+ When /^(?:|ich )"([^\"]*)" in "([^\"]*)" auswähle$/ 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 /^(?:|ich )"([^\"]*)" als Datum und Uhrzeit auswähle$/ 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 /^(?:|ich )"([^\"]*)" als "([^\"]*)" Datum und Uhrzeit auswähle$/ 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 /^(?:|ich )"([^\"]*)" als Uhrzeit auswähle$/ 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 /^(?:|ich )"([^\"]*)" als "([^\"]*)" Uhrzeit auswähle$/ 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 /^(?:|ich )"([^\"]*)" als Datum auswähle$/ 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 /^(?:|ich ) "([^\"]*)" als "([^\"]*)" Datum auswähle$/ do |date, date_label|
104
+ select_date(date, :from => date_label)
105
+ end
106
+
107
+ When /^(?:|ich )"([^\"]*)" anhake$/ do |field|
108
+ check(field)
109
+ end
110
+
111
+ When /^(?:|ich )"([^\"]*)" abhake$/ do |field|
112
+ uncheck(field)
113
+ end
114
+
115
+ When /^(?:|ich )"([^\"]*)" auswähle$/ do |field|
116
+ choose(field)
117
+ end
118
+
119
+ When /^(?:|ich )die Datei "([^\"]*)" als "([^\"]*)" anhänge$/ do |path, field|
120
+ attach_file(field, path)
121
+ end
122
+
123
+ Then /^sollte (?:|ich )"([^\"]*)" sehen$/ do |text|
124
+ <% if framework == :rspec -%>
125
+ response.should contain(text)
126
+ <% else -%>
127
+ assert_contain text
128
+ <% end -%>
129
+ end
130
+
131
+ Then /^sollte (?:|ich )"([^\"]*)" innerhalb "([^\"]*)" sehen$/ do |text, selector|
132
+ within(selector) do |content|
133
+ <% if framework == :rspec -%>
134
+ content.should contain(text)
135
+ <% else -%>
136
+ assert content.include?(text)
137
+ <% end -%>
138
+ end
139
+ end
140
+
141
+ Then /^sollte (?:|ich )\/([^\/]*)\/ sehen$/ do |regexp|
142
+ regexp = Regexp.new(regexp)
143
+ <% if framework == :rspec -%>
144
+ response.should contain(regexp)
145
+ <% else -%>
146
+ assert_contain regexp
147
+ <% end -%>
148
+ end
149
+
150
+ Then /^sollte (?:|ich )\/([^\/]*)\/ innerhalb "([^\"]*)" sehen$/ do |regexp, selector|
151
+ within(selector) do |content|
152
+ regexp = Regexp.new(regexp)
153
+ <% if framework == :rspec -%>
154
+ content.should contain(regexp)
155
+ <% else -%>
156
+ assert content =~ regexp
157
+ <% end -%>
158
+ end
159
+ end
160
+
161
+ Then /^sollte (?:|ich )nicht "([^\"]*)" sehen$/ do |text|
162
+ <% if framework == :rspec -%>
163
+ response.should_not contain(text)
164
+ <% else -%>
165
+ assert_not_contain text
166
+ <% end -%>
167
+ end
168
+
169
+ Then /^sollte (?:|ich )nicht "([^\"]*)" innerhalb "([^\"]*)" sehen$/ do |text, selector|
170
+ within(selector) do |content|
171
+ <% if framework == :rspec -%>
172
+ content.should_not contain(text)
173
+ <% else -%>
174
+ assert !content.include?(text)
175
+ <% end -%>
176
+ end
177
+ end
178
+
179
+ Then /^sollte (?:|ich )nicht \/([^\/]*)\/ sehen$/ do |regexp|
180
+ regexp = Regexp.new(regexp)
181
+ <% if framework == :rspec -%>
182
+ response.should_not contain(regexp)
183
+ <% else -%>
184
+ assert_not_contain regexp
185
+ <% end -%>
186
+ end
187
+
188
+ Then /^sollte (?:|ich )nciht \/([^\/]*)\/ innerhalb "([^\"]*)" sehen$/ do |regexp, selector|
189
+ within(selector) do |content|
190
+ regexp = Regexp.new(regexp)
191
+ <% if framework == :rspec -%>
192
+ content.should_not contain(regexp)
193
+ <% else -%>
194
+ assert content !~ regexp
195
+ <% end -%>
196
+ end
197
+ end
198
+
199
+ Then /^sollte das "([^\"]*)" Feld "([^\"]*)" enthalten$/ do |field, value|
200
+ <% if framework == :rspec -%>
201
+ field_labeled(field).value.should =~ /#{value}/
202
+ <% else -%>
203
+ assert_match(/#{value}/, field_labeled(field).value)
204
+ <% end -%>
205
+ end
206
+
207
+ Then /^sollte das "([^\"]*)" Feld nicht "([^\"]*)" enthalten$/ do |field, value|
208
+ <% if framework == :rspec -%>
209
+ field_labeled(field).value.should_not =~ /#{value}/
210
+ <% else -%>
211
+ assert_no_match(/#{value}/, field_labeled(field).value)
212
+ <% end -%>
213
+ end
214
+
215
+ Then /^sollte die "([^\"]*)" Checkbox angehakt sein$/ do |label|
216
+ <% if framework == :rspec -%>
217
+ field_labeled(label).should be_checked
218
+ <% else -%>
219
+ assert field_labeled(label).checked?
220
+ <% end -%>
221
+ end
222
+
223
+ Then /^sollte die "([^\"]*)" Checkbox nicht angehakt sein$/ do |label|
224
+ <% if framework == :rspec -%>
225
+ field_labeled(label).should_not be_checked
226
+ <% else -%>
227
+ assert !field_labeled(label).checked?
228
+ <% end -%>
229
+ end
230
+
231
+ Then /^sollte (?:|ich )auf (.+) sein$/ do |page_name|
232
+ <% if framework == :rspec -%>
233
+ URI.parse(current_url).path.should == path_to(page_name)
234
+ <% else -%>
235
+ assert_equal path_to(page_name), URI.parse(current_url).path
236
+ <% end -%>
237
+ end
238
+
239
+ Then /^zeig mir die Seite$/ do
240
+ save_and_open_page
241
+ end
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.0.0
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Dennis Bl\xC3\xB6te"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-07 00:00:00 +01:00
12
+ date: 2009-11-08 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -37,7 +37,8 @@ files:
37
37
  - rails_generators/cucumber/templates/paths.rb
38
38
  - rails_generators/cucumber/templates/spork_env.rb
39
39
  - rails_generators/cucumber/templates/version_check.rb
40
- - rails_generators/cucumber/templates/webrat_steps.rb
40
+ - rails_generators/cucumber/templates/webrat_steps/webrat_steps_de.rb
41
+ - rails_generators/cucumber/templates/webrat_steps/webrat_steps_en.rb
41
42
  - rails_generators/feature/USAGE
42
43
  - rails_generators/feature/feature_generator.rb
43
44
  - rails_generators/feature/templates/feature.erb