Sha256: 51941b7faf2f3e74202c096151a1fea67fb656c66688465a1ea9642c415b3c7e

Contents?: true

Size: 1.24 KB

Versions: 48

Compression:

Stored size: 1.24 KB

Contents

require "spec_helper"

describe "be_routable" do
  include RSpec::Rails::Matchers::RoutingMatchers
  attr_reader :routes

  before { @routes = double("routes") }

  context "with should" do
    it "passes if routes recognize the path" do
      routes.stub(:recognize_path) { {} }
      expect do
        {:get => "/a/path"}.should be_routable
      end.to_not raise_error
    end

    it "fails if routes do not recognize the path" do
      routes.stub(:recognize_path) { raise ActionController::RoutingError.new('ignore') }
      expect do
        {:get => "/a/path"}.should be_routable
      end.to raise_error(/expected \{:get=>"\/a\/path"\} to be routable/)
    end
  end

  context "with should_not" do

    it "passes if routes do not recognize the path" do
      routes.stub(:recognize_path) { raise ActionController::RoutingError.new('ignore') }
      expect do
        {:get => "/a/path"}.should_not be_routable
      end.to_not raise_error
    end

    it "fails if routes recognize the path" do
      routes.stub(:recognize_path) { {:controller => "foo"} }
      expect do
        {:get => "/a/path"}.should_not be_routable
      end.to raise_error(/expected \{:get=>"\/a\/path"\} not to be routable, but it routes to \{:controller=>"foo"\}/)
    end
  end
end

Version data entries

48 entries across 43 versions & 6 rubygems

Version Path
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/rspec-rails-2.13.0/spec/rspec/rails/matchers/be_routable_spec.rb
rspec-rails-2.14.1 spec/rspec/rails/matchers/be_routable_spec.rb
rspec-rails-3.0.0.beta1 spec/rspec/rails/matchers/be_routable_spec.rb
rspec-rails-2.99.0.beta1 spec/rspec/rails/matchers/be_routable_spec.rb
rspec-rails-2.14.0 spec/rspec/rails/matchers/be_routable_spec.rb
rspec-rails-2.13.1 spec/rspec/rails/matchers/be_routable_spec.rb
rspec-rails-2.13.0 spec/rspec/rails/matchers/be_routable_spec.rb
rspec-rails-2.12.2 spec/rspec/rails/matchers/be_routable_spec.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/rspec/rails/matchers/be_routable_spec.rb
rspec-rails-2.12.1 spec/rspec/rails/matchers/be_routable_spec.rb
rspec-rails-2.12.0 spec/rspec/rails/matchers/be_routable_spec.rb
rspec-rails-2.11.4 spec/rspec/rails/matchers/be_routable_spec.rb
gem_repackager-0.1.0 support/gems/rspec-rails-2.11.0/spec/rspec/rails/matchers/be_routable_spec.rb
rspec-rails-2.11.0 spec/rspec/rails/matchers/be_routable_spec.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/rspec/rails/matchers/be_routable_spec.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/rspec/rails/matchers/be_routable_spec.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/rspec/rails/matchers/be_routable_spec.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/rspec/rails/matchers/be_routable_spec.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/rspec/rails/matchers/be_routable_spec.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/rspec/rails/matchers/be_routable_spec.rb