Sha256: e1127012965365023e83229f630b872f04d0b57e783ab13de32fad6379d2487f

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 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")

      hydra_djatoka_url_for(mock_doc, :scale=>"90").should == "/get/myPid.jp2?image_server[scale]=90"
    end
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hydra-head-3.0.0pre3 test_support/spec/helpers/hydra_djatoka_helper_spec.rb
hydra-head-3.0.0pre2 test_support/spec/helpers/hydra_djatoka_helper_spec.rb
hydra-head-3.0.0pre1 test_support/spec/helpers/hydra_djatoka_helper_spec.rb