Sha256: 70b552ff4d3a4dbce2b692ec4b21e41e85ca9de29d27f1f8944bdc0e8b3a07d5
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true require 'spec_helper' # Test-dummy class to exercise `TestAttributeContainer`. class TestClass extend Repository::Support::TestAttributeContainer init_empty_attribute_container end describe Repository::Support::TestAttributeContainer do let(:obj) { TestClass.new } it 'has reader and writer methods for :attributes' do expect(obj).to respond_to :attributes expect(obj).to respond_to :attributes= end it 'supports mass initialisation of attributes' do obj.attributes = { thing: true, the_answer: 42 } expect(obj.thing).to be true expect(obj.the_answer).to be 42 end description = 'has new named-attribute accessors added when the name is' \ ' added to :attributes' it description do expect { obj.thing }.to raise_error NoMethodError expect { obj.thing = false }.to raise_error NoMethodError obj.attributes[:thing] = 'something' expect { obj.thing }.not_to raise_error expect { obj.thing = 'something else' }.not_to raise_error expect(obj.thing).to eq 'something else' end end # describe TestClass
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
repository-support-0.1.3 | spec/repository/support/test_attribute_container_spec.rb |
repository-support-0.1.1 | spec/repository/support/test_attribute_container_spec.rb |