Sha256: 06f030dabf144fc38b7c3ed1d3bcadb7f5c9ba5006c9dcd3e98e98135ab640d6

Contents?: true

Size: 829 Bytes

Versions: 9

Compression:

Stored size: 829 Bytes

Contents

require 'spec_helper'

describe 'hyrax/base/show.json.jbuilder' do
  let(:curation_concern) { create(:generic_work) }

  before do
    allow(curation_concern).to receive(:etag).and_return('W/"87f79d2244ded4239ad1f0e822c8429b1e72b66c"')
    assign(:curation_concern, curation_concern)
    render
  end

  it "renders json of the curation_concern" do
    json = JSON.parse(rendered)
    expect(json['id']).to eq curation_concern.id
    expect(json['title']).to match_array curation_concern.title
    expected_fields = curation_concern.class.fields.select { |f| ![:has_model, :create_date].include? f }
    expected_fields << :date_created
    expected_fields.each do |field_symbol|
      expect(json).to have_key(field_symbol.to_s)
    end
    expect(json['version']).to eq 'W/"87f79d2244ded4239ad1f0e822c8429b1e72b66c"'
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hyrax-1.1.1 spec/views/hyrax/base/show.json.jbuilder_spec.rb
hyrax-1.1.0 spec/views/hyrax/base/show.json.jbuilder_spec.rb
hyrax-1.0.5 spec/views/hyrax/base/show.json.jbuilder_spec.rb
hyrax-1.0.4 spec/views/hyrax/base/show.json.jbuilder_spec.rb
hyrax-1.0.3 spec/views/hyrax/base/show.json.jbuilder_spec.rb
hyrax-1.0.2 spec/views/hyrax/base/show.json.jbuilder_spec.rb
hyrax-1.0.1 spec/views/hyrax/base/show.json.jbuilder_spec.rb
hyrax-1.0.0.rc2 spec/views/hyrax/base/show.json.jbuilder_spec.rb
hyrax-1.0.0.rc1 spec/views/hyrax/base/show.json.jbuilder_spec.rb