Sha256: e6f66780bf96b1b9fbabecc0cd50025c0e4cbbe1af6a760d0c0556e0aeb02b42

Contents?: true

Size: 953 Bytes

Versions: 6

Compression:

Stored size: 953 Bytes

Contents

require "spec_helper"

class TestConfigController
  include ModsDisplay::ControllerExtension
  
  configure_mods_display do
    title do
      label_class 'label-class'
      value_class 'value-class'
      link :link_to_title, "%value%"
    end
  end
  
  def link_to_title(title)
    "/path/to/title?#{title}"
  end
end

describe "Configuration" do
  before(:all) do
    xml = "<mods><titleInfo><title>The Title of this Item</title></titleInfo></mods>"
    model = TestModel.new
    model.modsxml = xml
    controller = TestConfigController.new
    @html = controller.render_mods_display(model)
  end
  it "should apply the label class" do
    @html.should match(/<dt class='label-class' title=/)
  end
  it "should apply the value class" do
    @html.scan(/<dd class='value-class'>/).length.should == 1
  end
  it "should apply the link" do
    @html.scan(/<a href='\/path\/to\/title\?The Title of this Item'>The Title of this Item<\a>/)
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mods_display-0.0.1.beta6 spec/integration/configuration_spec.rb
mods_display-0.0.1.beta5 spec/integration/configuration_spec.rb
mods_display-0.0.1.beta4 spec/integration/configuration_spec.rb
mods_display-0.0.1.beta3 spec/integration/configuration_spec.rb
mods_display-0.0.1.beta2 spec/integration/configuration_spec.rb
mods_display-0.0.1.beta1 spec/integration/configuration_spec.rb