Sha256: 11efa6f104e4775d87e78dd755c6d5bf30eadffdca39eab29cdfa38c4c3f18b5

Contents?: true

Size: 1.64 KB

Versions: 22

Compression:

Stored size: 1.64 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="https://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
  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

22 entries across 22 versions & 1 rubygems

Version Path
enju_biblio-0.3.18 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.3.17 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.3.16 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.3.15 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.3.14 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.3.13 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.3.12 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.3.11 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.3.10 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.3.10.rc.3 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.3.10.rc.2 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.3.10.rc.1 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.3.9 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.4.0.rc.1 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.3.8 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.3.7 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.3.6 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.4.0.beta.2 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.4.0.beta.1 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.3.5 spec/views/manifestations/show.html.erb_spec.rb