cucumber-rails 2.0.0 → 2.4.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 +135 -18
- data/CONTRIBUTING.md +14 -2
- data/LICENSE +1 -1
- data/README.md +5 -24
- data/lib/cucumber/rails.rb +11 -13
- 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/database.rb +7 -57
- data/lib/cucumber/rails/database/deletion_strategy.rb +13 -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/hooks/database_cleaner.rb +9 -3
- data/lib/cucumber/rails/hooks/mail.rb +1 -1
- data/lib/cucumber/rails/world.rb +2 -2
- data/lib/generators/cucumber/install_generator.rb +10 -13
- data/lib/generators/cucumber/templates/config/cucumber.yml.erb +3 -3
- data/lib/generators/cucumber/templates/tasks/cucumber.rake.erb +5 -0
- metadata +92 -99
- data/.github/ISSUE_TEMPLATE.md +0 -52
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -42
- data/.gitignore +0 -14
- data/.rspec +0 -4
- data/.rubocop.yml +0 -33
- 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.rake +0 -36
- 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/features/allow_rescue.feature +0 -65
- data/features/annotations.feature +0 -20
- data/features/capybara_javascript_drivers.feature +0 -82
- data/features/choose_javascript_database_strategy.feature +0 -125
- data/features/configuration.feature +0 -48
- data/features/database_cleaner.feature +0 -44
- data/features/disable_automatic_database_cleaning.feature +0 -49
- data/features/emulate_javascript.feature +0 -109
- data/features/install_cucumber_rails.feature +0 -14
- data/features/no_database.feature +0 -61
- data/features/raising_errors.feature +0 -22
- data/features/rerun_profile.feature +0 -47
- data/features/rest_api.feature +0 -47
- data/features/step_definitions/cucumber_rails_steps.rb +0 -69
- data/features/support/aruba.rb +0 -5
- data/features/support/cucumber_rails_helper.rb +0 -76
- data/features/support/env.rb +0 -6
- data/features/support/hooks.rb +0 -8
- 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 -55
- data/spec/spec_helper.rb +0 -16
data/features/support/aruba.rb
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module CucumberRailsHelper
|
4
|
-
def rails_new(options = {})
|
5
|
-
options[:name] ||= 'test_app'
|
6
|
-
command_result =
|
7
|
-
run_command "bundle exec rails new #{options[:name]} --skip-bundle --skip-test-unit --skip-spring --skip-bootsnap #{options[:args]}"
|
8
|
-
expect(command_result).to have_output(/README/)
|
9
|
-
expect(last_command_started).to be_successfully_executed
|
10
|
-
cd options[:name]
|
11
|
-
delete_environment_variable 'RUBYOPT'
|
12
|
-
delete_environment_variable 'BUNDLE_BIN_PATH'
|
13
|
-
delete_environment_variable 'BUNDLE_GEMFILE'
|
14
|
-
end
|
15
|
-
|
16
|
-
def install_cucumber_rails(*options)
|
17
|
-
add_conditional_gems(options)
|
18
|
-
|
19
|
-
gem 'selenium-webdriver', '~> 3.11', group: :test
|
20
|
-
gem 'rspec-expectations', '~> 3.7', group: :test
|
21
|
-
gem 'database_cleaner', '>= 1.1', group: :test unless options.include?(:no_database_cleaner)
|
22
|
-
gem 'factory_bot', '>= 3.2', group: :test unless options.include?(:no_factory_bot)
|
23
|
-
|
24
|
-
run_command_and_stop 'bundle install'
|
25
|
-
run_command_and_stop 'bundle exec rails webpacker:install' if rails6?
|
26
|
-
run_command_and_stop 'bundle exec rails generate cucumber:install'
|
27
|
-
end
|
28
|
-
|
29
|
-
def gem(name, *args)
|
30
|
-
options = args.last.is_a?(Hash) ? args.pop : {}
|
31
|
-
|
32
|
-
parts = ["'#{name}'"]
|
33
|
-
parts << args.map(&:inspect) if args.any?
|
34
|
-
parts << options.inspect[1..-2] if options.any?
|
35
|
-
|
36
|
-
line = "gem #{parts.join(', ')}\n"
|
37
|
-
|
38
|
-
gem_regexp = /gem ["']#{name}["'].*$/
|
39
|
-
gemfile_content = File.read(expand_path('Gemfile'))
|
40
|
-
|
41
|
-
if gemfile_content =~ gem_regexp
|
42
|
-
gemfile_content.gsub!(gem_regexp, line)
|
43
|
-
overwrite_file('Gemfile', gemfile_content)
|
44
|
-
else
|
45
|
-
append_to_file('Gemfile', line)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
private
|
50
|
-
|
51
|
-
def rails6?
|
52
|
-
`bundle exec rails -v`.start_with?('Rails 6')
|
53
|
-
end
|
54
|
-
|
55
|
-
def add_conditional_gems(options)
|
56
|
-
if options.include?(:not_in_test_group)
|
57
|
-
gem 'cucumber-rails', path: File.expand_path('.').to_s
|
58
|
-
else
|
59
|
-
gem 'cucumber-rails', group: :test, require: false, path: File.expand_path('.').to_s
|
60
|
-
end
|
61
|
-
|
62
|
-
if rails6?
|
63
|
-
gem 'sqlite3', '~> 1.4'
|
64
|
-
else
|
65
|
-
gem 'sqlite3', '~> 1.3.13'
|
66
|
-
end
|
67
|
-
|
68
|
-
if RUBY_VERSION < '2.4.0'
|
69
|
-
gem 'capybara', '< 3.16.0', group: :test
|
70
|
-
else
|
71
|
-
gem 'capybara', group: :test
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
World(CucumberRailsHelper)
|
data/features/support/env.rb
DELETED
data/features/support/hooks.rb
DELETED
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)
|
15
|
-
described_class.before_non_js
|
16
|
-
|
17
|
-
expect(strategy).to receive(:before_js)
|
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
|
-
context '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 does not have a valid interface' do
|
42
|
-
expect { described_class.javascript_strategy = InvalidStrategy }
|
43
|
-
.to raise_error(ArgumentError)
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'accepts the strategy if it has a valid interface' do
|
47
|
-
expect { described_class.javascript_strategy = ValidStrategy }
|
48
|
-
.not_to raise_error
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'forwards events to the strategy' do
|
52
|
-
described_class.javascript_strategy = ValidStrategy
|
53
|
-
|
54
|
-
expect(strategy).to receive(:before_non_js)
|
55
|
-
described_class.before_non_js
|
56
|
-
|
57
|
-
expect(strategy).to receive(:before_js)
|
58
|
-
described_class.before_js
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
@@ -1,55 +0,0 @@
|
|
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
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'
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
require 'rspec/support/spec'
|
15
|
-
require 'rspec/rails'
|
16
|
-
require 'ammeter/init'
|