Sha256: ff54e266b27e6d5084949c14479694b8001d7ff6b02da4a001eafa6acade06f5

Contents?: true

Size: 1.87 KB

Versions: 6

Compression:

Stored size: 1.87 KB

Contents

require 'rails_helper'

describe "manifestations/show" do
  fixtures :all

  before(:each) do
    assign(:manifestation, FactoryBot.create(:manifestation))
    allow(view).to receive(:policy).and_return double(create?: false, udpate?: false, destroy?: false)
  end

  it "renders attributes in <p>" do
    render
    # Run the generator again with the --webrat flag if you want to use webrat matchers
    rendered.should match(/1/)
  end

  describe "identifier_link" do
    it "renders a link to CiNii Books" do
      assign(:manifestation, manifestations(:manifestation_00217))
      render
      rendered.should include '<a href="http://ci.nii.ac.jp/ncid/BN15603730">BN15603730</a>'
    end
  end

  describe "when logged in as Librarian" do
    before(:each) do
      user = assign(:profile, FactoryBot.create(:librarian))
      view.stub(:current_user).and_return(user)
      allow(view).to receive(:policy).and_return double(create?: true, update?: true, destroy?: true)
    end
    it "should have an ISBD separator for extent and dimensions" do
      assign(:manifestation, FactoryBot.create(:manifestation, extent: "extent value", dimensions: "dimensions value"))
      render
      expect(rendered).to match /\s+;\s+/
    end
    it "should have the total number of checkouts" do
      assign(:manifestation, manifestations(:manifestation_00001))
      render
      expect(rendered).to have_css "div.manifestation_total_checkouts", text: /\A\s*.*?: \d+/
    end
  end
  describe "when logged in as User" do
    before(:each) do
      user = assign(:profile, FactoryBot.create(:user))
      view.stub(:current_user).and_return(user)
    end
    it "should have an ISBD separator for extent and dimensions" do
      assign(:manifestation, FactoryBot.create(:manifestation, extent: "extent value", dimensions: "dimensions value"))
      render
      expect(rendered).to match /\s+;\s+/
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
enju_biblio-0.3.1 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.3.0 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.3.0.rc.1 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.3.0.beta.2 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.2.5 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.2.4 spec/views/manifestations/show.html.erb_spec.rb