Sha256: 55d394b267e1a9739404c26cd3f9a23ecb5fbe41f9c204b4eb8c31a1043baf93
Contents?: true
Size: 1.76 KB
Versions: 14
Compression:
Stored size: 1.76 KB
Contents
require 'spec_helper' describe RailsBestPractices::Reviews::NotUseDefaultRouteReview do let(:runner) { RailsBestPractices::Core::Runner.new(:reviews => RailsBestPractices::Reviews::NotUseDefaultRouteReview.new) } describe "rails2" do it "should not use default route" do content = <<-EOF ActionController::Routing::Routes.draw do |map| map.resources :posts, :member => { :push => :post } map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' end EOF runner.review('config/routes.rb', content) runner.should have(2).errors runner.errors[0].to_s.should == "config/routes.rb:4 - not use default route" runner.errors[1].to_s.should == "config/routes.rb:5 - not use default route" end it "should no not use default route" do content = <<-EOF ActionController::Routing::Routes.draw do |map| map.resources :posts, :member => { :push => :post } end EOF runner.review('config/routes.rb', content) runner.should have(0).errors end end describe "rails3" do it "should not use default route" do content = <<-EOF RailsBestpracticesCom::Application.routes.draw do |map| resources :posts match ':controller(/:action(/:id(.:format)))' end EOF runner.review('config/routes.rb', content) runner.should have(1).errors runner.errors[0].to_s.should == "config/routes.rb:5 - not use default route" end it "should no not use default route" do content = <<-EOF RailsBestpracticesCom::Application.routes.draw do |map| resources :posts end EOF runner.review('config/routes.rb', content) runner.should have(0).errors end end end
Version data entries
14 entries across 14 versions & 2 rubygems