Sha256: bd1524f66f4969f1dc74b388e7222fd8eda1fa9ccbb0efa70ec5bf9fad5be9f6

Contents?: true

Size: 1.09 KB

Versions: 44

Compression:

Stored size: 1.09 KB

Contents

require File.join(File.dirname(__FILE__) + '/../../spec_helper')

describe RailsBestPractices::Checks::NotUseDefaultRouteCheck do
  before(:each) do
    @runner = RailsBestPractices::Core::Runner.new(RailsBestPractices::Checks::NotUseDefaultRouteCheck.new)
  end
  
  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.check('config/routes.rb', content)
    errors = @runner.errors
    errors.should_not be_empty
    errors[0].to_s.should == "config/routes.rb:4 - not use default route"
    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.check('config/routes.rb', content)
    errors = @runner.errors
    errors.should be_empty
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
rails_best_practices-0.3.27 spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
rails_best_practices-0.3.26 spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
rails_best_practices-0.3.25 spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
rails_best_practices-0.3.24 spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
rails_best_practices-0.3.23 spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
rails_best_practices-0.3.22 spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
rails_best_practices-0.3.21 spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
rails_best_practices-0.3.20 spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
rails_best_practices-0.3.19 spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
rails_best_practices-0.3.18 spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
rails_best_practices-0.3.17 spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
rails_best_practices-0.3.16 spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
rails_best_practices-0.3.15 spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
rails_best_practices-0.3.14 spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
rails_best_practices-0.3.13 spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
rails_best_practices-0.3.12 spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
rails_best_practices-0.3.11 spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
rails_best_practices-0.3.10 spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
rails_best_practices-0.3.9 spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
rails_best_practices-0.3.8 spec/rails_best_practices/checks/not_use_default_route_check_spec.rb