Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
bliof-fc committed Apr 2, 2020
1 parent 04648b2 commit 7f95f8b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
2 changes: 1 addition & 1 deletion spec/dummy/config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ development:

test:
<<: *default
database: db/test.sqlite3
database: <%= ENV['FC_VAULT_RAILS_DUMMY_DATABASE_PATH'] || 'db/test.sqlite3' %>
17 changes: 17 additions & 0 deletions spec/integration/rails_db_create_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# encoding: utf-8

require "spec_helper"

RSpec.describe './bin/rake db:create' do
it "works == the code doesn't need a database to load" do
db_file = File.join(dummy_root, 'db/rails_db_create_spec.sqlite3')

File.delete(db_file) if File.exist?(db_file)

result = `RAILS_ENV=test FC_VAULT_RAILS_DUMMY_DATABASE_PATH="db/rails_db_create_spec.sqlite3" #{dummy_root}/bin/rake db:create`

expect(File.exist?(db_file)).to eq(true)

puts result
end
end
14 changes: 13 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "vault/rails"

require "vault/rails"
require "rspec"

module PathHelpers
def project_root
@project_root ||= File.expand_path('../..', __FILE__)
end

def dummy_root
File.join(project_root, 'spec', 'dummy')
end
end

RSpec.configure do |config|
config.include PathHelpers

# Prohibit using the should syntax
config.expect_with :rspec do |spec|
spec.syntax = :expect
Expand Down

0 comments on commit 7f95f8b

Please sign in to comment.