Skip to content

Commit

Permalink
Fix issue where database wasn't loading the database folder
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-hill committed Oct 11, 2023
1 parent 66e27b9 commit 535b2ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
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

0 comments on commit 535b2ab

Please sign in to comment.