Sha256: d0be5e32a542c5b393e7c20c288a2548957214ca1016473959e2755fd717dad1

Contents?: true

Size: 1.01 KB

Versions: 11

Compression:

Stored size: 1.01 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

    it "should get index", :vcr => true do
      get :index, :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 nbn is set", :vcr => true 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", :vcr => true do
      post :create, :book => {:nbn => nil}
      assigns(:manifestation).should be_nil
      response.should redirect_to ndl_books_url
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
enju_ndl-0.1.0.pre19 spec/controllers/ndl_books_controller_spec.rb
enju_ndl-0.1.0.pre18 spec/controllers/ndl_books_controller_spec.rb
enju_ndl-0.1.0.pre17 spec/controllers/ndl_books_controller_spec.rb
enju_ndl-0.1.0.pre16 spec/controllers/ndl_books_controller_spec.rb
enju_ndl-0.1.0.pre15 spec/controllers/ndl_books_controller_spec.rb
enju_ndl-0.1.0.pre14 spec/controllers/ndl_books_controller_spec.rb
enju_ndl-0.1.0.pre13 spec/controllers/ndl_books_controller_spec.rb
enju_ndl-0.1.0.pre12 spec/controllers/ndl_books_controller_spec.rb
enju_ndl-0.1.0.pre11 spec/controllers/ndl_books_controller_spec.rb
enju_ndl-0.1.0.pre10 spec/controllers/ndl_books_controller_spec.rb
enju_ndl-0.1.0.pre9 spec/controllers/ndl_books_controller_spec.rb