Sha256: af89e6f0ae4016a379c3a25cb653185b445d4953a9883cbf27c4b11348281b3b
Contents?: true
Size: 1.46 KB
Versions: 2
Compression:
Stored size: 1.46 KB
Contents
# encoding: UTF-8 require 'spec_helper' describe "recognize-path" do before do FooController = Class.new(ActionController::Base) BoomsController = Class.new(ActionController::Base) routes = Rails.application.routes routes.draw { root(:to => 'foo#index', :constraints => {:host => 'example.com'}) resources :booms } routes.finalize! end after do [:FooController, :BoomsController].each { |const| Object.__send__(:remove_const, const) } end it "prints info about controller/action that is bound to the given path" do output = mock_pry('recognize-path example.com', 'exit-all') output.must_match /controller.+foo/ output.must_match /action.+index/ end it "accepts short path" do output = mock_pry('recognize-path /booms/1/edit', 'exit-all') output.must_match /action.+edit/ output.must_match /controller.+booms/ output.must_match /id.+1/ end it "accepts -m switch" do output = mock_pry('recognize-path example.com/booms -m post', 'exit-all') output.must_match /controller.+booms/ output.must_match /action.+create/ end it "doesn't accept unknown methods" do output = mock_pry('recognize-path example.com/booms -m posty', 'exit-all') output.must_match 'Unknown HTTP method: posty' end it "doesn't accept unknown routes" do output = mock_pry('recognize-path bing/bang/bong', 'exit-all') output.must_match 'No route matches "http://bing/bang/bong"' end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pry-rails-0.3.2 | spec/recognize_path_spec.rb |
pry-rails-0.3.1 | spec/recognize_path_spec.rb |