spec/unit/key_spec.rb in rest_model-0.2.1 vs spec/unit/key_spec.rb in rest_model-0.2.3
- old
+ new
@@ -17,49 +17,49 @@
end
describe "#visible?" do
context "when :visible option was defined" do
context "and :if option was defined with false" do
- subject {RestModel::Property.new(name, {if: proc {false}, visible: true})}
+ subject {RestModel::Property.new(name, if: proc {false}, visible: true)}
it "return false even when visible is true" do
subject.visible?(nil).should be_false
end
end
context "and it evaluates to false" do
- subject {RestModel::Property.new(name, {visible: false})}
+ subject {RestModel::Property.new(name, visible: false)}
it "returns false" do
subject.visible?(nil).should be_false
end
end
context "and it evaluates to true" do
- subject {RestModel::Property.new(name, {visible: true})}
+ subject {RestModel::Property.new(name, visible: true)}
it "returns true" do
subject.visible?(nil).should be_true
end
end
context "with a proc" do
context "and it evaluates true" do
- subject {RestModel::Property.new(name, {visible: proc {true}})}
+ subject {RestModel::Property.new(name, visible: proc {true})}
it "returns true" do
subject.visible?("a").should be_true
end
end
context "and it evaluates false" do
- subject {RestModel::Property.new(name, {visible: proc {false}})}
+ subject {RestModel::Property.new(name, visible: proc {false})}
it "returns false" do
subject.visible?("a").should be_false
end
end
context "and it depends on resource instance" do
- subject {RestModel::Property.new(name, {visible: proc {show}})}
+ subject {RestModel::Property.new(name, visible: proc {show})}
it "uses it" do
resource = OpenStruct.new
resource.show = true
subject.visible?(resource).should be_true
@@ -70,32 +70,36 @@
end
describe "#present?" do
context "when :if option was defined with a proc" do
context "and it evaluates to false" do
- subject {RestModel::Property.new(name, {if: proc {false}})}
+ subject {RestModel::Property.new(name, if: proc {false})}
it "returns false" do
subject.present?(nil).should be_false
end
end
context "and it evaluates to true" do
- subject {RestModel::Property.new(name, {if: proc {true}})}
+ subject {RestModel::Property.new(name, if: proc {true})}
it "returns true" do
subject.present?(nil).should be_true
end
end
context "and it depends on resource instance" do
- subject {RestModel::Property.new(name, {if: proc {show}})}
+ subject {RestModel::Property.new(name, if: proc {show})}
it "uses it" do
resource = OpenStruct.new
resource.show = true
subject.present?(resource).should be_true
end
end
end
+ end
+
+ describe "#relation?" do
+ its(:relation?) {should be_false}
end
end