Sha256: fba756a5e68ce581ebac8d5b2f76b10cc1c45141d7f4c98a61d1ab525ec9d778

Contents?: true

Size: 1.05 KB

Versions: 10

Compression:

Stored size: 1.05 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, :update]})
        router.should_receive(:resources).with(:records, :only=>[:show, :update])
        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, :update], :constraints=>{:id=>/[a-z]+/, :format=>false} })
        router.should_receive(:resources).with(:records, :only=>[:show, :update], :constraints=>{:id=>/[a-z]+/, :format=>false})
        subject.solr_document(:records)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
blacklight-5.0.3 spec/lib/blacklight/routes_spec.rb
blacklight-5.1.1 spec/lib/blacklight/routes_spec.rb
blacklight-5.1.0 spec/lib/blacklight/routes_spec.rb
blacklight-5.0.2 spec/lib/blacklight/routes_spec.rb
blacklight-5.0.1 spec/lib/blacklight/routes_spec.rb
blacklight-5.0.0 spec/lib/blacklight/routes_spec.rb
blacklight-5.0.0.pre4 spec/lib/blacklight/routes_spec.rb
blacklight-5.0.0.pre3 spec/lib/blacklight/routes_spec.rb
blacklight-5.0.0.pre2 spec/lib/blacklight/routes_spec.rb
blacklight-5.0.0.pre1 spec/lib/blacklight/routes_spec.rb