Sha256: ed69001c8384aa58c026be62c64b900d9ffab35381004c8babb7d75b6c166a8d

Contents?: true

Size: 1.75 KB

Versions: 7

Compression:

Stored size: 1.75 KB

Contents

require "rails_helper"

#The standard rest routes for the <%= HorsePower.get_plural(resource_name) %> controller
RSpec.describe "<%= HorsePower.get_camel_plural(resource_name) %> controller rest routing", :type => :routing do

	it "routes to index" do
		expect(:get => "/api/<%= api_version %>/<%= HorsePower.get_plural(resource_name) %>").to route_to(
			:controller => "api/v<%= api_version %>/<%= HorsePower.get_plural(resource_name) %>",
			:action => "index"
		)
	end
	it "routes to show" do
		expect(:get => "/api/<%= api_version %>/<%= HorsePower.get_plural(resource_name) %>/1").to route_to(
			:controller => "api/v<%= api_version %>/<%= HorsePower.get_plural(resource_name) %>",
			:action => "show",
			:id => "1"
		)
	end
	it "routes to create" do
		expect(:post => "/api/<%= api_version %>/<%= HorsePower.get_plural(resource_name) %>/").to route_to(
			:controller => "api/v<%= api_version %>/<%= HorsePower.get_plural(resource_name) %>",
			:action => "create"
		)
	end
	it "routes to update" do
		expect(:put => "/api/<%= api_version %>/<%= HorsePower.get_plural(resource_name) %>/1/").to route_to(
			:controller => "api/v<%= api_version %>/<%= HorsePower.get_plural(resource_name) %>",
			:action => "update",
			:id => "1"
		)
	end
	it "routes to update" do
		expect(:patch => "/api/<%= api_version %>/<%= HorsePower.get_plural(resource_name) %>/1/").to route_to(
			:controller => "api/v<%= api_version %>/<%= HorsePower.get_plural(resource_name) %>",
			:action => "update",
			:id => "1"
		)
	end
	it "routes to delete" do
		expect(:delete => "/api/<%= api_version %>/<%= HorsePower.get_plural(resource_name) %>/1/").to route_to(
			:controller => "api/v<%= api_version %>/<%= HorsePower.get_plural(resource_name) %>",
			:action => "destroy",
			:id => "1"
		)
	end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
horse_power-0.2.0 lib/generators/horse_power/tests/templates/routing.rb.erb
horse_power-0.1.6 lib/generators/horse_power/tests/templates/routing.rb.erb
horse_power-0.1.5 lib/generators/horse_power/tests/templates/routing.rb.erb
horse_power-0.1.2 lib/generators/horse_power/tests/templates/routing.rb.erb
horse_power-0.1.1 lib/generators/horse_power/tests/templates/routing.rb.erb
horse_power-0.1.0 lib/generators/horse_power/tests/templates/routing.rb.erb
horse_power-0.0.1 lib/generators/horse_power/tests/templates/routing.rb.erb