Sha256: 764cf09f554dc0e682a32ac48bc82729e73cc39d39ca94c4492a9df1cde5388a

Contents?: true

Size: 1.36 KB

Versions: 8

Compression:

Stored size: 1.36 KB

Contents

require 'rails_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

    it "should get index", vcr: true do
      get :index, params: { query: 'library' }
      assigns(:books).should_not be_empty
    end

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

  describe "POST create" do
    login_fixture_admin

    it "should create a bibliographic record if jpno is set", vcr: true do
      post :create, params: { book: {iss_itemno: 'R100000002-I000002539673-00'} }
      assigns(:manifestation).identifier_contents(:jpno).should eq ['97024234']
      response.should redirect_to manifestation_url(assigns(:manifestation))
    end

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

    it "should create a serial record", vcr: true do
      post :create, params: { book: {iss_itemno: 'R100000002-I000000029371-00'} }
      assigns(:manifestation).identifier_contents(:jpno).should eq ['00029793']
      response.should redirect_to manifestation_url(assigns(:manifestation))
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
enju_ndl-0.3.3 spec/controllers/ndl_books_controller_spec.rb
enju_ndl-0.3.2 spec/controllers/ndl_books_controller_spec.rb
enju_ndl-0.4.0.rc.1 spec/controllers/ndl_books_controller_spec.rb
enju_ndl-0.4.0.beta.1 spec/controllers/ndl_books_controller_spec.rb
enju_ndl-0.3.1 spec/controllers/ndl_books_controller_spec.rb
enju_ndl-0.3.0 spec/controllers/ndl_books_controller_spec.rb
enju_ndl-0.3.0.rc.1 spec/controllers/ndl_books_controller_spec.rb
enju_ndl-0.3.0.beta.1 spec/controllers/ndl_books_controller_spec.rb