Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Description should be in program show

- Add scenarios around detecting program source and description.
  • Loading branch information...
commit c7857eaadff48f381020a90a6fae419d47b8060b 1 parent 8423d75
Matt Gauger authored committed
View
5 app/views/programs/index.html.haml
@@ -10,7 +10,7 @@
%h3 Featured
.description Our favorite selection of projects.
- %ul
+ %ul.featured_programs_list
- @featured.each do |program|
%li
.title= program_link program
@@ -22,12 +22,11 @@
%h3 All Programs
.description Every program uploaded by our users!
- %ul
+ %ul.programs_list
- @programs.each do |program|
%li
.title= program_link program
.author= author_link program.author_username, program
- .description= program.description
- if @user
%ul.inline-menu.bottom-nav
View
3  app/views/programs/show.html.haml
@@ -19,6 +19,9 @@
by
= link_to @program.author_username, user_path(@program.author_username)
+.description
+ %p= @program.description
+
#program
%pre.prettyprint= @program.source_code
View
11 features/programs.feature
@@ -15,8 +15,15 @@ Feature: Access Programs
Given a user has uploaded a program
Then I should be able to view their programs
+ Scenario: View an individual program
+ Given a user has uploaded a program
+ And I should be able to view their programs
+ When I click the first program link
+ Then I should see the program source
+
Scenario: View a program with a description
Given a user has uploaded a program
And they have given their program a description
- Then I should be able to view their programs
- And I should see the description on their program
+ And I should be able to view their programs
+ When I click the first program link
+ Then I should see the description of their program
View
17 features/step_definitions/program_steps.rb
@@ -15,7 +15,8 @@
def upload_program(user)
@program = Program.create!(:author_username => user.username,
:slug => "slug",
- :title => "#{user.username}'s program")
+ :title => "#{user.username}'s program",
+ :source_code => "puts 'Hello world'")
end
Given /^I have uploaded a program$/ do
@@ -53,6 +54,18 @@ def visit_user_programs_page
visit_user_programs_page
end
-Then /^I should see the description on their program$/ do
+When /^I click the first program link$/ do
+ within ".programs_list" do
+ find("li:first-child a").click()
+ end
+end
+
+Then /^I should see the program source$/ do
+ within("#program") do
+ page.should have_content("puts 'Hello world'")
+ end
+end
+
+Then /^I should see the description of their program$/ do
page.should have_content("A really cool program!")
end
Please sign in to comment.
Something went wrong with that request. Please try again.