Skip to content

Commit

Permalink
CLI: integration tests for hanami db create
Browse files Browse the repository at this point in the history
  • Loading branch information
jodosha committed Sep 29, 2016
1 parent ad5f999 commit e05fc7a
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions spec/integration/cli/db/create_spec.rb
@@ -0,0 +1,28 @@
RSpec.describe "hanami db", type: :cli do
describe "create" do
it "creates database" do
project = "bookshelf_db_create"

with_project(project, database: :sqlite) do
hanami "db create"

db = Pathname.new("db").join("#{project}_development.sqlite").to_s
expect(db).to be_an_existing_file
end
end

it "doesn't create in production" do
project = "bookshelf_db_create_production"

with_project(project, database: :sqlite) do
RSpec::Support::Env['HANAMI_ENV'] = 'production'
hanami "db create"

expect(exitstatus).to eq(1)

db = Pathname.new("db").join("#{project}.sqlite").to_s
expect(db).to_not be_an_existing_file
end
end
end
end

0 comments on commit e05fc7a

Please sign in to comment.