Sha256: 60c84e24dfb0dd773cbf8930ee41b4fb6040b2878bcf7717dd6edd5cbd8c0073

Contents?: true

Size: 936 Bytes

Versions: 8

Compression:

Stored size: 936 Bytes

Contents

require "brightcontent/routes_parser"

class Blog ; end
class Article ; end

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

  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
brightcontent-core-2.0.2 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.1 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.0.alpha6 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.0.alpha5 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-2.0.0.alpha3 core/spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.0.alpha3 spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-2.0.0.alpha2 core/spec/lib/brightcontent/routes_parser_spec.rb
brightcontent-core-2.0.0.alpha2 spec/lib/brightcontent/routes_parser_spec.rb