Sha256: b12ca6937ddc866de44b075f090534f18f157f6c954ede4a92c182e0578d5e38

Contents?: true

Size: 1.06 KB

Versions: 10

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

RSpec.describe Yaks::Format::CollectionJson do
  context 'with the plant collection resource' do
    include_context 'plant collection resource'

    subject { Yaks::Primitivize.create.call(described_class.new.call(resource)) }

    it { should deep_eql(load_json_fixture('plant_collection.collection')) }
  end

  context 'with a link without title' do
    let(:resource) {
      Yaks::Resource.new(
        attributes: {foo: 'fooval', bar: 'barval'},
        links: [Yaks::Resource::Link.new(rel: 'the_rel', uri: 'the_uri')]
      )
    }

    subject {
      Yaks::Primitivize.create.call(described_class.new.call(resource))
    }

    it 'should not render a name' do
      should deep_eql(
        "collection" => {
          "version" => "1.0",
          "items" => [
            {
              "data" => [
                { "name"=>"foo", "value"=>"fooval" },
                { "name"=>"bar", "value"=>"barval" }
              ],
              "links" => [{"rel"=>"the_rel", "href"=>"the_uri"}]
            }
          ]
        }
      )
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
yaks-0.7.6 spec/unit/yaks/format/collection_json_spec.rb
yaks-0.7.5 spec/unit/yaks/format/collection_json_spec.rb
yaks-0.7.4 spec/unit/yaks/format/collection_json_spec.rb
yaks-0.7.3 spec/unit/yaks/format/collection_json_spec.rb
yaks-0.7.2 spec/unit/yaks/format/collection_json_spec.rb
yaks-0.7.1 spec/unit/yaks/format/collection_json_spec.rb
yaks-0.7.0 spec/unit/yaks/format/collection_json_spec.rb
yaks-0.6.2 spec/unit/yaks/format/collection_json_spec.rb
yaks-0.6.1 spec/unit/yaks/format/collection_json_spec.rb
yaks-0.6.0 spec/unit/yaks/format/collection_json_spec.rb