spec/singular_spec.rb in cistern-2.6.0 vs spec/singular_spec.rb in cistern-2.7.0
- old
+ new
@@ -4,10 +4,12 @@
before {
class Sample::Settings < Sample::Singular
attribute :name, type: :string
attribute :count, type: :number
+ belongs_to :entity, -> { cistern.settings(name: '1') }
+
def save
result = @@settings = attributes.merge(dirty_attributes)
merge_attributes(result)
end
@@ -28,9 +30,13 @@
it 'responds to #service' do
sample = service.settings.load
expect(sample.service).to eq(sample.cistern)
end
+ end
+
+ it 'allows associations' do
+ expect(service.settings.load.entity.name).to eq('1')
end
it 'reloads' do
singular = service.settings(count: 0)