Sha256: c0b7167c368ef6ca01ad670d95600b2e12a20fffd62647f4247a1e9d9cab6b9f

Contents?: true

Size: 1.44 KB

Versions: 7

Compression:

Stored size: 1.44 KB

Contents

require "rails_helper"

<% module_namespacing do -%>
RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:routing) %> do
  describe "routing" do

<% unless options[:singleton] -%>
    it "routes to #index" do
      expect(:get => "/<%= ns_table_name %>").to route_to("<%= ns_table_name %>#index")
    end

<% end -%>
<% unless options[:api] -%>
    it "routes to #new" do
      expect(:get => "/<%= ns_table_name %>/new").to route_to("<%= ns_table_name %>#new")
    end
<% end -%>

    it "routes to #show" do
      expect(:get => "/<%= ns_table_name %>/1").to route_to("<%= ns_table_name %>#show", :id => "1")
    end

<% unless options[:api] -%>
    it "routes to #edit" do
      expect(:get => "/<%= ns_table_name %>/1/edit").to route_to("<%= ns_table_name %>#edit", :id => "1")
    end
<% end -%>

    it "routes to #create" do
      expect(:post => "/<%= ns_table_name %>").to route_to("<%= ns_table_name %>#create")
    end

    it "routes to #update via PUT" do
      expect(:put => "/<%= ns_table_name %>/1").to route_to("<%= ns_table_name %>#update", :id => "1")
    end

<% if Rails::VERSION::STRING > '4' -%>
    it "routes to #update via PATCH" do
      expect(:patch => "/<%= ns_table_name %>/1").to route_to("<%= ns_table_name %>#update", :id => "1")
    end

<% end -%>
    it "routes to #destroy" do
      expect(:delete => "/<%= ns_table_name %>/1").to route_to("<%= ns_table_name %>#destroy", :id => "1")
    end

  end
end
<% end -%>

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rspec-rails-3.7.2 lib/generators/rspec/scaffold/templates/routing_spec.rb
rspec-rails-3.7.1 lib/generators/rspec/scaffold/templates/routing_spec.rb
rspec-rails-3.7.0 lib/generators/rspec/scaffold/templates/routing_spec.rb
rspec-rails-3.6.1 lib/generators/rspec/scaffold/templates/routing_spec.rb
rspec-rails-3.6.0 lib/generators/rspec/scaffold/templates/routing_spec.rb
rspec-rails-3.6.0.beta2 lib/generators/rspec/scaffold/templates/routing_spec.rb
rspec-rails-3.6.0.beta1 lib/generators/rspec/scaffold/templates/routing_spec.rb