Sha256: 5ed05bb0bab3b21c330740724f4547627a0207d630cdd9fddffbbcfcb76d50fb

Contents?: true

Size: 1.64 KB

Versions: 3

Compression:

Stored size: 1.64 KB

Contents

require 'rails_helper'

describe "manifestations/show" do
  fixtures :all

  before(:each) do
    assign(:manifestation, FactoryGirl.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, FactoryGirl.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, FactoryGirl.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, FactoryGirl.create(:user))
      view.stub(:current_user).and_return(user)
    end
    it "should have an ISBD separator for extent and dimensions" do
      assign(:manifestation, FactoryGirl.create(:manifestation, extent: "extent value", dimensions: "dimensions value"))
      render
      expect(rendered).to match /\s+;\s+/
    end
  end

end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/enju_biblio-0.2.0/spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.2.0 spec/views/manifestations/show.html.erb_spec.rb
enju_biblio-0.2.0.beta.4 spec/views/manifestations/show.html.erb_spec.rb