|
10 | 10 | let!(:submission2_review) { FactoryGirl.create(:review, review_body: 'submission2_review body', submission: submission2) } |
11 | 11 |
|
12 | 12 | before(:each) do |
13 | | - controller.stub(:doorkeeper_token) { token } |
| 13 | + allow(controller).to receive(:doorkeeper_token) { token } |
14 | 14 | end |
15 | 15 |
|
16 | 16 | describe "GET reviews for a course for current user's submissions" do |
|
23 | 23 | get :index, course_id: course.id |
24 | 24 | expect(response).to have_http_status(:success) |
25 | 25 | json = JSON.parse response.body |
26 | | - json[0]['submission_id'].should eq(review.submission.id) |
27 | | - json[0]['exercise_name'].should eq(exercise.name) |
28 | | - json[0]['id'].should eq(review.id) |
29 | | - json[0]['reviewer_name'].should eq(user.username) |
30 | | - json[0]['review_body'].should eq(review.review_body) |
| 26 | + expect(json[0]['submission_id']).to eq(review.submission.id) |
| 27 | + expect(json[0]['exercise_name']).to eq(exercise.name) |
| 28 | + expect(json[0]['id']).to eq(review.id) |
| 29 | + expect(json[0]['reviewer_name']).to eq(user.username) |
| 30 | + expect(json[0]['review_body']).to eq(review.review_body) |
31 | 31 | expect(response.body).not_to include submission2_review.review_body |
32 | 32 | end |
33 | 33 | end |
|
51 | 51 | get :index, course_id: course.id |
52 | 52 | expect(response).to have_http_status(:success) |
53 | 53 | json = JSON.parse response.body |
54 | | - json[0]['submission_id'].should eq(review.submission.id) |
55 | | - json[0]['exercise_name'].should eq(exercise.name) |
56 | | - json[0]['id'].should eq(review.id) |
57 | | - json[0]['reviewer_name'].should eq(user.username) |
58 | | - json[0]['review_body'].should eq(review.review_body) |
| 54 | + expect(json[0]['submission_id']).to eq(review.submission.id) |
| 55 | + expect(json[0]['exercise_name']).to eq(exercise.name) |
| 56 | + expect(json[0]['id']).to eq(review.id) |
| 57 | + expect(json[0]['reviewer_name']).to eq(user.username) |
| 58 | + expect(json[0]['review_body']).to eq(review.review_body) |
59 | 59 | expect(response.body).not_to include submission2_review.review_body |
60 | 60 | end |
61 | 61 | end |
|
0 commit comments