Skip to content

Commit c7857ea

Browse files
Matt Gaugermathias
authored andcommitted
Description should be in program show
- Add scenarios around detecting program source and description.
1 parent 8423d75 commit c7857ea

4 files changed

Lines changed: 29 additions & 7 deletions

File tree

app/views/programs/index.html.haml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
%h3 Featured
1111
.description Our favorite selection of projects.
1212

13-
%ul
13+
%ul.featured_programs_list
1414
- @featured.each do |program|
1515
%li
1616
.title= program_link program
@@ -22,12 +22,11 @@
2222
%h3 All Programs
2323
.description Every program uploaded by our users!
2424

25-
%ul
25+
%ul.programs_list
2626
- @programs.each do |program|
2727
%li
2828
.title= program_link program
2929
.author= author_link program.author_username, program
30-
.description= program.description
3130

3231
- if @user
3332
%ul.inline-menu.bottom-nav

app/views/programs/show.html.haml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
by
2020
= link_to @program.author_username, user_path(@program.author_username)
2121

22+
.description
23+
%p= @program.description
24+
2225
#program
2326
%pre.prettyprint= @program.source_code
2427

features/programs.feature

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,15 @@ Feature: Access Programs
1515
Given a user has uploaded a program
1616
Then I should be able to view their programs
1717

18+
Scenario: View an individual program
19+
Given a user has uploaded a program
20+
And I should be able to view their programs
21+
When I click the first program link
22+
Then I should see the program source
23+
1824
Scenario: View a program with a description
1925
Given a user has uploaded a program
2026
And they have given their program a description
21-
Then I should be able to view their programs
22-
And I should see the description on their program
27+
And I should be able to view their programs
28+
When I click the first program link
29+
Then I should see the description of their program

features/step_definitions/program_steps.rb

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
def upload_program(user)
1616
@program = Program.create!(:author_username => user.username,
1717
:slug => "slug",
18-
:title => "#{user.username}'s program")
18+
:title => "#{user.username}'s program",
19+
:source_code => "puts 'Hello world'")
1920
end
2021

2122
Given /^I have uploaded a program$/ do
@@ -53,6 +54,18 @@ def visit_user_programs_page
5354
visit_user_programs_page
5455
end
5556

56-
Then /^I should see the description on their program$/ do
57+
When /^I click the first program link$/ do
58+
within ".programs_list" do
59+
find("li:first-child a").click()
60+
end
61+
end
62+
63+
Then /^I should see the program source$/ do
64+
within("#program") do
65+
page.should have_content("puts 'Hello world'")
66+
end
67+
end
68+
69+
Then /^I should see the description of their program$/ do
5770
page.should have_content("A really cool program!")
5871
end

0 commit comments

Comments
 (0)