-
-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test Cleanup: Refactor tests to use helper (#1188)
Use `with_test_suite` helper to clean up existing test setup. This was more relevant when exploring #1156, but is still helpful for generators that are test suite agnostic. Also cleans up test setup by using a `file_fixture` that was missed in #1183
- Loading branch information
1 parent
08be1dd
commit c694b2a
Showing
4 changed files
with
93 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require "spec_helper" | ||
ENV["RAILS_ENV"] ||= "test" | ||
require_relative "../config/environment" | ||
|
||
abort("The Rails environment is running in production mode!") if Rails.env.production? | ||
require "rspec/rails" | ||
|
||
# Rails.root.glob("spec/support/**/*.rb").sort.each { |f| require f } | ||
|
||
begin | ||
ActiveRecord::Migration.maintain_test_schema! | ||
rescue ActiveRecord::PendingMigrationError => e | ||
abort e.to_s.strip | ||
end | ||
RSpec.configure do |config| | ||
config.fixture_path = "#{::Rails.root}/spec/fixtures" | ||
config.use_transactional_fixtures = true | ||
config.infer_spec_type_from_file_location! | ||
config.filter_rails_from_backtrace! | ||
end | ||
Dir[Rails.root.join("spec/support/**/*.rb")].sort.each { |file| require file } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters