spec/lib/frenetic/resource_spec.rb in frenetic-0.0.11 vs spec/lib/frenetic/resource_spec.rb in frenetic-0.0.12
- old
+ new
@@ -7,11 +7,11 @@
let(:other_resource) { MyOtherResource.new }
let(:description_stub) do
Frenetic::HalJson::ResponseWrapper.new('resources' => {
'schema' => {
- 'my_resource' => { 'properties' => { 'foo' => 'string' } },
+ 'my_resource' => { 'properties' => { 'foo' => 'string', 'baz' => 'integer' } },
'my_other_resource' => { 'properties' => { 'bar' => 'integer' } }
} } )
end
before do
@@ -22,9 +22,22 @@
stub_const 'MyResource', Class.new(described_class)
stub_const 'MyOtherResource', Class.new(described_class)
end
subject { resource }
+
+ describe '#attributes' do
+ subject { resource.attributes }
+
+ it { should include 'foo' => nil }
+ it { should include 'baz' => nil }
+ end
+
+ describe '#to_hash' do
+ subject { resource.to_hash }
+
+ it { should == resource.attributes }
+ end
context "created from a Hash" do
let(:resource) { MyResource.new( foo: 'bar' ) }
it { should respond_to(:foo) }
\ No newline at end of file