Skip to content

Commit ad2c27d

Browse files
committed
Formatting and breadrumbs.
Features weren't fixed with whitespace, and adding breadcumbs to forums.
1 parent 0d35500 commit ad2c27d

20 files changed

Lines changed: 315 additions & 259 deletions

Rakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ namespace :whitespace do
114114
end
115115
task :retab do
116116
sh %{find . -name '*.rb' -exec sed -i '' 's/\t/ /g' {} \\;}
117+
sh %{find . -name '*.feature' -exec sed -i '' 's/\t/ /g' {} \\;}
117118
end
118119
end
119120

controllers/forums.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#you can view an individual forum here!
99
get "/forums/:forum" do
10-
10+
1111
#we use this in the view
1212
@forum = params[:forum]
1313

controllers/hacker.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
end
3232

3333
redirect "/hackers/#{current_user.username}"
34-
34+
3535
end
3636

3737
#this lets you follow a Hacker
@@ -67,7 +67,7 @@
6767

6868
#find the hacker with the given name
6969
@hacker = Hacker.first(:username => params[:name])
70-
70+
7171
#make sure we're not following them already
7272
unless current_user.following? @hacker
7373
flash[:notice] = "You're already not following #{params[:name]}."

controllers/sessions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
redirect '/'
2626
else
2727
#this is what happens if the information is bad.
28-
28+
2929
#set an error message
3030
flash[:notice] = 'There were some problems creating your account. Please be sure you\'ve entered all your information correctly.'
3131

factories/discussion.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
Factory.define :discussion do |d|
2+
d.forum "learning_ruby"
3+
d.title "A discussion"
24
d.author "jane_hacker"
35
d.author_email "jane_hacker@example.com"
46
end

