Skip to content

Commit 2e0db2e

Browse files
committed
can view forum discussions
1 parent 85d6b84 commit 2e0db2e

3 files changed

Lines changed: 29 additions & 6 deletions

File tree

features/forum.feature

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
Feature: The Hackety Forum
2-
Scenario: View discussions in a forum
3-
Given I'm logged in
4-
And there's a discussion named "I need help!" in "learning_ruby"
5-
When I go to the forums
6-
And I follow "Learning Ruby"
7-
Then I should see "I need help!"
82
Scenario: View replies to a discussion
93
Given I'm logged in
104
And there's a discussion named "I need help" in "learning_ruby" with a reply

spec/acceptance/forum_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,16 @@
1313
page.should have_content "Clubhouse"
1414
end
1515

16+
scenario "can view discussions" do
17+
@hacker = Factory(:hacker)
18+
log_in @hacker
19+
20+
title = "I need help!"
21+
Factory(:discussion, :title => title, :forum => "learning_ruby")
22+
23+
visit "/forums"
24+
click_link "Learning Ruby"
25+
page.should have_content "I need help!"
26+
end
27+
1628
end

spec/factories.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,20 @@
2626
p.title { Factory.next(:program_title) }
2727
p.code "puts 'hello world'"
2828
end
29+
30+
Factory.define :discussion do |d|
31+
d.forum "learning_ruby"
32+
d.title "A discussion"
33+
d.author "jane_hacker"
34+
d.author_email "jane_hacker@example.com"
35+
end
36+
Factory.define :discussion_with_reply, :parent => :discussion do |t|
37+
t.replies {|r| [Factory(:reply)] }
38+
end
39+
40+
Factory.define :reply do |r|
41+
r.body "I'm here to help!"
42+
r.author "john_hacker"
43+
r.author_email "john_hacker@example.com"
44+
end
45+

0 commit comments

Comments
 (0)