Last active
December 19, 2015 16:28
-
-
Save ljkbennett/5983612 to your computer and use it in GitHub Desktop.
Mongoid route testing problems
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe "artifact routes" do | |
it "routes post /artifacts to artifacts#create" do | |
{post: "/artifacts"}.should route_to(controller: "artifacts", action: "create") | |
end | |
it "routes delete /artifacts/:id to artifacts#create" do | |
artifact = FactoryGirl.build(:artifact) | |
{delete: "/artifacts/#{artifact._id}"}.should route_to(controller: "artifacts", action: "destroy", id: artifact._id) | |
end | |
it "routes put /artifacts/:id to artifacts#update" do | |
artifact = FactoryGirl.build(:artifact) | |
{put: "/artifacts/#{artifact._id}"}.should route_to(controller: "artifacts", action: "update", id: artifact._id) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Failure/Error: {put: "/artifacts/#{artifact._id}"}.should route_to(controller: "artifacts", action: "update", id: artifact.id) | |
The recognized options <{"controller"=>"artifacts", | |
"action"=>"update", | |
"id"=>"51dfe0f251a6bc312a000002"}> did not match <{"controller"=>"artifacts", | |
"action"=>"update", | |
"id"=>"51dfe0f251a6bc312a000002"}>, difference: <{"id"=>"51dfe0f251a6bc312a000002"}>. | |
<{"controller"=>"artifacts", | |
"action"=>"update", | |
"id"=>"51dfe0f251a6bc312a000002"}> (Hash) expected but was | |
<{"controller"=>"artifacts", | |
"action"=>"update", | |
"id"=>"51dfe0f251a6bc312a000002"}> (ActiveSupport::HashWithIndifferentAccess). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe "artifact routes" do | |
it "routes post /artifacts to artifacts#create" do | |
{post: "/artifacts"}.should route_to(controller: "artifacts", action: "create") | |
end | |
it "routes delete /artifacts/:id to artifacts#create" do | |
artifact = FactoryGirl.build(:artifact) | |
{delete: "/artifacts/#{artifact._id}"}.should route_to(controller: "artifacts", action: "destroy", id: artifact._id.to_s) | |
end | |
it "routes put /artifacts/:id to artifacts#update" do | |
artifact = FactoryGirl.build(:artifact) | |
{put: "/artifacts/#{artifact._id}"}.should route_to(controller: "artifacts", action: "update", id: artifact._id.to_s) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment