diff --git a/lib/dm-core/resource/state.rb b/lib/dm-core/resource/state.rb index bb0f2603..1c5102c1 100644 --- a/lib/dm-core/resource/state.rb +++ b/lib/dm-core/resource/state.rb @@ -3,6 +3,7 @@ module Resource # the state of the resource (abstract) class State + attr_reader :resource def initialize(resource) @resource = resource @@ -45,8 +46,6 @@ def hash private - attr_reader :resource - def model @model ||= resource.model end diff --git a/spec/semipublic/resource/state_spec.rb b/spec/semipublic/resource/state_spec.rb index 6dfee94a..d320f27e 100644 --- a/spec/semipublic/resource/state_spec.rb +++ b/spec/semipublic/resource/state_spec.rb @@ -178,6 +178,14 @@ class ::Author end end + describe '#resource' do + subject { @state.resource } + + it 'should return the resource' do + should equal(@resource) + end + end + describe '#set' do subject { @state.set(@key, @value) }