Sha256: 4fa65e71570afcf014695937c12c03799180875b1f2d1713f1ba22fd6baf0a85

Contents?: true

Size: 1.12 KB

Versions: 11

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe FcrepoAdmin::AssociationsController do
  let(:object) { FactoryGirl.create(:item) }
  after { object.delete }
  context "#index" do
    subject { get :index, :object_id => object, :use_route => 'fcrepo_admin' }
    it { should render_template(:index) }
  end
  context "#show" do
    context "association is a collection" do
      let(:part) { FactoryGirl.create(:part) }
      before { object.parts << part }
      after do
        part.delete
        object.reload
      end
      subject { get :show, :object_id => object, :id => "parts", :use_route => 'fcrepo_admin' }
      it { should render_template(:show) }
    end
    context "association is not a collection" do
      subject { get :show, :object_id => object, :id => "collection", :use_route => 'fcrepo_admin' }
      context "has target" do
        let(:collection) { FactoryGirl.create(:collection) }
        before { collection.members << object }
        after { collection.delete }
        its(:response_code) { should eq(302) }
      end
      context "target is nil" do
        its(:response_code) { should eq(404) }
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
fcrepo_admin-0.6.1 spec/controllers/associations_controller_spec.rb
fcrepo_admin-0.6.0 spec/controllers/associations_controller_spec.rb
fcrepo_admin-0.5.5 spec/controllers/associations_controller_spec.rb
fcrepo_admin-0.5.5.pre spec/controllers/associations_controller_spec.rb
fcrepo_admin-0.5.4 spec/controllers/associations_controller_spec.rb
fcrepo_admin-0.5.3 spec/controllers/associations_controller_spec.rb
fcrepo_admin-0.5.2 spec/controllers/associations_controller_spec.rb
fcrepo_admin-0.5.1 spec/controllers/associations_controller_spec.rb
fcrepo_admin-0.5.0 spec/controllers/associations_controller_spec.rb
fcrepo_admin-0.4.1 spec/controllers/associations_controller_spec.rb
fcrepo_admin-0.4.0 spec/controllers/associations_controller_spec.rb