Skip to content

Commit

Permalink
Improves tests by removing all db files before as well
Browse files Browse the repository at this point in the history
  • Loading branch information
thisismydesign committed May 14, 2018
1 parent f5e14b4 commit 0ccf32c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions spec/dotenv_rails_db_tasks_fix_spec.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@

RSpec.describe DotenvRailsDbTasksFix do
it "has a version number" do
expect(DotenvRailsDbTasksFix::VERSION).not_to be nil
end

describe "rake db:create" do
def remove_db_files
Dir.glob(Pathname.new(RSPEC_ROOT).join("example_project", "db", "*.sqlite3")) { |file| FileUtils.rm(file) }
end

before do
remove_db_files
end

after do
FileUtils.rm(Pathname.new(RSPEC_ROOT).join("example_project", "db", "development.sqlite3"))
FileUtils.rm(Pathname.new(RSPEC_ROOT).join("example_project", "db", "test.sqlite3"))
remove_db_files
end

it "outputs DB creation message for 'development' and 'test' DBs" do
Expand Down

0 comments on commit 0ccf32c

Please sign in to comment.