features/blog.feature

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,77 @@
11
Feature: The Hackety Blog
2-
Scenario: I can see the blog
3-
Given there is a blog post with the title "First Post"
4-
When I go to the blog page
5-
Then I should see "First Post"
6-
Scenario: Admins may create a post
7-
Given I'm logged in as admin
8-
And I go to the new post page
9-
When I fill in "Title" with "new title"
10-
And I fill in "Body" with "new body"
11-
And I fill in "Slug" with "new_title"
12-
And I press "Create Post"
13-
Then I should see "Post Created"
14-
And I should see "new title"
15-
And I should see "new body"
16-
Scenario: I can view all posts
17-
Given there is a blog post with the title "First Post"
18-
And there is a blog post with the title "Second Post"
19-
When I go to the posts page
20-
Then I should see "First Post"
21-
And I should see "Second Post"
22-
Scenario: Not logged in users cannot create a post
23-
Given I'm not logged in
24-
And I go to the new post page
25-
Then I should see "Sorry, buddy"
26-
Scenario: Non-admin users cannot create a post
27-
Given I'm logged in
28-
And I go to the new post page
29-
Then I should see "Sorry, buddy"
30-
Scenario: Admins may edit a post
31-
Given I'm logged in as admin
32-
And there is a blog post with the title "First Post"
33-
And I go to the edit post page for the post with the title "First Post"
34-
And I fill in "Title" with "new title"
35-
And I fill in "Slug" with "new_title"
36-
And I fill in "Body" with "new body"
37-
When I press "Modify Post"
38-
Then I should see "Post Modified"
39-
And I am on the post page for the post with the title "new title"
40-
And I should see "new title"
41-
And I should see "new body"
42-
Scenario: Not logged in users cannot edit a post
43-
Given I'm not logged in
44-
And there is a blog post with the title "First Post"
45-
And I go to the edit post page for the post with the title "First Post"
46-
Then I should see "Sorry, buddy"
47-
Scenario: Non-admin users cannot edit a post
48-
Given I'm logged in
49-
And there is a blog post with the title "First Post"
50-
And I go to the edit post page for the post with the title "First Post"
51-
Then I should see "Sorry, buddy"
52-
Scenario: Logged in Users can comment on the blog
53-
Given I'm logged in as "steve"
54-
And there is a blog post
55-
When I go to a blog post page
56-
And I fill in "Submit your opinion:" with "This post is amazing!"
57-
And I press "Submit"
58-
Then I should be on a blog post page
59-
And I should see "Thanks for your comment!"
60-
And I should see "steve says:"
61-
And I should see "This post is amazing!"
62-
Scenario: Logged out users can't comment on the blog
63-
Given I'm not logged in
64-
And there is a blog post
65-
When I go to a blog post page
66-
Then should not see "Submit your opinion:"
67-
And I should not see "Submit"
68-
Scenario: Blog should use Markdown
69-
Given I'm logged in as admin
70-
And I go to the new post page
71-
When I fill in "Title" with "new title"
72-
And I fill in "Slug" with "new_title"
73-
And I fill in "Body" with "new body with a link: [google](http://google.com/)"
74-
And I press "Create Post"
75-
Then I should see "Post Created"
76-
And I should see "new title"
77-
And I should see "google" within "//a"
2+
Scenario: I can see the blog
3+
Given there is a blog post with the title "First Post"
4+
When I go to the blog page
5+
Then I should see "First Post"
6+
Scenario: Admins may create a post
7+
Given I'm logged in as admin
8+
And I go to the new post page
9+
When I fill in "Title" with "new title"
10+
And I fill in "Body" with "new body"
11+
And I fill in "Slug" with "new_title"
12+
And I press "Create Post"
13+
Then I should see "Post Created"
14+
And I should see "new title"
15+
And I should see "new body"
16+
Scenario: I can view all posts
17+
Given there is a blog post with the title "First Post"
18+
And there is a blog post with the title "Second Post"
19+
When I go to the posts page
20+
Then I should see "First Post"
21+
And I should see "Second Post"
22+
Scenario: Not logged in users cannot create a post
23+
Given I'm not logged in
24+
And I go to the new post page
25+
Then I should see "Sorry, buddy"
26+
Scenario: Non-admin users cannot create a post
27+
Given I'm logged in
28+
And I go to the new post page
29+
Then I should see "Sorry, buddy"
30+
Scenario: Admins may edit a post
31+
Given I'm logged in as admin
32+
And there is a blog post with the title "First Post"
33+
And I go to the edit post page for the post with the title "First Post"
34+
And I fill in "Title" with "new title"
35+
And I fill in "Slug" with "new_title"
36+
And I fill in "Body" with "new body"
37+
When I press "Modify Post"
38+
Then I should see "Post Modified"
39+
And I am on the post page for the post with the title "new title"
40+
And I should see "new title"
41+
And I should see "new body"
42+
Scenario: Not logged in users cannot edit a post
43+
Given I'm not logged in
44+
And there is a blog post with the title "First Post"
45+
And I go to the edit post page for the post with the title "First Post"
46+
Then I should see "Sorry, buddy"
47+
Scenario: Non-admin users cannot edit a post
48+
Given I'm logged in
49+
And there is a blog post with the title "First Post"
50+
And I go to the edit post page for the post with the title "First Post"
51+
Then I should see "Sorry, buddy"
52+
Scenario: Logged in Users can comment on the blog
53+
Given I'm logged in as "steve"
54+
And there is a blog post
55+
When I go to a blog post page
56+
And I fill in "Submit your opinion:" with "This post is amazing!"
57+
And I press "Submit"
58+
Then I should be on a blog post page
59+
And I should see "Thanks for your comment!"
60+
And I should see "steve says:"
61+
And I should see "This post is amazing!"
62+
Scenario: Logged out users can't comment on the blog
63+
Given I'm not logged in
64+
And there is a blog post
65+
When I go to a blog post page
66+
Then should not see "Submit your opinion:"
67+
And I should not see "Submit"
68+
Scenario: Blog should use Markdown
69+
Given I'm logged in as admin
70+
And I go to the new post page
71+
When I fill in "Title" with "new title"
72+
And I fill in "Slug" with "new_title"
73+
And I fill in "Body" with "new body with a link: [google](http://google.com/)"
74+
And I press "Create Post"
75+
Then I should see "Post Created"
76+
And I should see "new title"
77+
And I should see "google" within "//a"

features/forum.feature

