File: routing_example_group_spec.rb

package info (click to toggle)
ruby-rspec-rails 8.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 1,820 kB
  • sloc: ruby: 10,902; sh: 199; makefile: 6
file content (23 lines) | stat: -rw-r--r-- 693 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module RSpec::Rails
  RSpec.describe RoutingExampleGroup do
    it_behaves_like "an rspec-rails example group mixin", :routing,
                    './spec/routing/', '.\\spec\\routing\\'

    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_messages(routes: routes)

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