Sha256: fcbe947f3a63abe61ac348ceede9e2beead17e0e76db2f6ce12222263455bfa7

Contents?: true

Size: 1.63 KB

Versions: 4

Compression:

Stored size: 1.63 KB

Contents

require "spec_helper"

describe <%= controller_class_name %>Controller do
  describe "routing" do

<% unless options[:singleton] -%>
    it "recognizes and generates #index" do
      { :get => "<%= base_url %>" }.should route_to(:controller => "<%= table_name %>", <%= ":#{parent_id} => '24', " if belongs_to %>:action => "index")
    end

<% end -%>
    it "recognizes and generates #new" do
      { :get => "<%= base_url %>/new" }.should route_to(:controller => "<%= table_name %>", <%= ":#{parent_id} => '24', " if belongs_to %>:action => "new")
    end

    it "recognizes and generates #show" do
      { :get => "<%= base_url %>/1" }.should route_to(:controller => "<%= table_name %>", <%= ":#{parent_id} => '24', " if belongs_to %>:action => "show", :id => "1")
    end

    it "recognizes and generates #edit" do
      { :get => "<%= base_url %>/1/edit" }.should route_to(:controller => "<%= table_name %>", <%= ":#{parent_id} => '24', " if belongs_to %>:action => "edit", :id => "1")
    end

    it "recognizes and generates #create" do
      { :post => "<%= base_url %>" }.should route_to(:controller => "<%= table_name %>", <%= ":#{parent_id} => '24', " if belongs_to %>:action => "create")
    end

    it "recognizes and generates #update" do
      { :put => "<%= base_url %>/1" }.should route_to(:controller => "<%= table_name %>", <%= ":#{parent_id} => '24', " if belongs_to %>:action => "update", :id => "1")
    end

    it "recognizes and generates #destroy" do
      { :delete => "<%= base_url %>/1" }.should route_to(:controller => "<%= table_name %>", <%= ":#{parent_id} => '24', " if belongs_to %>:action => "destroy", :id => "1")
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
my_generators-0.0.4 lib/generators/my_spec/scaffold/templates/routing_spec.rb
my_generators-0.0.3 lib/generators/my_spec/scaffold/templates/routing_spec.rb
my_generators-0.0.2 lib/generators/my_spec/scaffold/templates/routing_spec.rb
my_generators-0.0.1 lib/generators/my_spec/scaffold/templates/routing_spec.rb