|
22 | 22 | end |
23 | 23 |
|
24 | 24 | shared_examples "check if comment is added" do |expect_comment_count| |
25 | | - expect(page).to have_css(".js-comment-author", text: name) |
26 | | - expect(page).to have_css(".js-comment-text", text: text) |
27 | | - expect(page).to have_no_content("Your comment was not saved!") |
| 25 | + expect(subject).to have_css(".js-comment-author", text: name) |
| 26 | + expect(subject).to have_css(".js-comment-text", text: text) |
| 27 | + expect(subject).to have_no_content("Your comment was not saved!") |
28 | 28 | if expect_comment_count |
29 | | - expect(page).to have_css("#js-comment-count", |
| 29 | + expect(subject).to have_css("#js-comment-count", |
30 | 30 | text: "Comments: #{Comment.count}") |
31 | 31 | end |
32 | 32 | end |
33 | 33 |
|
34 | 34 | shared_examples "expect failed validation" do |
35 | | - expect(page).to have_content("Your comment was not saved!") |
36 | | - expect(page).to have_content("Author: can't be blank") |
37 | | - expect(page).to have_content("Text: can't be blank") |
| 35 | + expect(subject).to have_content("Your comment was not saved!") |
| 36 | + expect(subject).to have_content("Author: can't be blank") |
| 37 | + expect(subject).to have_content("Text: can't be blank") |
38 | 38 | end |
39 | 39 |
|
40 | 40 | shared_examples "expect successful validation" do |
41 | | - expect(page).to have_no_content("Your comment was not saved!") |
42 | | - expect(page).to have_no_content("Author: can't be blank") |
43 | | - expect(page).to have_no_content("Text: can't be blank") |
| 41 | + expect(subject).to have_no_content("Your comment was not saved!") |
| 42 | + expect(subject).to have_no_content("Author: can't be blank") |
| 43 | + expect(subject).to have_no_content("Text: can't be blank") |
44 | 44 | end |
45 | 45 |
|
46 | 46 | # Form Submission |
|
0 commit comments