Sha256: 567456827a1dc9045cad41a714526cc2511aa97031d90d2c9be0c0288bfa382f
Contents?: true
Size: 1.31 KB
Versions: 2
Compression:
Stored size: 1.31 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 allow(routes).to receive(:recognize_path) { {} } expect do expect({:get => "/a/path"}).to be_routable end.to_not raise_error end it "fails if routes do not recognize the path" do allow(routes).to receive(:recognize_path) { raise ActionController::RoutingError.new('ignore') } expect do expect({:get => "/a/path"}).to 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 allow(routes).to receive(:recognize_path) { raise ActionController::RoutingError.new('ignore') } expect do expect({:get => "/a/path"}).not_to be_routable end.to_not raise_error end it "fails if routes recognize the path" do allow(routes).to receive(:recognize_path) { {:controller => "foo"} } expect do expect({:get => "/a/path"}).not_to 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rspec-rails-3.0.0.beta2 | spec/rspec/rails/matchers/be_routable_spec.rb |
rspec-rails-2.99.0.beta2 | spec/rspec/rails/matchers/be_routable_spec.rb |