Sha256: 8a43938d05cfa328d9f744848a45b56cbea606c8e6cda6f6d29b4f7193eed3d8

Contents?: true

Size: 1.29 KB

Versions: 11

Compression:

Stored size: 1.29 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
include HydraDjatokaHelper


describe HydraDjatokaHelper do
  
  describe "hydra_djatoka_url_for" do
    it "should return the url for retrieving the given document's canonical jp2 url" do
      mock_doc = mock("document")
      mock_doc.expects(:kind_of?).with(SolrDocument).returns(true)
      mock_doc.expects(:id).returns("myPid")

      hydra_djatoka_url_for(mock_doc).should == "/get/myPid.jp2?image_server=true"
    end
    it "should work with a mash as the document" do
      mock_doc = mock("document")
      mock_doc.expects(:kind_of?).with(SolrDocument).returns(false)
      mock_doc.expects(:kind_of?).with(Mash).returns(true)      
      mock_doc.expects(:[]).with(:id).returns("myPid")

      hydra_djatoka_url_for(mock_doc).should == "/get/myPid.jp2?image_server=true"
    end
    it "should accept scale arguments" do
      mock_doc = mock("document")
      mock_doc.expects(:kind_of?).with(SolrDocument).returns(true)
      mock_doc.expects(:id).returns("myPid")
      # rails 3.1.x
      # hydra_djatoka_url_for(mock_doc, :scale=>"90").should == "/get/myPid.jp2?image_server%5Bscale%5D=90"
      # rails 3.0.x
      hydra_djatoka_url_for(mock_doc, :scale=>"90").should == "/get/myPid.jp2?image_server[scale]=90"
    end
  end
  
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
hydra-head-3.1.0.rc1 test_support/spec/helpers/hydra_djatoka_helper_spec.rb
hydra-head-3.1.0.pre5 test_support/spec/helpers/hydra_djatoka_helper_spec.rb
hydra-head-3.1.0.pre4 test_support/spec/helpers/hydra_djatoka_helper_spec.rb
hydra-head-3.1.0.pre3 test_support/spec/helpers/hydra_djatoka_helper_spec.rb
hydra-head-3.0.1 test_support/spec/helpers/hydra_djatoka_helper_spec.rb
hydra-head-3.1.0.pre2 test_support/spec/helpers/hydra_djatoka_helper_spec.rb
hydra-head-3.0.0 test_support/spec/helpers/hydra_djatoka_helper_spec.rb
hydra-head-3.1.0.pre1 test_support/spec/helpers/hydra_djatoka_helper_spec.rb
hydra-head-3.0.0.rc2 test_support/spec/helpers/hydra_djatoka_helper_spec.rb
hydra-head-3.0.0.rc1 test_support/spec/helpers/hydra_djatoka_helper_spec.rb
hydra-head-3.0.0pre4 test_support/spec/helpers/hydra_djatoka_helper_spec.rb