Sha256: 29294c063536ac6af136e7965d8d85136b7ac06b8c449525c4a150c2b311fe11

Contents?: true

Size: 1.51 KB

Versions: 5

Compression:

Stored size: 1.51 KB

Contents

require 'spec_helper'

describe CurationConcerns::RasterWorksController, type: :controller do
  let(:user) { FactoryGirl.create(:user) }
  let(:raster_work) { FactoryGirl.create(:raster_work, user: user, title: ['Raster Work Title']) }
  let(:reloaded) { raster_work.reload }

  describe "#create" do
    let(:user) { FactoryGirl.create(:admin) }
    before do
      sign_in user
    end
    context "when given a parent" do
      let(:parent) { FactoryGirl.create(:image_work, user: user) }
      let(:raster_work_attributes) do
        FactoryGirl.attributes_for(:raster_work)
      end
      it "creates and indexes its parent" do
        post :create, raster_work: raster_work_attributes, parent_id: parent.id
        solr_document = ActiveFedora::SolrService.query("id:#{assigns[:curation_concern].id}").first

        expect(solr_document["ordered_by_ssim"]).to eq [parent.id]
      end
    end
  end

  describe "#show" do
    before do
      sign_in user
    end
    context "when there's a parent image work" do
      it "is a success" do
        raster = FactoryGirl.create(:raster_work, user: user)
        image = FactoryGirl.create(:image_work, user: user)
        image.ordered_members << raster
        image.save
        raster.update_index

        get :show, id: raster.id
        expect(response).to be_success
      end
    end
  end

  describe "#show_presenter" do
    it "is a raster work show presenter" do
      expect(described_class.new.show_presenter).to eq(GeoConcerns::RasterWorkShowPresenter)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
geo_concerns-0.0.5 spec/controllers/raster_works_controller_spec.rb
geo_concerns-0.0.4 spec/controllers/raster_works_controller_spec.rb
geo_concerns-0.0.3 spec/controllers/raster_works_controller_spec.rb
geo_concerns-0.0.2 spec/controllers/raster_works_controller_spec.rb
geo_concerns-0.0.1 spec/controllers/raster_works_controller_spec.rb