Lines changed: 60 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,61 @@
11
Feature: The Hackety Forum
2-
Scenario: View all forums
3-
Given I'm logged in
4-
When I go to the forums
5-
Then I should see "Learning Ruby"
6-
And I should see "Hackety Help"
7-
And I should see "Clubhouse"
8-
Scenario: View discussions in a forum
9-
Given I'm logged in
10-
And there's a discussion named "I need help!" in "learning_ruby"
11-
When I go to the forums
12-
And I follow "Learning Ruby"
13-
Then I should see "I need help!"
14-
Scenario: View replies to a discussion
15-
Given I'm logged in
16-
And there's a discussion named "I need help" in "learning_ruby" with a reply
17-
When I go to the discussion "i_need_help" in "learning_ruby"
18-
Then I should see "I need help"
19-
And I should see "I'm here to help!"
20-
Scenario: Make a new reply
21-
Given I'm logged in as "steve"
22-
And there's a discussion named "I need help" in "learning_ruby" with a reply
23-
And I go to the forums
24-
And I follow "Learning Ruby"
25-
And I follow "I need help"
26-
When I follow "Reply"
27-
And I fill in "Body" with "I'll help you!"
28-
And I press "Create Reply"
29-
Then I should be on the discussion "i_need_help" in "learning_ruby"
30-
And I should see "Replied!"
31-
And I should see "I'll help you"
32-
And I should see "steve says:"
33-
Scenario: Make a new discussion
34-
Given I'm logged in as "some_hacker"
35-
And I go to the forums
36-
And I follow "Learning Ruby"
37-
When I follow "New Discussion"
38-
And I fill in "Title" with "HALP!"
39-
And I fill in "Body" with "I'm really unsure as to how to do something."
40-
And I press "Submit"
41-
Then I should be on the discussion "halp" in "learning_ruby"
42-
And I should see "Discussion created!"
43-
And I should see "HALP!"
44-
And I should see "By some_hacker"
45-
Scenario: Can't make discussions when logged out
46-
Given I'm not logged in
47-
And I go to the forums
48-
When I follow "Learning Ruby"
49-
Then I should not see "New Discussion"
50-
Scenario: Can't make replies when logged out
51-
Given I'm not logged in
52-
And there's a discussion named "I need help" in "learning_ruby" with a reply
53-
And I go to the forums
54-
And I follow "Learning Ruby"
55-
When I follow "I need help"
56-
Then I should not see "Reply"
2+
Scenario: View all forums
3+
Given I'm logged in
4+
When I go to the forums
5+
Then I should see "Learning Ruby"
6+
And I should see "Hackety Help"
7+
And I should see "Clubhouse"
8+
Scenario: View discussions in a forum
9+
Given I'm logged in
10+
And there's a discussion named "I need help!" in "learning_ruby"
11+
When I go to the forums
12+
And I follow "Learning Ruby"
13+
Then I should see "I need help!"
14+
Scenario: View replies to a discussion
15+
Given I'm logged in
16+
And there's a discussion named "I need help" in "learning_ruby" with a reply
17+
When I go to the discussion "i_need_help" in "learning_ruby"
18+
Then I should see "I need help"
19+
And I should see "I'm here to help!"
20+
Scenario: Make a new reply
21+
Given I'm logged in as "steve"
22+
And there's a discussion named "I need help" in "learning_ruby" with a reply
23+
And I go to the forums
24+
And I follow "Learning Ruby"
25+
And I follow "I need help"
26+
When I follow "Reply"
27+
And I fill in "Body" with "I'll help you!"
28+
And I press "Create Reply"
29+
Then I should be on the discussion "i_need_help" in "learning_ruby"
30+
And I should see "Replied!"
31+
And I should see "I'll help you"
32+
And I should see "steve says:"
33+
Scenario: Make a new discussion
34+
Given I'm logged in as "some_hacker"
35+
And I go to the forums
36+
And I follow "Learning Ruby"
37+
When I follow "New Discussion"
38+
And I fill in "Title" with "HALP!"
39+
And I fill in "Body" with "I'm really unsure as to how to do something."
40+
And I press "Submit"
41+
Then I should be on the discussion "halp" in "learning_ruby"
42+
And I should see "Discussion created!"
43+
And I should see "HALP!"
44+
And I should see "By some_hacker"
45+
Scenario: Can't make discussions when logged out
46+
Given I'm not logged in
47+
And I go to the forums
48+
When I follow "Learning Ruby"
49+
Then I should not see "New Discussion"
50+
Scenario: Can't make replies when logged out
51+
Given I'm not logged in
52+
And there's a discussion named "I need help" in "learning_ruby" with a reply
53+
And I go to the forums
54+
And I follow "Learning Ruby"
55+
When I follow "I need help"
56+
Then I should not see "Reply"
57+
Scenario: Breadcrumbs
58+
Given there's a discussion
59+
When I go to the discussion
60+
Then I should see "Hackety Forums"
61+
Then I should see the discussion's forum name

0 commit comments

Comments
 (0)