Sha256: 2c9d49106bc287610325e2e3bd092a559887cd1d20efc3e13c9486b7cc94f164
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 KB
Contents
require 'spec_helper' module RailsBestPractices module Reviews describe NotUseDefaultRouteReview do let(:runner) { Core::Runner.new(reviews: NotUseDefaultRouteReview.new) } 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) expect(runner.errors.size).to eq(1) expect(runner.errors[0].to_s).to eq('config/routes.rb:4 - 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) expect(runner.errors.size).to eq(0) end it 'should not check ignored files' do runner = Core::Runner.new(reviews: NotUseDefaultRouteReview.new(ignored_files: /config\/routes\.rb/)) content = <<-EOF RailsBestpracticesCom::Application.routes.draw do |map| resources :posts match ':controller(/:action(/:id(.:format)))' end EOF runner.review('config/routes.rb', content) expect(runner.errors.size).to eq(0) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_best_practices-1.19.1 | spec/rails_best_practices/reviews/not_use_default_route_review_spec.rb |