Sha256: a4a1141801464be4436ee633a7715e0f1520ee59bbd3111fd0db21575c24de37

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

# -*- encoding: utf-8 -*-
require 'spec_helper'

describe "manifestations/list_records.oai.builder" do
  fixtures :all

  before(:each) do
    view.stub(:current_user_role_name).and_return('Guest')
    assign(:oai, { :errors => [] })
    assign(:manifestations, [FactoryGirl.create(:manifestation)])
  end

  it "renders the XML template" do
    render
    expect(rendered).to match /<metadata>/
  end

  it "renders dc:date" do
    assign(:manifestations, [FactoryGirl.create(:manifestation, pub_date: '2015-08-15')])
    render
    expect(rendered).to match /2015-08-15/
  end

  describe "when metadataPrefix is oai_dc" do
    before(:each) do
      assign(:oai, { :errors => [], :metadataPrefix => 'oai_dc' } )
    end
    it "renders the XML template" do
      render
      expect(rendered).to match /<oai_dc/
    end
  end

  describe "when metadataPrefix is junii2" do
    before(:each) do
      assign(:oai, { :errors => [], :metadataPrefix => 'junii2' } )
    end
    it "renders the XML template" do
      render
      expect(rendered).to match /<junii2/
    end
    it "renders NIItype" do
      assign(:manifestations, [FactoryGirl.create(:manifestation, nii_type_id: 1)])
      render
      expect(rendered).to match /<NIItype>Journal Article<\/NIItype>/
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
enju_oai-0.1.0.pre19 spec/views/manifestations/list_records.oai.builder_spec.rb
enju_oai-0.1.0.pre18 spec/views/manifestations/list_records.oai.builder_spec.rb