Sha256: 49b1253f03a67e28b338598312c326e125cd99c13673f92da4f3d13a336cb174

Contents?: true

Size: 942 Bytes

Versions: 1

Compression:

Stored size: 942 Bytes

Contents

require "spec_helper"

module RSpec::Rails
  describe RoutingExampleGroup do
    it { is_expected.to be_included_in_files_in('./spec/routing/') }
    it { is_expected.to be_included_in_files_in('.\\spec\\routing\\') }

    it "adds :type => :routing to the metadata" do
      group = RSpec::Core::ExampleGroup.describe do
        include RoutingExampleGroup
      end
      expect(group.metadata[:type]).to eq(:routing)
    end

    describe "named routes" do
      it "delegates them to the route_set" do
        group = RSpec::Core::ExampleGroup.describe do
          include RoutingExampleGroup
        end

        example = group.new

        # Yes, this is quite invasive
        url_helpers = double('url_helpers', :foo_path => "foo")
        routes = double('routes', :url_helpers => url_helpers)
        allow(example).to receive(:routes).and_return(routes)

        expect(example.foo_path).to eq("foo")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-rails-2.99.0.beta2 spec/rspec/rails/example/routing_example_group_spec.rb