spec/facemock/database_spec.rb in facemock-0.0.6 vs spec/facemock/database_spec.rb in facemock-0.0.7

- old
+ new

@@ -2,11 +2,11 @@ describe Facemock::Database do let(:db_name) { ".test" } let(:default_db_name) { "facemock" } let(:adapter) { "sqlite3" } - let(:table_names) { [:applications, :users, :permissions] } + let(:table_names) { [:applications, :users, :permissions, :authorization_codes] } let(:db_directory) { File.expand_path("../../../db", __FILE__) } let(:db_filepath) { File.join(db_directory, "#{db_name}.#{adapter}") } describe '::ADAPTER' do subject { Facemock::Database::ADAPTER } @@ -26,26 +26,10 @@ describe '::DEFAULT_DB_NAMES' do subject { Facemock::Database::DEFAULT_DB_NAME } it { is_expected.to eq default_db_name } end - it 'should have a table class' do - expect(Facemock::Database::Table).to be_truthy - end - - it 'should have a application class' do - expect(Facemock::Database::Application).to be_truthy - end - - it 'should have a user class' do - expect(Facemock::Database::User).to be_truthy - end - - it 'should have a permission class' do - expect(Facemock::Database::Permission).to be_truthy - end - describe '#initialize' do before do allow_any_instance_of(Facemock::Database).to receive(:connect) { true } allow_any_instance_of(Facemock::Database).to receive(:create_tables) { true } end @@ -263,8 +247,15 @@ end end end context 'when drop tables' do + before { @database.drop_tables } + + it 'should not exist any tables' do + table_names.each do |table_name| + expect(@database.table_exists?(table_name)).to eq false + end + end end end end