Sha256: 61ff3a89b8729f497926c2ca5f35ecfc80d8fa616d4ea76485929d0548927930
Contents?: true
Size: 1.54 KB
Versions: 2
Compression:
Stored size: 1.54 KB
Contents
require 'spec_helper' describe Facemock::Database::Permission do let(:table_name) { :permissions } let(:column_names) { [ :id, :name, :user_id, :created_at ] } let(:id) { 1 } let(:name) { "read_stream" } let(:user_id) { 1 } let(:created_at) { Time.now } let(:options) { { id: id, name: name, user_id: user_id, created_at: created_at } } describe '::TABLE_NAME' do subject { Facemock::Database::Permission::TABLE_NAME } it { is_expected.to eq table_name } end describe '::COLUMN_NAMES' do subject { Facemock::Database::Permission::COLUMN_NAMES } it { is_expected.to eq column_names } end describe '#initialize' do context 'without option' do subject { Facemock::Database::Permission.new } it { is_expected.to be_kind_of Facemock::Database::Permission } context 'then attributes' do it 'should be nil' do column_names.each do |column_name| value = Facemock::Database::Permission.new.send(column_name) expect(value).to be_nil end end end end context 'with all options' do subject { Facemock::Database::Permission.new(options) } it { is_expected.to be_kind_of Facemock::Database::Permission } context 'then attributes' do it 'should set specified value by option' do column_names.each do |column_name| value = Facemock::Database::Permission.new(options).send(column_name) expect(value).to eq options[column_name] end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
facemock-0.0.6 | spec/facemock/database/permission_spec.rb |
facemock-0.0.5 | spec/facemock/database/permission_spec.rb |