Sha256: 8672bb47c661109c461e91b774610eafdf74d7f0550857b5b3a12e44e24def2f

Contents?: true

Size: 925 Bytes

Versions: 1

Compression:

Stored size: 925 Bytes

Contents

require 'spec_helper'

describe RailsBestPractices::Core::Routes do
  let(:routes) { RailsBestPractices::Core::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 = RailsBestPractices::Core::Route.new(['admin', 'test'], 'posts', 'new')
      route.to_s.should == "Admin::Test::PostsController#new"
    end

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_best_practices-gorgeouscode-1.0.0 spec/rails_best_practices/core/routes_spec.rb