Skip to content

Commit 89508d2

Browse files
committed
fix specs?
1 parent 5d01dc8 commit 89508d2

File tree

2 files changed

+11
-21
lines changed

2 files changed

+11
-21
lines changed

spec/system/edit_comment_spec.rb

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,20 @@
88
let(:comment) { Comment.first }
99

1010
context "when from classic page", page: :classic do
11-
before { click_link "Edit", match: :first }
12-
13-
context "when edit is submitted" do
11+
it "comment is updated when edit is submitted" do
12+
click_link "Edit", match: :first
1413
let(:edited_name) { "Abraham Lincoln" }
1514

1615
include_context "when Form Submitted", name: :edited_name
17-
18-
it "comment is updated" do
19-
expect(page).to have_css(".comment", text: :edited_name)
20-
expect(page).to have_css("#notice", text: "Comment was successfully updated.")
21-
end
16+
expect(page).to have_css(".comment", text: :edited_name)
17+
expect(page).to have_css("#notice", text: "Comment was successfully updated.")
2218
end
2319

24-
context "when edit is submitted with blank fields", blank_form_submitted: true do
25-
it "comment is not updated" do
26-
expect(page).not_to have_success_message
27-
expect(page).to have_failure_message
28-
expect(page).not_to have_css(".comment", text: "")
29-
end
20+
it "comment is not updated when edit is submitted with blank fields", blank_form_submitted: true do
21+
click_link "Edit", match: :first
22+
expect(page).not_to have_success_message
23+
expect(page).to have_failure_message
24+
expect(page).not_to have_css(".comment", text: "")
3025
end
3126
end
3227
end

spec/system/shared/contexts.rb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,8 @@
3535

3636
# Form Submission
3737
shared_context "when Form Submitted", form_submitted: true do |name: "Spicoli", text: "dude!"|
38-
let(:hint_name) { "Your Name" }
39-
let(:hint_text) { "Say something using markdown..." }
40-
let(:name) { name }
41-
let(:text) { text }
42-
43-
fill_in hint_name, with: name
44-
fill_in hint_text, with: text
38+
fill_in "Your Name", with: name
39+
fill_in "Say something using markdown...", with: text
4540
click_button "Post"
4641
end
4742

0 commit comments

Comments
 (0)