summaryrefslogtreecommitdiff
path: root/spec/unit/property/state_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/property/state_spec.rb')
-rw-r--r--spec/unit/property/state_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/unit/property/state_spec.rb b/spec/unit/property/state_spec.rb
index bf2de178c9..e7fee0387f 100644
--- a/spec/unit/property/state_spec.rb
+++ b/spec/unit/property/state_spec.rb
@@ -369,6 +369,21 @@ describe "Chef::Resource#identity and #state" do
end
end
+ context "When state_properties happens before properties are declared" do
+ before do
+ resource_class.class_eval do
+ state_properties :x
+ property :x
+ end
+ end
+ it "the property works and is in state_properties" do
+ expect(resource_class.state_properties).to include(resource_class.properties[:x])
+ resource.x = 1
+ expect(resource.x).to eq 1
+ expect(resource.state_for_resource_reporter).to eq(x: 1)
+ end
+ end
+
with_property ":x, Integer, identity: true" do
it "state_properties(:x) leaves the property in desired_state" do
resource_class.state_properties(:x)