Sha256: 494b320f63fa1a4b59c346969813d8a763bb568e63113ef9fbb134dba3aa8bfe

Contents?: true

Size: 1.06 KB

Versions: 27

Compression:

Stored size: 1.06 KB

Contents

require "brightcontent/routes_parser"

module Brightcontent
  describe RoutesParser do
    let(:engine_resources) { %w{sessions admin_users} }
    let(:routes_hash) do
      [ {}, nil, {:action=>"admin"},
      {:action=>"index", :controller=>"brightcontent/blogs"},
      {:action=>"create", :controller=>"brightcontent/blogs"} ]
    end

    subject(:parser) { RoutesParser.parse(routes_hash, engine_resources) }

    it { should eq ["blogs"] }

    context "with extra resource" do
      before { routes_hash << {:action=>"index", :controller=>"brightcontent/articles"} }
      it { should eq ["blogs", "articles"] }
    end

    context "with engine resources" do
      before do
        engine_resources.each do |resource_name|
          routes_hash << {:action=>"index", :controller=>"brightcontent/#{resource_name}"}
        end
      end
      it { should eq ["blogs"] }
    end

    context "duplicate resources" do
      before do
        routes_hash << {action: "index", controller: "brightcontent/blogs" }
      end

      it { should eq ["blogs"] }
    end

  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
brightcontent-core-2.0.30 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.29 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.28 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.27 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.26 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.25 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.24 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.23 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.22 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.21 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.20 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.19 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.18 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.17 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.16 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.15 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.14 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.13 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.12 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.11 spec/lib/brightcontent/routes_parser_spec.rb