Sha256: f7d82f6ff7a5faa5c4221a91a1fb7bc3a80ce9bc4d46e6916a21874c9a3cbc4e

Contents?: true

Size: 1.11 KB

Versions: 8

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe CurationConcerns::ImageWorksController, type: :controller do
  let(:user) { FactoryGirl.create(:user) }

  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 "#show" do
    before do
      sign_in user
    end
    context "with an existing image work" do
      it "is a success" do
        image = FactoryGirl.create(:image_work, user: user)

        get :show, params: { id: image.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

8 entries across 8 versions & 1 rubygems

Version Path
geo_concerns-0.3.0 spec/controllers/image_works_controller_spec.rb
geo_concerns-0.2.0 spec/controllers/image_works_controller_spec.rb
geo_concerns-0.1.1 spec/controllers/image_works_controller_spec.rb
geo_concerns-0.1.0 spec/controllers/image_works_controller_spec.rb
geo_concerns-0.0.10 spec/controllers/image_works_controller_spec.rb
geo_concerns-0.0.9 spec/controllers/image_works_controller_spec.rb
geo_concerns-0.0.8 spec/controllers/image_works_controller_spec.rb
geo_concerns-0.0.7 spec/controllers/image_works_controller_spec.rb