Sha256: bce78b6c9e17fd10a49bcd3020b3f78adfb0637e669a4d92be441dd5cbebb329
Contents?: true
Size: 1014 Bytes
Versions: 2
Compression:
Stored size: 1014 Bytes
Contents
require 'spec_helper' describe GrooveHQ::Resource do let(:client) { GrooveHQ::Client.new("phantogram") } context "#data" do it "returns empty data for invalid input" do resource = GrooveHQ::ResourceCollection.new(client, "") expect(resource.count).to eql(0) end it "parses data correctly" do data = { tickets: [ { name: "When I am small" } ] } resource = GrooveHQ::ResourceCollection.new(client, data) expect(resource.first.name).to eql "When I am small" end end context "#rels" do it "parses relations correctly" do data = { tickets: [], meta: { pagination: { current_page: 1, total_pages: 23, total_count: 23, next_page: "http://api.groovehq.dev/v1/tickets?page=2" } } } resource = GrooveHQ::ResourceCollection.new(client, data) expect(resource.rels[:next]).to be_instance_of(GrooveHQ::Relation) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
groovehq-1.0.4 | spec/groovehq/resource_collection_spec.rb |
groovehq-1.0.3 | spec/groovehq/resource_collection_spec.rb |