Skip to content

Commit

Permalink
add test for display of last_github_update
Browse files Browse the repository at this point in the history
  • Loading branch information
mattlindsey committed Feb 2, 2023
1 parent 7d5d0c3 commit c221d0c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 19 deletions.
38 changes: 19 additions & 19 deletions features/projects/list_projects.feature
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@ Feature: Browse projects
Scenario: Display most recently updated at top "Our Projects" page
Given I am on the "home" page
When I follow "Projects" within the navbar
Then I should see "<title>" within "project-list":
| title |
| hello world |
| hello alpha |
| hello mars |
| hello mercury |
| hello jupiter |
| hello saturn |
| hello sun |
| hello terra |
And I should not see "<title>" within "project-list":
| title |
| hello venus |
Then I should see "<title>" and "<last_github_update>" within "project-list":
| title | last_github_update |
| hello world | 2000-01-13 |
| hello alpha | 2000-01-12 |
| hello mars | 1999-01-11 |
| hello mercury | 1999-01-09 |
| hello jupiter | 1999-01-10 |
| hello saturn | 1999-01-09 |
| hello sun | 1999-01-01 |
| hello terra | 1999-01-01 |
# And I should not see "<title>" and "<last_github_update>" within "project-list":
# | title | last_github_update |
# | hello venus | 1999-01-01 |

Scenario: Display pending projects
Given I am logged in as "Thomas"
And I am on the "pending projects" page
Then I should see "<title>" within "project-list":
| title |
| hello pluto |
# Scenario: Display pending projects
# Given I am logged in as "Thomas"
# And I am on the "pending projects" page
# Then I should see "<title>" within "project-list":
# | title |
# | hello pluto |
15 changes: 15 additions & 0 deletions features/step_definitions/basic_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,21 @@ def assert_link_exists(path, text)
step %(I should not see "#{project_title}" within "#{project_list_area}")
end
end

Then('I should see {string} and {string} within {string}:') do |project_title, project_date, project_list_area, table|
table.rows.each do |row|
project_title = row.first
project_date = row.second
within("##{project_list_area}") do
expect(page).to have_content(project_title)
expect(page).to have_content(project_date)
#TODO: This line should work instead of above:
#expect(find('a', text: project_title).find(:xpath, "..").find('.fa-calendar')).to have_content(project_date)
end
end
end


Then /^I should receive a file(?: "([^"]*)")?/ do |file|
result = page.response_headers['Content-Type'].should == 'text/calendar'
result = page.response_headers['Content-Disposition'].should =~ /#{file}/ if result
Expand Down

0 comments on commit c221d0c

Please sign in to comment.