Sha256: 8ee46e72c2f0ec306e31c59011e109ffcf02a66d077ac0acb9482e726a34f3bb

Contents?: true

Size: 1.24 KB

Versions: 9

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

describe LocSearchController do
  fixtures :all

  it "should be a kind of enju_loc" do
    assert_kind_of Module, EnjuLoc
  end

  describe "GET index" do
    login_fixture_librarian

    it "should get index", :vcr => true do
      get :index, :query => 'library'
      expect( assigns(:books) ).not_to be_empty
    end

    it "should be empty if a query is not set", :vcr => true do
      get :index
      expect( assigns(:books) ).to be_empty
    end

    it "should get index with page parameter", :vcr => true do
      get :index, :query => 'library', :page => 2
      expect( assigns(:books) ).not_to be_empty
    end
  end

  describe "POST create" do
    login_fixture_librarian

    it "should create a bibliographic record if lccn is set", :vcr => true do
      post :create, :book => {:lccn => '2013385616'}
      expect( assigns(:manifestation).identifier_contents(:lccn) ).to eq ['2013385616']
      expect( response ).to redirect_to manifestation_url( assigns(:manifestation) )
    end

    it "should not create a bibliographic record if lccn is not set", :vcr => true do
      post :create, :book => {}
      expect( assigns(:manifestation) ).to be_nil
      expect( response ).to redirect_to loc_search_index_url
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
enju_loc-0.2.0.beta.2 spec/controllers/loc_search_controller_spec.rb
enju_loc-0.2.0.beta.1 spec/controllers/loc_search_controller_spec.rb
enju_loc-0.1.1 spec/controllers/loc_search_controller_spec.rb
enju_loc-0.1.0 spec/controllers/loc_search_controller_spec.rb
enju_loc-0.1.0.pre5 spec/controllers/loc_search_controller_spec.rb
enju_loc-0.1.0.pre4 spec/controllers/loc_search_controller_spec.rb
enju_loc-0.1.0.pre3 spec/controllers/loc_search_controller_spec.rb
enju_loc-0.1.0.pre2 spec/controllers/loc_search_controller_spec.rb
enju_loc-0.1.0.pre1 spec/controllers/loc_search_controller_spec.rb