spec/facemock/database/authorization_code.rb in facemock-0.0.7 vs spec/facemock/database/authorization_code.rb in facemock-0.0.8

- old
+ new

@@ -1,8 +1,8 @@ require 'spec_helper' -describe Facemock::Database::AuthorizationCode do +describe Facemock::AuthorizationCode do include TableHelper let(:table_name) { :authorization_codes } let(:column_names) { [ :id, :string, :user_id, :created_at ] } let(:children) { [] } @@ -14,33 +14,33 @@ let(:options) { { id: id, string: string, user_id: user_id, created_at: created_at } } after { remove_dynamically_defined_all_method } describe '::TABLE_NAME' do - subject { Facemock::Database::AuthorizationCode::TABLE_NAME } + subject { Facemock::AuthorizationCode::TABLE_NAME } it { is_expected.to eq table_name } end describe '::COLUMN_NAMES' do - subject { Facemock::Database::AuthorizationCode::COLUMN_NAMES } + subject { Facemock::AuthorizationCode::COLUMN_NAMES } it { is_expected.to eq column_names } end describe '::CHILDREN' do - subject { Facemock::Database::AuthorizationCode::CHILDREN } + subject { Facemock::AuthorizationCode::CHILDREN } it { is_expected.to eq children } end describe '#initialize' do context 'without option' do - subject { Facemock::Database::AuthorizationCode.new } - it { is_expected.to be_kind_of Facemock::Database::AuthorizationCode } + subject { Facemock::AuthorizationCode.new } + it { is_expected.to be_kind_of Facemock::AuthorizationCode } context 'then attributes' do it 'should be nil except string' do column_names.each do |column_name| - value = Facemock::Database::AuthorizationCode.new.send(column_name) + value = Facemock::AuthorizationCode.new.send(column_name) if column_name == :string expect(value).not_to be_nil else expect(value).to be_nil end @@ -48,26 +48,26 @@ end end context 'then string' do it 'should be random string' do - string1 = Facemock::Database::AuthorizationCode.new.string - string2 = Facemock::Database::AuthorizationCode.new.string + string1 = Facemock::AuthorizationCode.new.string + string2 = Facemock::AuthorizationCode.new.string expect(string1).to be_kind_of String expect(string1.size).to be < 256 expect(string1).not_to eq string2 end end end context 'with all options' do - subject { Facemock::Database::AuthorizationCode.new(options) } - it { is_expected.to be_kind_of Facemock::Database::AuthorizationCode } + subject { Facemock::AuthorizationCode.new(options) } + it { is_expected.to be_kind_of Facemock::AuthorizationCode } context 'then attributes' do it 'should set specified value by option' do column_names.each do |column_name| - value = Facemock::Database::AuthorizationCode.new(options).send(column_name) + value = Facemock::AuthorizationCode.new(options).send(column_name) expect(value).to eq options[column_name] end end end end