Sha256: 5377db4c62d456357fc63c3381d9ed7dcaa9721b0180a974eb84ba8d80ee41ac

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper' 
describe Blacklight::Routes do
  subject { Blacklight::Routes.new(router, options) }
  let(:router) { double }

  describe "solr_document" do
    describe "without constraints" do
      let(:options) { Hash.new }
      it "should define the resources" do
        router.should_receive(:resources).with(:solr_document, {:path=>:records, :controller=>:records, :only=>[:show]})
        router.should_receive(:resources).with(:records, :only=>[:show])
        subject.solr_document(:records)
      end
    end

    describe "with constraints" do
      let(:options) { { :constraints => {id: /[a-z]+/, format: false } } }
      it "should define the resources" do
        router.should_receive(:resources).with(:solr_document, {:path=>:records, :controller=>:records, :only=>[:show], :constraints=>{:id=>/[a-z]+/, :format=>false} })
        router.should_receive(:resources).with(:records, :only=>[:show], :constraints=>{:id=>/[a-z]+/, :format=>false})
        subject.solr_document(:records)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
blacklight-5.5.1 spec/lib/blacklight/routes_spec.rb
blacklight-5.5.0 spec/lib/blacklight/routes_spec.rb
blacklight-5.4.0 spec/lib/blacklight/routes_spec.rb
blacklight-5.4.0.rc1 spec/lib/blacklight/routes_spec.rb
blacklight-5.3.0 spec/lib/blacklight/routes_spec.rb
blacklight-5.2.0 spec/lib/blacklight/routes_spec.rb