Sha256: 4130cd89f5127efaf34b6aefbedcfc7143a7428f683517a9e456ae7a4109792a

Contents?: true

Size: 809 Bytes

Versions: 14

Compression:

Stored size: 809 Bytes

Contents

require 'spec_helper'

describe Hydra::Controller::RepositoryControllerBehavior do
  before(:all) do
    class RepositoryControllerTest < ApplicationController
      include Hydra::Controller::RepositoryControllerBehavior
    end
  end

  subject { RepositoryControllerTest.new }
  
  describe "load_document" do
    it "should load the model for the pid" do
      mock_model = mock("model")
      subject.stub(:params).and_return( {:id => "object id"} )
      ActiveFedora::Base.should_receive(:find).with("object id", :cast=>true).and_return(mock_model)
      subject.send(:load_document).should == mock_model
    end
  end
  
  describe "format_pid" do
    it "convert pids into XHTML safe strings" do 
     pid = subject.format_pid("hydra:123")
     pid.should match(/hydra_123/)   
    end 
  end
  
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
hydra-core-5.0.0.pre15 spec/lib/repository_controller_behavior_spec.rb
hydra-core-5.0.0.pre14 spec/lib/repository_controller_behavior_spec.rb
hydra-core-5.0.0.pre13 spec/lib/repository_controller_behavior_spec.rb
hydra-core-5.0.0.pre12 spec/lib/repository_controller_behavior_spec.rb
hydra-core-5.0.0.pre11 spec/lib/repository_controller_behavior_spec.rb
hydra-core-5.0.0.pre10 spec/lib/repository_controller_behavior_spec.rb
hydra-core-5.0.0.pre9 spec/lib/repository_controller_behavior_spec.rb
hydra-core-5.0.0.pre8 spec/lib/repository_controller_behavior_spec.rb
hydra-core-5.0.0.pre7 spec/lib/repository_controller_behavior_spec.rb
hydra-core-5.0.0.pre6 spec/lib/repository_controller_behavior_spec.rb
hydra-core-5.0.0.pre4 spec/lib/repository_controller_behavior_spec.rb
hydra-core-5.0.0.pre3 spec/lib/repository_controller_behavior_spec.rb
hydra-core-5.0.0.pre2 spec/lib/repository_controller_behavior_spec.rb
hydra-core-5.0.0.pre1 spec/lib/repository_controller_behavior_spec.rb