File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 1515def 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'" )
1920end
2021
2122Given /^I have uploaded a program$/ do
@@ -53,6 +54,18 @@ def visit_user_programs_page
5354 visit_user_programs_page
5455end
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!" )
5871end
You can’t perform that action at this time.
0 commit comments