Sha256: 4f91db9334ba65e1229e2d051ac8cfc20a1369c55e43c08aba4d8b8e5df6a785
Contents?: true
Size: 1.79 KB
Versions: 1
Compression:
Stored size: 1.79 KB
Contents
require File.join(File.dirname(__FILE__) + '/../../spec_helper') describe RailsBestPractices::Checks::OveruseRouteCustomizationsCheck do before(:each) do @runner = RailsBestPractices::Core::Runner.new(RailsBestPractices::Checks::OveruseRouteCustomizationsCheck.new) end it "should overuse route customizations" do content = <<-EOF ActionController::Routing::Routes.draw do |map| map.resources :posts, :member => { :comments => :get, :create_comment => :post, :update_comment => :post, :delete_comment => :post } end EOF @runner.check('config/routes.rb', content) errors = @runner.errors errors.should_not be_empty errors[0].to_s.should == "config/routes.rb:2 - overuse route customizations" end it "should overuse route customizations with collection" do content = <<-EOF ActionController::Routing::Routes.draw do |map| map.resources :posts, :member => { :create_comment => :post, :update_comment => :post, :delete_comment => :post }, :collection => { :comments => :get } end EOF @runner.check('config/routes.rb', content) errors = @runner.errors errors.should_not be_empty errors[0].to_s.should == "config/routes.rb:2 - overuse route customizations" end it "should not overuse route customizations when customize route is only one" do content = <<-EOF ActionController::Routing::Routes.draw do |map| map.resources :posts, :member => { :vote => :post } end EOF @runner.check('config/routes.rb', content) errors = @runner.errors errors.should be_empty end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_best_practices-0.1.1 | spec/rails_best_practices/checks/overuse_route_customizations_check_spec.rb |