Sha256: 5127bf0cacc2bec265487340a7ee40c5e72dfc4cd0cd962cfd65581dcec8bd33

Contents?: true

Size: 1.43 KB

Versions: 4

Compression:

Stored size: 1.43 KB

Contents

require 'spec_helper'

describe CurationConcerns::ImageWorksController, type: :controller do
  let(:user) { FactoryGirl.create(:user) }
  let(:image_work) { FactoryGirl.create(:image_work, user: user, title: ['Image Work Title']) }
  let!(:sipity_entity) do
    create(:sipity_entity, proxy_for_global_id: image_work.to_global_id.to_s)
  end

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

  describe '#form_class' do
    it 'returns the raster work form class' do
      expect(described_class.new.form_class). to eq(CurationConcerns::ImageWorkForm)
    end
  end

  describe "#show" do
    before do
      sign_in user
    end
    context "with an existing image work" do
      it "is a success" do
        get :show, params: { id: image_work.id }
        expect(response).to be_success
      end
    end
  end

  describe '#create' do
    let(:user) { FactoryGirl.create(:admin) }
    before do
      sign_in user
    end

    context 'when create is successful' do
      let(:work) { FactoryGirl.create(:image_work, user: user) }
      it 'creates an image work' do
        allow(controller).to receive(:curation_concern).and_return(work)
        post :create, params: { image_work: { title: ['a title'] } }
        expect(response).to redirect_to main_app.curation_concerns_image_work_path(work)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
geo_concerns-0.3.4 spec/controllers/image_works_controller_spec.rb
geo_concerns-0.3.3 spec/controllers/image_works_controller_spec.rb
geo_concerns-0.3.2 spec/controllers/image_works_controller_spec.rb
geo_concerns-0.3.1 spec/controllers/image_works_controller_spec.rb