Sha256: beab6ba12355f636f65f09dba3faaaa7b73b57cb288d531f68b68ceb26b56c2c

Contents?: true

Size: 1.4 KB

Versions: 4

Compression:

Stored size: 1.4 KB

Contents

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

class HydraControllerTest < ActionController::Base
end
describe HydraControllerTest do
  
  after :all do
    Object.send(:remove_const, :HydraControllerTest)
  end
  
  it "should add the necessary helpers to classes that include it" do
    HydraControllerTest.expects(:helper).with(:hydra)
    HydraControllerTest.expects(:helper).with(:hydra_assets)
    HydraControllerTest.stubs(:before_filter)
    HydraControllerTest.send(:include, Hydra::Controller::ControllerBehavior)
  end
  
  describe "load_fedora_document" do
    before :all do
      @behavior = Hydra::Controller::ControllerBehavior.deprecation_behavior
      Hydra::Controller::ControllerBehavior.deprecation_behavior = :silence
    end

    after :all do
      Hydra::Controller::ControllerBehavior.deprecation_behavior = @behavior
    end

    before do
      HydraControllerTest.send(:include, Hydra::Controller::ControllerBehavior)
    end


    it "should load @document_fedora and @file_assets" do
      controller.params[:id] = 'hydrangea:fixture_mods_article1'
      controller.load_fedora_document
      
      assigns[:document_fedora].class.should == ModsAsset 
      assigns[:document_fedora].pid.should == 'hydrangea:fixture_mods_article1' 
      assigns[:file_assets].size.should == 1
      assigns[:file_assets].first["id"].should == "hydrangea:fixture_uploaded_svg1"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hydra-head-4.1.3 test_support/spec/controllers/hydra_controller_spec.rb
hydra-head-4.1.2 test_support/spec/controllers/hydra_controller_spec.rb
hydra-head-4.1.1 test_support/spec/controllers/hydra_controller_spec.rb
hydra-head-4.1.0 test_support/spec/controllers/hydra_controller_spec.rb