cucumber-rails 1.8.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +165 -16
- data/CONTRIBUTING.md +14 -2
- data/LICENSE +1 -1
- data/README.md +28 -28
- data/lib/cucumber/rails/action_dispatch.rb +21 -0
- data/lib/cucumber/rails/application.rb +11 -8
- data/lib/cucumber/rails/capybara/javascript_emulation.rb +27 -16
- data/lib/cucumber/rails/capybara/select_dates_and_times.rb +28 -13
- data/lib/cucumber/rails/database/deletion_strategy.rb +13 -0
- data/lib/cucumber/rails/database/null_strategy.rb +15 -0
- data/lib/cucumber/rails/database/shared_connection_strategy.rb +27 -0
- data/lib/cucumber/rails/database/strategy.rb +35 -0
- data/lib/cucumber/rails/database/truncation_strategy.rb +13 -0
- data/lib/cucumber/rails/database.rb +9 -58
- data/lib/cucumber/rails/hooks/database_cleaner.rb +9 -3
- data/lib/cucumber/rails/hooks/mail.rb +1 -1
- data/lib/cucumber/rails/world.rb +14 -3
- data/lib/cucumber/rails.rb +12 -13
- data/lib/generators/cucumber/install_generator.rb +13 -16
- data/lib/generators/cucumber/templates/config/cucumber.yml.erb +3 -3
- data/lib/generators/cucumber/templates/tasks/cucumber.rake.erb +5 -0
- metadata +94 -118
- data/.github/ISSUE_TEMPLATE.md +0 -52
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -42
- data/.gitignore +0 -14
- data/.rspec +0 -1
- data/.rubocop.yml +0 -36
- data/.rubocop_todo.yml +0 -59
- data/.travis.yml +0 -60
- data/Appraisals +0 -35
- data/Gemfile +0 -5
- data/Rakefile +0 -53
- data/bin/install_geckodriver.sh +0 -19
- data/bin/install_webpacker.sh +0 -9
- data/config/.gitignore +0 -1
- data/config/cucumber.yml +0 -17
- data/cucumber-rails.gemspec +0 -44
- data/dev_tasks/cucumber.rake +0 -5
- data/dev_tasks/rspec.rake +0 -5
- data/dev_tasks/yard/default/layout/html/bubble_32x32.png +0 -0
- data/dev_tasks/yard/default/layout/html/footer.erb +0 -5
- data/dev_tasks/yard/default/layout/html/index.erb +0 -1
- data/dev_tasks/yard/default/layout/html/layout.erb +0 -25
- data/dev_tasks/yard/default/layout/html/logo.erb +0 -1
- data/dev_tasks/yard/default/layout/html/setup.rb +0 -9
- data/dev_tasks/yard.rake +0 -36
- data/features/allow_rescue.feature +0 -65
- data/features/annotations.feature +0 -22
- data/features/capybara_javascript_drivers.feature +0 -62
- data/features/choose_javascript_database_strategy.feature +0 -125
- data/features/database_cleaner.feature +0 -44
- data/features/disable_automatic_database_cleaning.feature +0 -49
- data/features/emulate_javascript.feature +0 -94
- data/features/install_cucumber_rails.feature +0 -14
- data/features/no_database.feature +0 -60
- data/features/raising_errors.feature +0 -16
- data/features/rerun_profile.feature +0 -46
- data/features/rest_api.feature +0 -47
- data/features/step_definitions/cucumber_rails_steps.rb +0 -72
- data/features/support/aruba.rb +0 -5
- data/features/support/cucumber_rails_helper.rb +0 -80
- data/features/support/env.rb +0 -14
- data/features/support/legacy_web_steps_support.rb +0 -289
- data/gemfiles/rails_4_2.gemfile +0 -10
- data/gemfiles/rails_5_0.gemfile +0 -10
- data/gemfiles/rails_5_1.gemfile +0 -10
- data/gemfiles/rails_5_2.gemfile +0 -10
- data/gemfiles/rails_6_0.gemfile +0 -9
- data/lib/cucumber/rails/action_controller.rb +0 -17
- data/lib/generators/cucumber/templates/support/rails_spork.rb.erb +0 -13
- data/spec/cucumber/rails/database_spec.rb +0 -61
- data/spec/generators/cucumber/install_generator_spec.rb +0 -57
- data/spec/spec_helper.rb +0 -16
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
module WebSteps
|
|
2
|
-
def create_web_steps
|
|
3
|
-
write_file('features/step_definitions/web_steps.rb', <<-EOF)
|
|
4
|
-
# web_steps.rb used to be in Cucumber-Rails, but was removed in 1.1.0. We're still using them in the tests because
|
|
5
|
-
# the tests were written while we still thought web_steps.rb was a good idea. We don't think so anymore:
|
|
6
|
-
#
|
|
7
|
-
# http://groups.google.com/group/cukes/browse_thread/thread/26f80b93c94f2952
|
|
8
|
-
# https://github.com/cucumber/cucumber-rails/issues/174
|
|
9
|
-
# http://benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories.html
|
|
10
|
-
# http://dannorth.net/2011/01/31/whose-domain-is-it-anyway/
|
|
11
|
-
# http://elabs.se/blog/15-you-re-cuking-it-wrong
|
|
12
|
-
#
|
|
13
|
-
# I'm sure someone will find this and paste it into their own projects. Go ahead. It's a bad idea.
|
|
14
|
-
# You have been warned.
|
|
15
|
-
#
|
|
16
|
-
# Aslak
|
|
17
|
-
|
|
18
|
-
require 'uri'
|
|
19
|
-
require 'cgi'
|
|
20
|
-
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
|
21
|
-
|
|
22
|
-
module WithinHelpers
|
|
23
|
-
def with_scope(locator)
|
|
24
|
-
locator ? within(*selector_for(locator)) { yield } : yield
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
World(WithinHelpers)
|
|
28
|
-
|
|
29
|
-
# Single-line step scoper
|
|
30
|
-
When /^(.*) within (.*[^:])$/ do |step, parent|
|
|
31
|
-
with_scope(parent) { When step }
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# Multi-line step scoper
|
|
35
|
-
When /^(.*) within (.*[^:]):$/ do |step, parent, table_or_string|
|
|
36
|
-
with_scope(parent) { When "\#{step}:", table_or_string }
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
Given /^(?:|I )am on (.+)$/ do |page_name|
|
|
40
|
-
visit path_to(page_name)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
When /^(?:|I )go to (.+)$/ do |page_name|
|
|
44
|
-
visit path_to(page_name)
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
When /^(?:|I )press "([^"]*)"$/ do |button|
|
|
48
|
-
click_button(button)
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
When /^(?:|I )follow "([^"]*)"$/ do |link|
|
|
52
|
-
click_link(link)
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value|
|
|
56
|
-
fill_in(field, with: value)
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
When /^(?:|I )fill in "([^"]*)" for "([^"]*)"$/ do |value, field|
|
|
60
|
-
fill_in(field, with: value)
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
# Use this to fill in an entire form with data from a table. Example:
|
|
64
|
-
#
|
|
65
|
-
# When I fill in the following:
|
|
66
|
-
# | Account Number | 5002 |
|
|
67
|
-
# | Expiry date | 2009-11-01 |
|
|
68
|
-
# | Note | Nice guy |
|
|
69
|
-
# | Wants Email? | |
|
|
70
|
-
#
|
|
71
|
-
# TODO: Add support for checkbox, select or option
|
|
72
|
-
# based on naming conventions.
|
|
73
|
-
#
|
|
74
|
-
When /^(?:|I )fill in the following:$/ do |fields|
|
|
75
|
-
fields.rows_hash.each do |name, value|
|
|
76
|
-
When %{I fill in "\#{name}" with "\#{value}"}
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
When /^(?:|I )select "([^"]*)" from "([^"]*)"$/ do |value, field|
|
|
81
|
-
select(value, from: field)
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
When /^(?:|I )check "([^"]*)"$/ do |field|
|
|
85
|
-
check(field)
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
When /^(?:|I )uncheck "([^"]*)"$/ do |field|
|
|
89
|
-
uncheck(field)
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
When /^(?:|I )choose "([^"]*)"$/ do |field|
|
|
93
|
-
choose(field)
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field|
|
|
97
|
-
attach_file(field, File.expand_path(path))
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
Then /^(?:|I )should see "([^"]*)"$/ do |text|
|
|
101
|
-
if page.respond_to? :should
|
|
102
|
-
page.should have_content(text)
|
|
103
|
-
else
|
|
104
|
-
assert page.has_content?(text)
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
Then /^(?:|I )should see \\/([^\\/]*)\\/$/ do |regexp|
|
|
109
|
-
regexp = Regexp.new(regexp)
|
|
110
|
-
|
|
111
|
-
if page.respond_to? :should
|
|
112
|
-
page.should have_xpath('//*', text: regexp)
|
|
113
|
-
else
|
|
114
|
-
assert page.has_xpath?('//*', text: regexp)
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
Then /^(?:|I )should not see "([^"]*)"$/ do |text|
|
|
119
|
-
if page.respond_to? :should
|
|
120
|
-
page.should have_no_content(text)
|
|
121
|
-
else
|
|
122
|
-
assert page.has_no_content?(text)
|
|
123
|
-
end
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
Then /^(?:|I )should not see \\/([^\\/]*)\\/$/ do |regexp|
|
|
127
|
-
regexp = Regexp.new(regexp)
|
|
128
|
-
|
|
129
|
-
if page.respond_to? :should
|
|
130
|
-
page.should have_no_xpath('//*', text: regexp)
|
|
131
|
-
else
|
|
132
|
-
assert page.has_no_xpath?('//*', text: regexp)
|
|
133
|
-
end
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
Then /^the "([^"]*)" field(?: within (.*))? should contain "([^"]*)"$/ do |field, parent, value|
|
|
137
|
-
with_scope(parent) do
|
|
138
|
-
field = find_field(field)
|
|
139
|
-
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
|
140
|
-
if field_value.respond_to? :should
|
|
141
|
-
field_value.should =~ /\#{value}/
|
|
142
|
-
else
|
|
143
|
-
assert_match(/\#{value}/, field_value)
|
|
144
|
-
end
|
|
145
|
-
end
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
Then /^the "([^"]*)" field(?: within (.*))? should not contain "([^"]*)"$/ do |field, parent, value|
|
|
149
|
-
with_scope(parent) do
|
|
150
|
-
field = find_field(field)
|
|
151
|
-
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
|
152
|
-
if field_value.respond_to? :should_not
|
|
153
|
-
field_value.should_not =~ /\#{value}/
|
|
154
|
-
else
|
|
155
|
-
assert_no_match(/\#{value}/, field_value)
|
|
156
|
-
end
|
|
157
|
-
end
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
Then /^the "([^"]*)" field should have the error "([^"]*)"$/ do |field, error_message|
|
|
161
|
-
element = find_field(field)
|
|
162
|
-
classes = element.find(:xpath, '..')[:class].split(' ')
|
|
163
|
-
|
|
164
|
-
form_for_input = element.find(:xpath, 'ancestor::form[1]')
|
|
165
|
-
using_formtastic = form_for_input[:class].include?('formtastic')
|
|
166
|
-
error_class = using_formtastic ? 'error' : 'field_with_errors'
|
|
167
|
-
|
|
168
|
-
if classes.respond_to? :should
|
|
169
|
-
classes.should include(error_class)
|
|
170
|
-
else
|
|
171
|
-
assert classes.include?(error_class)
|
|
172
|
-
end
|
|
173
|
-
|
|
174
|
-
if page.respond_to?(:should)
|
|
175
|
-
if using_formtastic
|
|
176
|
-
error_paragraph = element.find(:xpath, '../*[@class="inline-errors"][1]')
|
|
177
|
-
error_paragraph.should have_content(error_message)
|
|
178
|
-
else
|
|
179
|
-
page.should have_content("\#{field.titlecase} \#{error_message}")
|
|
180
|
-
end
|
|
181
|
-
else
|
|
182
|
-
if using_formtastic
|
|
183
|
-
error_paragraph = element.find(:xpath, '../*[@class="inline-errors"][1]')
|
|
184
|
-
assert error_paragraph.has_content?(error_message)
|
|
185
|
-
else
|
|
186
|
-
assert page.has_content?("\#{field.titlecase} \#{error_message}")
|
|
187
|
-
end
|
|
188
|
-
end
|
|
189
|
-
end
|
|
190
|
-
|
|
191
|
-
Then /^the "([^"]*)" field should have no error$/ do |field|
|
|
192
|
-
element = find_field(field)
|
|
193
|
-
classes = element.find(:xpath, '..')[:class].split(' ')
|
|
194
|
-
if classes.respond_to? :should
|
|
195
|
-
classes.should_not include('field_with_errors')
|
|
196
|
-
classes.should_not include('error')
|
|
197
|
-
else
|
|
198
|
-
assert !classes.include?('field_with_errors')
|
|
199
|
-
assert !classes.include?('error')
|
|
200
|
-
end
|
|
201
|
-
end
|
|
202
|
-
|
|
203
|
-
Then /^the "([^"]*)" checkbox(?: within (.*))? should be checked$/ do |label, parent|
|
|
204
|
-
with_scope(parent) do
|
|
205
|
-
field_checked = find_field(label)['checked']
|
|
206
|
-
if field_checked.respond_to? :should
|
|
207
|
-
field_checked.should be_true
|
|
208
|
-
else
|
|
209
|
-
assert field_checked
|
|
210
|
-
end
|
|
211
|
-
end
|
|
212
|
-
end
|
|
213
|
-
|
|
214
|
-
Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label, parent|
|
|
215
|
-
with_scope(parent) do
|
|
216
|
-
field_checked = find_field(label)['checked']
|
|
217
|
-
if field_checked.respond_to? :should
|
|
218
|
-
field_checked.should be_false
|
|
219
|
-
else
|
|
220
|
-
assert !field_checked
|
|
221
|
-
end
|
|
222
|
-
end
|
|
223
|
-
end
|
|
224
|
-
|
|
225
|
-
Then /^(?:|I )should be on (.+)$/ do |page_name|
|
|
226
|
-
current_path = URI.parse(current_url).path
|
|
227
|
-
if current_path.respond_to? :should
|
|
228
|
-
current_path.should == path_to(page_name)
|
|
229
|
-
else
|
|
230
|
-
assert_equal path_to(page_name), current_path
|
|
231
|
-
end
|
|
232
|
-
end
|
|
233
|
-
|
|
234
|
-
Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
|
|
235
|
-
query = URI.parse(current_url).query
|
|
236
|
-
actual_params = query ? CGI.parse(query) : {}
|
|
237
|
-
expected_params = {}
|
|
238
|
-
expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
|
|
239
|
-
|
|
240
|
-
if actual_params.respond_to? :should
|
|
241
|
-
actual_params.should == expected_params
|
|
242
|
-
else
|
|
243
|
-
assert_equal expected_params, actual_params
|
|
244
|
-
end
|
|
245
|
-
end
|
|
246
|
-
|
|
247
|
-
Then /^show me the page$/ do
|
|
248
|
-
save_and_open_page
|
|
249
|
-
end
|
|
250
|
-
EOF
|
|
251
|
-
|
|
252
|
-
write_file('features/support/paths.rb', <<-EOF)
|
|
253
|
-
module NavigationHelpers
|
|
254
|
-
# Maps a name to a path. Used by the
|
|
255
|
-
#
|
|
256
|
-
# When /^I go to (.+)$/ do |page_name|
|
|
257
|
-
#
|
|
258
|
-
# step definition in web_steps.rb
|
|
259
|
-
#
|
|
260
|
-
def path_to(page_name)
|
|
261
|
-
case page_name
|
|
262
|
-
|
|
263
|
-
when /^the home\s?page$/
|
|
264
|
-
'/'
|
|
265
|
-
|
|
266
|
-
# Add more mappings here.
|
|
267
|
-
# Here is an example that pulls values out of the Regexp:
|
|
268
|
-
#
|
|
269
|
-
# when /^(.*)'s profile page$/i
|
|
270
|
-
# user_profile_path(User.find_by_login($1))
|
|
271
|
-
|
|
272
|
-
else
|
|
273
|
-
begin
|
|
274
|
-
page_name =~ /^the (.*) page$/
|
|
275
|
-
path_components = $1.split(/\s+/)
|
|
276
|
-
self.send(path_components.push('path').join('_').to_sym)
|
|
277
|
-
rescue NoMethodError, ArgumentError
|
|
278
|
-
raise "Can't find mapping from \"\#{page_name}\" to a path.\\n" +
|
|
279
|
-
"Now, go and add a mapping in \#{__FILE__}"
|
|
280
|
-
end
|
|
281
|
-
end
|
|
282
|
-
end
|
|
283
|
-
end
|
|
284
|
-
|
|
285
|
-
World(NavigationHelpers)
|
|
286
|
-
EOF
|
|
287
|
-
end
|
|
288
|
-
end
|
|
289
|
-
World(WebSteps)
|
data/gemfiles/rails_4_2.gemfile
DELETED
data/gemfiles/rails_5_0.gemfile
DELETED
data/gemfiles/rails_5_1.gemfile
DELETED
data/gemfiles/rails_5_2.gemfile
DELETED
data/gemfiles/rails_6_0.gemfile
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
ActionController::Base.class_eval do
|
|
4
|
-
cattr_accessor :allow_rescue
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
module ActionDispatch
|
|
8
|
-
class ShowExceptions
|
|
9
|
-
alias __cucumber_orig_call__ call
|
|
10
|
-
|
|
11
|
-
def call(env)
|
|
12
|
-
env['action_dispatch.show_exceptions'] = !!ActionController::Base.allow_rescue
|
|
13
|
-
env['action_dispatch.show_detailed_exceptions'] = !ActionController::Base.allow_rescue
|
|
14
|
-
__cucumber_orig_call__(env)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<%= embed_file('support/edit_warning.txt') %>
|
|
2
|
-
require 'rubygems'
|
|
3
|
-
require 'spork'
|
|
4
|
-
|
|
5
|
-
Spork.prefork do
|
|
6
|
-
<%= embed_template('support/_rails_prefork.rb.erb', ' ') %>
|
|
7
|
-
|
|
8
|
-
<%= embed_file("support/capybara.rb", ' ') %>
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
Spork.each_run do
|
|
12
|
-
<%= embed_template('support/_rails_each_run.rb.erb', ' ') %>
|
|
13
|
-
end
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'cucumber/rails/database'
|
|
4
|
-
|
|
5
|
-
describe Cucumber::Rails::Database do
|
|
6
|
-
before { allow(strategy_type).to receive(:new).and_return(strategy) }
|
|
7
|
-
|
|
8
|
-
let(:strategy) { instance_double(strategy_type, before_js: nil, before_non_js: nil) }
|
|
9
|
-
let(:strategy_type) { Cucumber::Rails::Database::TruncationStrategy }
|
|
10
|
-
|
|
11
|
-
it 'forwards events to the selected strategy' do
|
|
12
|
-
described_class.javascript_strategy = :truncation
|
|
13
|
-
|
|
14
|
-
expect(strategy).to receive(:before_non_js).ordered
|
|
15
|
-
described_class.before_non_js
|
|
16
|
-
|
|
17
|
-
expect(strategy).to receive(:before_js).ordered
|
|
18
|
-
described_class.before_js
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it 'raises an error if you use a non-understood strategy' do
|
|
22
|
-
expect { described_class.javascript_strategy = :invalid }
|
|
23
|
-
.to raise_error(Cucumber::Rails::Database::InvalidStrategy)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
describe 'using a custom strategy' do
|
|
27
|
-
let(:strategy_type) { ValidStrategy }
|
|
28
|
-
|
|
29
|
-
class ValidStrategy
|
|
30
|
-
def before_js
|
|
31
|
-
# Anything
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def before_non_js
|
|
35
|
-
# Likewise
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
class InvalidStrategy; end
|
|
40
|
-
|
|
41
|
-
it 'raises an error if the strategy doens\'t support the protocol' do
|
|
42
|
-
expect { described_class.javascript_strategy = InvalidStrategy }
|
|
43
|
-
.to raise_error(ArgumentError)
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
it 'accepts a custom strategy with a valid interface' do
|
|
47
|
-
expect { described_class.javascript_strategy = ValidStrategy }
|
|
48
|
-
.not_to raise_error
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
it 'forwards events to a custom strategy' do
|
|
52
|
-
described_class.javascript_strategy = ValidStrategy
|
|
53
|
-
|
|
54
|
-
expect(strategy).to receive(:before_non_js).ordered
|
|
55
|
-
described_class.before_non_js
|
|
56
|
-
|
|
57
|
-
expect(strategy).to receive(:before_js).ordered
|
|
58
|
-
described_class.before_js
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
# Generators are not automatically loaded by Rails
|
|
6
|
-
require 'generators/cucumber/install_generator'
|
|
7
|
-
|
|
8
|
-
describe Cucumber::InstallGenerator do
|
|
9
|
-
# Tell the generator where to put its output (what it thinks of as Rails.root)
|
|
10
|
-
destination File.expand_path('../../../../tmp', __dir__)
|
|
11
|
-
|
|
12
|
-
before { prepare_destination }
|
|
13
|
-
|
|
14
|
-
let(:auto_generated_message) do
|
|
15
|
-
'# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.'
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
describe 'no arguments' do
|
|
19
|
-
before { run_generator }
|
|
20
|
-
|
|
21
|
-
describe 'config/cucumber.yml' do
|
|
22
|
-
subject { file('config/cucumber.yml') }
|
|
23
|
-
|
|
24
|
-
it { is_expected.to exist }
|
|
25
|
-
it { is_expected.to contain 'default: <%= std_opts %> features' }
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
describe 'features/step_definitions folder' do
|
|
29
|
-
subject { file('features/step_definitions') }
|
|
30
|
-
|
|
31
|
-
it { is_expected.to exist }
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
describe 'features/support/env.rb' do
|
|
35
|
-
subject { file('features/support/env.rb') }
|
|
36
|
-
|
|
37
|
-
it { is_expected.to exist }
|
|
38
|
-
it { is_expected.to contain auto_generated_message }
|
|
39
|
-
it { is_expected.to contain "require 'cucumber/rails'" }
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
describe 'lib/tasks/cucumber.rake' do
|
|
43
|
-
subject { file('lib/tasks/cucumber.rake') }
|
|
44
|
-
|
|
45
|
-
it { is_expected.to exist }
|
|
46
|
-
it { is_expected.to contain auto_generated_message }
|
|
47
|
-
it { is_expected.to contain "task cucumber: 'cucumber:ok'" }
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
describe 'script/cucumber' do
|
|
51
|
-
subject { file('script/cucumber') }
|
|
52
|
-
|
|
53
|
-
it { is_expected.to exist }
|
|
54
|
-
it { is_expected.to contain 'load Cucumber::BINARY' }
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
data/spec/spec_helper.rb
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'rspec/rails/fixture_support'
|
|
4
|
-
require 'rails/all'
|
|
5
|
-
|
|
6
|
-
ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
|
|
7
|
-
|
|
8
|
-
module CucumberRails
|
|
9
|
-
class Application < ::Rails::Application
|
|
10
|
-
config.secret_key_base = 'ASecretString' if config.respond_to? :secret_key_base
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
require 'rspec/support/spec'
|
|
15
|
-
require 'rspec/rails'
|
|
16
|
-
require 'ammeter/init'
|