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.10 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.9 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.8 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.7 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.6 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.5 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.3 spec/lib/brightcontent/routes_parser_spec.rb