Sha256: 0faa30732767e51c82bd52effd956cd012e2fee30bd687722b1ea9997934c34c

Contents?: true

Size: 1.52 KB

Versions: 4

Compression:

Stored size: 1.52 KB

Contents

require 'spec_helper'

describe CurationConcerns::VectorWorksController, type: :controller do
  let(:user) { FactoryGirl.create(:user) }
  let(:vector_work) { FactoryGirl.create(:vector_work, user: user, title: ['Vector Work Title']) }
  let(:reloaded) { vector_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(:raster_work, user: user) }
      let(:vector_work_attributes) do
        FactoryGirl.attributes_for(:vector_work)
      end
      it "creates and indexes its parent" do
        post :create, vector_work: vector_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 raster work" do
      it "is a success" do
        vector = FactoryGirl.create(:vector_work, user: user)
        raster = FactoryGirl.create(:raster_work, user: user)
        raster.ordered_members << vector
        raster.save
        vector.update_index

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

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