Sha256: c1fde2d7ee58f48b13569dacd3d5a1160842c52d6217c94f773dd0bbb61f6064

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe NdlBooksController do
  fixtures :all

  it "should be a kind of enju_ndl" do
    assert_kind_of Module, EnjuNdl
  end

  describe "GET index" do
    login_fixture_admin
    use_vcr_cassette "enju_ndl/search", :record => :new_episodes

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

    it "should be empty if a query is not set" do
      get :index
      assigns(:books).should be_empty
    end
  end

  describe "POST create" do
    login_fixture_admin
    use_vcr_cassette "enju_ndl/search", :record => :new_episodes

    it "should create a bibliographic record if nbn is set" do
      post :create, :book => {:nbn => '97024234'}
      assigns(:manifestation).nbn.should eq '97024234'
      response.should redirect_to manifestation_items_url(assigns(:manifestation))
    end

    it "should not create a bibliographic record if nbn is not set" do
      post :create, :book => {:nbn => nil}
      assigns(:manifestation).should be_nil
      response.should redirect_to ndl_books_url
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
enju_ndl-0.1.0.pre8 spec/controllers/ndl_books_controller_spec.rb