Sha256: 0ca5353b3bddc7a92e21e21385a959fd9f7093580032eeea3df2e6ee96c42c0c
Contents?: true
Size: 1.9 KB
Versions: 2
Compression:
Stored size: 1.9 KB
Contents
require 'spec_helper' describe Storey::BuildsDumpCommand do describe '.execute' do subject do described_class.execute(options) end let(:options) do { structure_only: true, file: 'myfile.sql', schemas: 'public', database: 'mydb' } end context 'when structure_only: true' do before do options.merge!( database: 'mydb', structure_only: true ) end it { should include('--schema-only') } end context 'when structure_only: false' do before do options.merge!( database: 'mydb', structure_only: false ) end it { should_not include('--schema-only') } end it { should include('--no-privileges') } it { should include('--no-owner') } context 'file: is "/path/to/file name.sql"' do let(:options) do { database: 'mydb', file: '/path/to/file name.sql' } end it { should include('/path/to/file\ name.sql') } end context "schemas: 'public'" do before do options.merge!( database: 'mydb', schemas: %q(public) ) end it { should include('--schema=public') } end context "schemas: '$user','public'" do before do options.merge!( database: 'mydb', schemas: %q($user,public) ) end it { should include('--schema=\$user --schema=public') } end it { should match(/mydb$/)} context 'no database is given' do let(:options) { {} } it 'should fail' do expect{subject}.to raise_error(ArgumentError, 'database must be supplied') end end it 'should build a valid full executable command' do expect(subject). to eq("pg_dump --schema-only --no-privileges --no-owner --file=myfile.sql --schema=public mydb") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
storey-1.0.0 | spec/storey/builds_dump_command_spec.rb |
storey-0.6.0 | spec/storey/builds_dump_command_spec.rb |