From 325cef82a54f42d528945a11a2306d6b11e6d6d7 Mon Sep 17 00:00:00 2001 From: Marnen Laibow-Koser Date: Tue, 13 Mar 2012 10:46:45 -0400 Subject: [PATCH] Show attendance status on comments. [#74] --- app/views/events/_comments.html.haml | 2 +- app/views/events/_event.html.haml | 2 +- .../add_comment_to_commitment.feature | 16 ++++++++++++++++ features/support/selectors.rb | 4 ++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/app/views/events/_comments.html.haml b/app/views/events/_comments.html.haml index 6648fd15..44590596 100644 --- a/app/views/events/_comments.html.haml +++ b/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 diff --git a/app/views/events/_event.html.haml b/app/views/events/_event.html.haml index 0e10eb70..400e7a89 100644 --- a/app/views/events/_event.html.haml +++ b/app/views/events/_event.html.haml @@ -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) diff --git a/features/commitments/add_comment_to_commitment.feature b/features/commitments/add_comment_to_commitment.feature index 742aeda3..d38cf2aa 100644 --- a/features/commitments/add_comment_to_commitment.feature +++ b/features/commitments/add_comment_to_commitment.feature @@ -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 "" from "status" + And I fill in "comment" with "text" + And I press "Change status" + Then I should see "John Doe:" within a user comment + + Examples: + | status | + | attending | + | not attending | + | uncommitted | diff --git a/features/support/selectors.rb b/features/support/selectors.rb index 52a7c707..d4587afd 100644 --- a/features/support/selectors.rb +++ b/features/support/selectors.rb @@ -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: