Sha256: 5cd1b0dae47698e4ea8be1f0f28eec7241604ea8caf2eccd36d2dd9173d3015f

Contents?: true

Size: 873 Bytes

Versions: 18

Compression:

Stored size: 873 Bytes

Contents

require 'spec_helper'

module RailsBestPractices::Core
  describe Routes do
    let(:routes) { Routes.new }

    it "should add route" do
      routes.add_route(["admin", "test"], "posts", "new")
      routes.map(&:to_s).should == ["Admin::Test::PostsController#new"]
    end

    context "route" do
      it "should add namesapces, controller name and action name" do
        route = Route.new(['admin', 'test'], 'posts', 'new')
        route.to_s.should == "Admin::Test::PostsController#new"
      end

      it "should add controller name with namespace" do
        route = Route.new(['admin'], 'test/posts', 'new')
        route.to_s.should == "Admin::Test::PostsController#new"
      end

      it "should add routes without controller" do
        route = Route.new(['posts'], nil, 'new')
        route.to_s.should == "PostsController#new"
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rails_best_practices-1.14.4 spec/rails_best_practices/core/routes_spec.rb
rails_best_practices-1.14.3 spec/rails_best_practices/core/routes_spec.rb
rails_best_practices-1.14.2 spec/rails_best_practices/core/routes_spec.rb
rails_best_practices-1.14.1 spec/rails_best_practices/core/routes_spec.rb
rails_best_practices-1.14.0 spec/rails_best_practices/core/routes_spec.rb
rails_best_practices-1.13.8 spec/rails_best_practices/core/routes_spec.rb
rails_best_practices-1.13.5 spec/rails_best_practices/core/routes_spec.rb
rails_best_practices-1.13.4 spec/rails_best_practices/core/routes_spec.rb
rails_best_practices-1.13.3 spec/rails_best_practices/core/routes_spec.rb
rails_best_practices-1.13.2 spec/rails_best_practices/core/routes_spec.rb
rails_best_practices-1.13.1 spec/rails_best_practices/core/routes_spec.rb
rails_best_practices-1.13.0 spec/rails_best_practices/core/routes_spec.rb
rails_best_practices-1.12.0 spec/rails_best_practices/core/routes_spec.rb
rails_best_practices-1.11.1 spec/rails_best_practices/core/routes_spec.rb
rails_best_practices-1.11.0 spec/rails_best_practices/core/routes_spec.rb
rails_best_practices-1.10.1 spec/rails_best_practices/core/routes_spec.rb
rails_best_practices-1.10.0 spec/rails_best_practices/core/routes_spec.rb
rails_best_practices-1.9.1 spec/rails_best_practices/core/routes_spec.rb