Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/tidy up deps #574

Merged
merged 5 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
CUCUMBER_RAILS_VERSION =
Gem::Specification.load("#{File.dirname(__FILE__)}/cucumber-rails.gemspec").version.version
require 'rubygems'
require 'bundler'
require 'bundler/setup'
require 'appraisal'
require 'rake/clean'
require 'pathname'
Bundler::GemHelper.install_tasks

$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/lib")
Dir["#{File.dirname(__FILE__)}/dev_tasks/*.rake"].sort.each { |ext| load ext }
Expand Down
4 changes: 1 addition & 3 deletions cucumber-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ Gem::Specification.new do |s|
s.add_runtime_dependency('railties', '>= 5.2', '< 8')

# Main development dependencies
s.add_development_dependency('ammeter', '>= 1.1.4')
s.add_development_dependency('ammeter', '>= 1.1.5')
s.add_development_dependency('appraisal', '>= 2.4.1', '< 3')
s.add_development_dependency('aruba', '>= 1.1.2', '< 3')
s.add_development_dependency('bundler', '>= 1.17')
s.add_development_dependency('database_cleaner', '>= 1.8', '< 3.0')
s.add_development_dependency('rails', '>= 5.2', '< 8')
s.add_development_dependency('rake', '>= 12.0')
Expand All @@ -38,7 +37,6 @@ Gem::Specification.new do |s|
s.add_development_dependency('rubocop-packaging', '~> 0.5.1')
s.add_development_dependency('rubocop-performance', '~> 1.13.3')
s.add_development_dependency('rubocop-rspec', '~> 2.10.0')
s.add_development_dependency('sqlite3', '~> 1.3')

# For Documentation:
s.add_development_dependency('yard', '~> 0.9.10')
Expand Down
6 changes: 6 additions & 0 deletions lib/cucumber/rails/database.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# frozen_string_literal: true

require_relative 'database/strategy'
require_relative 'database/deletion_strategy'
require_relative 'database/null_strategy'
require_relative 'database/shared_connection_strategy'
require_relative 'database/truncation_strategy'

module Cucumber
module Rails
module Database
Expand Down
14 changes: 3 additions & 11 deletions spec/cucumber/rails/database_spec.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# frozen_string_literal: true

require 'database_cleaner'
require 'cucumber/rails/database/strategy'
require 'cucumber/rails/database/deletion_strategy'
require 'cucumber/rails/database/null_strategy'
require 'cucumber/rails/database/shared_connection_strategy'
require 'cucumber/rails/database/truncation_strategy'
require 'cucumber/rails/database'

describe Cucumber::Rails::Database do
Expand All @@ -29,15 +24,13 @@
it 'raises an error on `before_js` if no DatabaseCleaner cleaners exist' do
allow(DatabaseCleaner).to receive(:cleaners).and_return({})

expect { described_class.before_js }
.to raise_error(/No DatabaseCleaner strategies found/)
expect { described_class.before_js }.to raise_error(/No DatabaseCleaner strategies found/)
end
end

context 'when using an invalid pre-determined strategy' do
it 'raises an error if you use a non-understood strategy' do
expect { described_class.javascript_strategy = :invalid }
.to raise_error(Cucumber::Rails::Database::InvalidStrategy)
expect { described_class.javascript_strategy = :invalid }.to raise_error(Cucumber::Rails::Database::InvalidStrategy)
end
end

Expand Down Expand Up @@ -73,8 +66,7 @@ def before_non_js
let(:invalid_strategy) { Class.new }

it 'raises an error if the strategy does not have a valid interface' do
expect { described_class.javascript_strategy = invalid_strategy }
.to raise_error(ArgumentError)
expect { described_class.javascript_strategy = invalid_strategy }.to raise_error(ArgumentError)
end
end
end
2 changes: 0 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

require 'rspec/rails/fixture_support'
require 'rails/all'

ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
Expand All @@ -12,5 +11,4 @@ class Application < ::Rails::Application
end

require 'rspec/support/spec'
require 'rspec/rails'
require 'ammeter/init'