Skip to content

Commit

Permalink
Show attendance status on comments. [#74]
Browse files Browse the repository at this point in the history
  • Loading branch information
marnen committed Mar 13, 2012
1 parent 2035ce4 commit 325cef8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/views/events/_comments.html.haml
@@ -1,5 +1,5 @@
- unless comments.empty?
%div.comments
- comments.each do |comment|
%span.user== #{comment.user}:
%span.user{class: attendance_status(event, comment.user)}== #{comment.user}:
= comment.comment
2 changes: 1 addition & 1 deletion app/views/events/_event.html.haml
Expand Up @@ -31,7 +31,7 @@
%div.description
:markdown
#{h event.description}
= render partial: 'comments', locals: {comments: event.comments}
= render partial: 'comments', locals: {event: event, comments: event.comments}
= render :partial => 'attendance', :locals => {:event => event}
- yes = event.find_committed(:yes)
- no = event.find_committed(:no)
Expand Down
16 changes: 16 additions & 0 deletions features/commitments/add_comment_to_commitment.feature
Expand Up @@ -29,3 +29,19 @@ Feature: Add comment to commitment
Examples:
| comment |
| This is someone else's comment. |

Scenario Outline: Show attendance status on comments
Given a user named "John Doe" exists with email "john@doe.org"
And I am logged in as "john@doe.org"
And I am subscribed to "Calendar 1"
When I go to the event list
And I select "<status>" from "status"
And I fill in "comment" with "text"
And I press "Change status"
Then I should see "John Doe:" within a <status> user comment

Examples:
| status |
| attending |
| not attending |
| uncommitted |
4 changes: 4 additions & 0 deletions features/support/selectors.rb
Expand Up @@ -25,6 +25,10 @@ def selector_for(locator)
# when /the header/
# [:xpath, "//header"]

when /^an? (.+) user comment$/
status = {'attending' => :yes, 'not attending' => :no, 'uncommitted' => :maybe}[$1]
".comments .user.#{status}"

# This allows you to provide a quoted selector as the scope
# for "within" steps as was previously the default for the
# web steps:
Expand Down

0 comments on commit 325cef8

Please sign in to comment.