Sha256: 2626ba231bce0242b274fd3272559ddbae3758f1c79db98d083b3b39b4a98e7b
Contents?: true
Size: 892 Bytes
Versions: 2
Compression:
Stored size: 892 Bytes
Contents
require 'spec_helper' describe 'Cistern::Singular' do class Settings < Sample::Singular attribute :name, type: :string attribute :count, type: :number def save result = @@settings = attributes.merge(dirty_attributes) merge_attributes(result) end def get settings = @@settings ||= {} settings[:count] ||= 0 settings[:count] += 1 merge_attributes(settings) end end let!(:service) { Sample.new } describe 'deprecation', :deprecated do it 'responds to #service' do sample = service.settings.load expect(sample.service).to eq(sample.cistern) end end it 'reloads' do singular = service.settings(count: 0) expect { singular.reload }.to change(singular, :count).by(1) end it 'updates' do service.settings.update(name: 6) expect(service.settings.load.name).to eq('6') end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cistern-2.4.1 | spec/singular_spec.rb |
cistern-2.4.0 | spec/singular_spec.rb |