spec/context_spec.rb in parsable-0.1.1 vs spec/context_spec.rb in parsable-0.1.2
- old
+ new
@@ -23,12 +23,20 @@
expect(context.instance_variable_get('@variables')[:test_object].test_attribute).to eql("test_value")
end
end
describe '#read' do
- it "gets value for object.attribute" do
- context.instance_variable_get('@variables')[:test_object] = OpenStruct.new(:fruit => 'bananas')
- expect(context.read('test_object', 'fruit')).to eql("bananas")
+ context 'object_key exists' do
+ it "gets value for object.attribute" do
+ context.instance_variable_get('@variables')[:test_object] = OpenStruct.new(:fruit => 'bananas')
+ expect(context.read('test_object', 'fruit')).to eql("bananas")
+ end
+ end
+
+ context 'no object_key' do
+ it "is nil" do
+ expect(context.read('not_exists', 'fruit')).to be_nil
+ end
end
end
end