cucumber-rails 1.4.0 → 2.1.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 +7 -0
- data/.github/ISSUE_TEMPLATE.md +52 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +42 -0
- data/.gitignore +3 -0
- data/.rspec +4 -1
- data/.rubocop.yml +68 -0
- data/.travis.yml +53 -26
- data/Appraisals +27 -63
- data/{History.md → CHANGELOG.md} +299 -19
- data/CONTRIBUTING.md +18 -27
- data/Gemfile +2 -4
- data/LICENSE +1 -1
- data/README.md +73 -29
- data/Rakefile +18 -14
- data/bin/install_geckodriver.sh +19 -0
- data/bin/install_webpacker.sh +9 -0
- data/config/cucumber.yml +5 -3
- data/cucumber-rails.gemspec +37 -25
- data/dev_tasks/cucumber.rake +3 -3
- data/dev_tasks/rspec.rake +3 -6
- data/dev_tasks/yard/default/layout/html/footer.erb +1 -1
- data/dev_tasks/yard/default/layout/html/layout.erb +5 -5
- data/dev_tasks/yard/default/layout/html/logo.erb +1 -1
- data/dev_tasks/yard/default/layout/html/setup.rb +6 -1
- data/dev_tasks/yard.rake +7 -14
- data/features/allow_rescue.feature +17 -12
- data/features/annotations.feature +20 -0
- data/features/capybara_javascript_drivers.feature +42 -32
- data/features/choose_javascript_database_strategy.feature +38 -57
- data/features/configuration.feature +48 -0
- data/features/database_cleaner.feature +20 -20
- data/features/disable_automatic_database_cleaning.feature +13 -19
- data/features/emulate_javascript.feature +65 -48
- data/features/install_cucumber_rails.feature +6 -5
- data/features/no_database.feature +8 -15
- data/features/raising_errors.feature +10 -4
- data/features/rerun_profile.feature +18 -8
- data/features/rest_api.feature +13 -13
- data/features/step_definitions/cucumber_rails_steps.rb +52 -66
- data/features/support/aruba.rb +5 -0
- data/features/support/cucumber_rails_helper.rb +85 -0
- data/features/support/env.rb +4 -35
- data/features/support/hooks.rb +8 -0
- data/gemfiles/rails_4_2.gemfile +10 -0
- data/gemfiles/rails_5_0.gemfile +10 -0
- data/gemfiles/rails_5_1.gemfile +10 -0
- data/gemfiles/rails_5_2.gemfile +10 -0
- data/gemfiles/rails_6_0.gemfile +9 -0
- data/lib/cucumber/rails/action_dispatch.rb +21 -0
- data/lib/cucumber/rails/application.rb +17 -8
- data/lib/cucumber/rails/capybara/javascript_emulation.rb +47 -39
- data/lib/cucumber/rails/capybara/select_dates_and_times.rb +8 -6
- data/lib/cucumber/rails/capybara.rb +2 -0
- data/lib/cucumber/rails/database.rb +36 -17
- data/lib/cucumber/rails/hooks/active_record.rb +14 -12
- data/lib/cucumber/rails/hooks/allow_rescue.rb +2 -0
- data/lib/cucumber/rails/hooks/database_cleaner.rb +6 -4
- data/lib/cucumber/rails/hooks/mail.rb +4 -4
- data/lib/cucumber/rails/hooks.rb +2 -0
- data/lib/cucumber/rails/rspec.rb +5 -3
- data/lib/cucumber/rails/world.rb +26 -9
- data/lib/cucumber/rails.rb +21 -18
- data/lib/generators/cucumber/{install/USAGE → USAGE} +2 -2
- data/lib/generators/cucumber/{install/install_generator.rb → install_generator.rb} +28 -15
- data/lib/generators/cucumber/{install/templates → templates}/config/cucumber.yml.erb +4 -3
- data/lib/generators/cucumber/{install/templates → templates}/script/cucumber +1 -0
- data/lib/generators/cucumber/{install/templates → templates}/support/_rails_each_run.rb.erb +4 -4
- data/lib/generators/cucumber/{install/templates → templates}/support/_rails_prefork.rb.erb +0 -0
- data/lib/generators/cucumber/{install/templates → templates}/support/capybara.rb +2 -0
- data/lib/generators/cucumber/{install/templates → templates}/support/edit_warning.txt +0 -0
- data/lib/generators/cucumber/{install/templates → templates}/support/rails.rb.erb +0 -0
- data/lib/generators/cucumber/{install/templates → templates}/support/rails_spork.rb.erb +2 -2
- data/lib/generators/cucumber/{install/templates → templates}/tasks/cucumber.rake.erb +19 -8
- data/spec/cucumber/rails/database_spec.rb +46 -33
- data/spec/generators/cucumber/install_generator_spec.rb +55 -0
- data/spec/spec_helper.rb +14 -2
- metadata +228 -142
- data/Gemfile.appraisal +0 -3
- data/features/step_definitions/mongo_steps.rb +0 -3
- data/features/support/bundler_pre_support.rb +0 -28
- data/features/support/fixtures/bundler-1.0.21.gem +0 -0
- data/features/support/fixtures/bundler-1.1.rc.gem +0 -0
- data/features/support/legacy_web_steps_support.rb +0 -290
- data/gemfiles/capybara_1_1.gemfile +0 -17
- data/gemfiles/rails_3_0.gemfile +0 -16
- data/gemfiles/rails_3_1.gemfile +0 -17
- data/gemfiles/rails_3_2.gemfile +0 -17
- data/gemfiles/rails_4_0.gemfile +0 -20
- data/lib/cucumber/rails/action_controller.rb +0 -12
- data/spec/generators/cucumber/install/install_generator_spec.rb +0 -47
@@ -1,57 +1,70 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'cucumber/rails/database'
|
3
4
|
|
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 }
|
5
10
|
|
6
|
-
|
11
|
+
context 'when using a valid pre-determined strategy' do
|
12
|
+
before { described_class.javascript_strategy = :truncation }
|
7
13
|
|
8
|
-
|
9
|
-
|
10
|
-
|
14
|
+
it 'forwards a `before_non_js` event to the selected strategy' do
|
15
|
+
expect(strategy).to receive(:before_non_js)
|
16
|
+
|
17
|
+
described_class.before_non_js
|
18
|
+
end
|
11
19
|
|
12
|
-
strategy
|
13
|
-
|
20
|
+
it 'forwards a `before_js` event to the selected strategy' do
|
21
|
+
expect(strategy).to receive(:before_js)
|
14
22
|
|
15
|
-
|
16
|
-
|
23
|
+
described_class.before_js
|
24
|
+
end
|
17
25
|
end
|
18
26
|
|
19
|
-
|
20
|
-
|
27
|
+
context 'when using an invalid pre-determined strategy' do
|
28
|
+
it 'raises an error if you use a non-understood strategy' do
|
29
|
+
expect { described_class.javascript_strategy = :invalid }
|
30
|
+
.to raise_error(Cucumber::Rails::Database::InvalidStrategy)
|
31
|
+
end
|
21
32
|
end
|
22
33
|
|
23
|
-
|
24
|
-
|
25
|
-
def before_js
|
26
|
-
# Anything
|
27
|
-
end
|
34
|
+
context 'when using a valid custom strategy' do
|
35
|
+
before { described_class.javascript_strategy = strategy_type }
|
28
36
|
|
29
|
-
|
30
|
-
|
37
|
+
let(:strategy_type) do
|
38
|
+
Class.new do
|
39
|
+
def before_js
|
40
|
+
# Anything
|
41
|
+
end
|
42
|
+
|
43
|
+
def before_non_js
|
44
|
+
# Likewise
|
45
|
+
end
|
31
46
|
end
|
32
47
|
end
|
33
48
|
|
34
|
-
|
35
|
-
|
49
|
+
it 'forwards a `before_non_js` event to the strategy' do
|
50
|
+
expect(strategy).to receive(:before_non_js)
|
36
51
|
|
37
|
-
|
38
|
-
expect { Cucumber::Rails::Database.javascript_strategy = InvalidStrategy }.to raise_error(ArgumentError)
|
52
|
+
described_class.before_non_js
|
39
53
|
end
|
40
54
|
|
41
|
-
it '
|
42
|
-
expect
|
43
|
-
end
|
55
|
+
it 'forwards a `before_js` event to the strategy' do
|
56
|
+
expect(strategy).to receive(:before_js)
|
44
57
|
|
45
|
-
|
46
|
-
|
47
|
-
|
58
|
+
described_class.before_js
|
59
|
+
end
|
60
|
+
end
|
48
61
|
|
49
|
-
|
50
|
-
|
62
|
+
context 'when using an invalid custom strategy' do
|
63
|
+
let(:invalid_strategy) { Class.new }
|
51
64
|
|
52
|
-
|
53
|
-
|
65
|
+
it 'raises an error if the strategy does not have a valid interface' do
|
66
|
+
expect { described_class.javascript_strategy = invalid_strategy }
|
67
|
+
.to raise_error(ArgumentError)
|
54
68
|
end
|
55
69
|
end
|
56
|
-
|
57
70
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Generators are not automatically loaded by Rails
|
4
|
+
require 'generators/cucumber/install_generator'
|
5
|
+
|
6
|
+
describe Cucumber::InstallGenerator do
|
7
|
+
# Tell the generator where to put its output (what it thinks of as Rails.root)
|
8
|
+
destination File.expand_path('../../../../tmp', __dir__)
|
9
|
+
|
10
|
+
before { prepare_destination }
|
11
|
+
|
12
|
+
let(:auto_generated_message) do
|
13
|
+
'# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.'
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'without arguments' do
|
17
|
+
before { run_generator }
|
18
|
+
|
19
|
+
describe 'config/cucumber.yml' do
|
20
|
+
subject { file('config/cucumber.yml') }
|
21
|
+
|
22
|
+
it { is_expected.to exist }
|
23
|
+
it { is_expected.to contain 'default: <%= std_opts %> features' }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe 'features/step_definitions folder' do
|
27
|
+
subject { file('features/step_definitions') }
|
28
|
+
|
29
|
+
it { is_expected.to exist }
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'features/support/env.rb' do
|
33
|
+
subject { file('features/support/env.rb') }
|
34
|
+
|
35
|
+
it { is_expected.to exist }
|
36
|
+
it { is_expected.to contain auto_generated_message }
|
37
|
+
it { is_expected.to contain "require 'cucumber/rails'" }
|
38
|
+
end
|
39
|
+
|
40
|
+
describe 'lib/tasks/cucumber.rake' do
|
41
|
+
subject { file('lib/tasks/cucumber.rake') }
|
42
|
+
|
43
|
+
it { is_expected.to exist }
|
44
|
+
it { is_expected.to contain auto_generated_message }
|
45
|
+
it { is_expected.to contain "task cucumber: 'cucumber:ok'" }
|
46
|
+
end
|
47
|
+
|
48
|
+
describe 'script/cucumber' do
|
49
|
+
subject { file('script/cucumber') }
|
50
|
+
|
51
|
+
it { is_expected.to exist }
|
52
|
+
it { is_expected.to contain 'load Cucumber::BINARY' }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,16 @@
|
|
1
|
-
|
2
|
-
require 'rspec/autorun'
|
1
|
+
# frozen_string_literal: true
|
3
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'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
require 'rspec/support/spec'
|
15
|
+
require 'rspec/rails'
|
4
16
|
require 'ammeter/init'
|