Sha256: cee0e76d5f12361c396884e702a9de0ddab21faa12675c5d43efd73f9823651d
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
require 'spec_helper' describe Encore::Entity::Input::ExposedAttributes do shared_examples 'exposability' do before do spawn_object_class! end context 'with attribute name' do it { expect{ entity.assign_attributes(name: 'Art Vandelay') }.to raise_error(Encore::Entity::Input::InvalidAttributeError) } end context 'with column name' do before { entity.assign_attributes fullname: 'Art Vandelay' } it { expect(entity.object.name).to eql 'Art Vandelay' } end end let(:entity) { UserEntity.new } before do spawn_entity :UserEntity do expose :name, as: :fullname end end context 'with ActiveRecord model' do let(:spawn_object_class!) do spawn_model :User run_migration do create_table(:users, force: true) do |t| t.string :name t.timestamps end end end it_has_behavior 'exposability' end context 'with OpenStruct structure' do let(:spawn_object_class!) { spawn_struct :User } it_has_behavior 'exposability' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
encore-0.0.3 | spec/encore/entity/input/exposed_attributes_spec.rb |