Sha256: afcb2ea462dc6d1fc616e2ac7dd320f735c5b6a93b64b9dceafbfac51150c92a

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

describe CatalogController do

  describe "when logged in" do
    before :all do
      ActiveFedora::Base.destroy_all
    end
    let(:user) { FactoryGirl.create(:user) }
    let!(:work1) { FactoryGirl.create(:generic_work, user: user) }
    let!(:work2) { FactoryGirl.create(:generic_work) }
    before do
      sign_in user
    end
    after do
      work1.destroy
      work2.destroy
    end
    context "Searching all works" do
      it "should return all the works" do
        get 'index', 'f' => {'generic_type_sim' => 'Work'}
        response.should be_successful
        assigns(:document_list).map(&:id).should == [work1.id, work2.id]
      end
    end

    context "searching just my works" do
      it "should return just my works" do
        get 'index', works: 'mine'
        response.should be_successful
        assigns(:document_list).map(&:id).should == [work1.id]
      end
    end

    context "index page" do
      it "assigns options for adding items to collection" do
        coll = FactoryGirl.create(:collection, user: user)
        get 'index'
        assigns(:collection_options).should == [coll]
        assigns(:profile_collection_options).should == []
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
curate-0.5.0 spec/controllers/catalog_controller_spec.rb
curate-0.4.2 spec/controllers/catalog_controller_spec.rb