Created
March 21, 2017 19:42
-
-
Save smkopp92/494d138adfac44f3c2a18d666da08435 to your computer and use it in GitHub Desktop.
API Controller Test
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
require "rails_helper" | |
describe Api::V1::LessonSupplementsController do | |
describe "#show" do | |
let(:desired_response) do | |
{ | |
lessonSupplement: { | |
id: lesson_supplement.id, | |
title: lesson_supplement.title, | |
type: lesson_supplement.type, | |
url: lesson_supplement.url | |
}.stringify_keys | |
}.stringify_keys | |
end | |
let(:lesson_supplement) { create(:lesson_supplement) } | |
let(:team) { create(:team) } | |
let(:on_campus_week) { create(:on_campus_week, team: team) } | |
it "provides LessonSupplements associated with that team and week" do | |
get :show, team_slug: team.slug, on_campus_week_id: on_campus_week.id, id: lesson_supplement.id | |
# post(:create, rating: rating, lesson_slug: lesson.slug) FOR POST REQUESTS INSTEAD | |
parsed = JSON.parse(response.body) | |
expect(parsed).to eq desired_response | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment