Last active
January 2, 2016 23:39
-
-
Save enricostano/8378025 to your computer and use it in GitHub Desktop.
This file contains 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
2.0.0p247 :001 > g = Group.first | |
Group Load (1.6ms) SELECT "groups".* FROM "groups" ORDER BY "groups"."id" ASC LIMIT 1 | |
=> #<Group id: 1, name: "coope", created_at: "2013-12-06 17:37:56", updated_at: "2013-12-06 17:37:56"> | |
2.0.0p247 :002 > g.as_json | |
=> {"id"=>1, "name"=>"coope", "created_at"=>Fri, 06 Dec 2013 17:37:56 UTC +00:00, "updated_at"=>Fri, 06 Dec 2013 17:37:56 UTC +00:00} |
This file contains 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
1) Api::V1::GroupsController Authenticated user Group admin user GET #index returns an array of groups where user is admin | |
Failure/Error: expect(api_response.body).to eq([group.to_json]) | |
expected: ["{\"id\":1061,\"name\":\"My group\",\"created_at\":\"2014-01-11T23:17:45.873Z\",\"updated_at\":\"2014-01-11T23:17:45.873Z\"}"] | |
got: "[{\"id\":1061,\"name\":\"My group\",\"created_at\":\"2014-01-11T23:17:45.873Z\",\"updated_at\":\"2014-01-11T23:17:45.873Z\"}]" | |
(compared using ==) | |
# ./spec/controllers/api/v1/groups_controller_spec.rb:168:in `block (5 levels) in <top (required)>' | |
This file contains 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
diff --git a/spec/controllers/api/v1/groups_controller_spec.rb b/spec/controllers/api/v1/groups_controller_spec.rb | |
index 698d4e7..f36eacc 100644 | |
--- a/spec/controllers/api/v1/groups_controller_spec.rb | |
+++ b/spec/controllers/api/v1/groups_controller_spec.rb | |
@@ -165,7 +165,7 @@ describe Api::V1::GroupsController do | |
it_behaves_like 'a successful request' | |
it 'returns an array of groups where user is admin' do | |
- expect(JSON.parse(api_response.body)).to eq([group.as_json]) | |
+ expect(api_response.body).to eq("[#{group.to_json}]") | |
end | |
end | |
@@ -177,7 +177,7 @@ describe Api::V1::GroupsController do | |
it_behaves_like 'a successful request' | |
it 'returns the group details' do | |
- expect(JSON.parse(api_response.body)).to eq(group.as_json) | |
+ expect(api_response.body).to eq(group.to_json) | |
end | |
end | |
@@ -201,7 +201,7 @@ describe Api::V1::GroupsController do | |
it_behaves_like 'a successful request' | |
it 'deletes the group' do | |
- expect(JSON.parse(api_response.body)).to eq(group.as_json) | |
+ expect(api_response.body).to eq(group.to_json) | |
end | |
end | |
end |
This file contains 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
diff --git a/spec/controllers/api/v1/groups_controller_spec.rb b/spec/controllers/api/v1/groups_controller_spec.rb | |
index 698d4e7..97dd994 100644 | |
--- a/spec/controllers/api/v1/groups_controller_spec.rb | |
+++ b/spec/controllers/api/v1/groups_controller_spec.rb | |
@@ -165,7 +165,7 @@ describe Api::V1::GroupsController do | |
it_behaves_like 'a successful request' | |
it 'returns an array of groups where user is admin' do | |
- expect(JSON.parse(api_response.body)).to eq([group.as_json]) | |
+ expect(JSON.parse(api_response.body)).to eq([JSON.parse(group.to_json)]) | |
end | |
end | |
@@ -177,7 +177,7 @@ describe Api::V1::GroupsController do | |
it_behaves_like 'a successful request' | |
it 'returns the group details' do | |
- expect(JSON.parse(api_response.body)).to eq(group.as_json) | |
+ expect(api_response.body).to eq(group.to_json) | |
end | |
end | |
@@ -201,7 +201,7 @@ describe Api::V1::GroupsController do | |
it_behaves_like 'a successful request' | |
it 'deletes the group' do | |
- expect(JSON.parse(api_response.body)).to eq(group.as_json) | |
+ expect(api_response.body).to eq(group.to_json) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment