diff --git a/features/conversations.feature b/features/conversations.feature index 2fe01e1de..55626aa03 100644 --- a/features/conversations.feature +++ b/features/conversations.feature @@ -10,17 +10,8 @@ Feature: private messages When I sign in as "bob@bob.bob" And a user with username "bob" is connected with "Alice_Awesome" - And I am on the conversations page - Scenario: send a message - Given I follow "New Message" - And I wait for the ajax to finish - And I fill in "contact_autocomplete" with "Alice" in the modal window - And I press the first ".as-result-item" within ".as-results" in the modal window - And I fill in "conversation_subject" with "Greetings" in the modal window - And I fill in "conversation_text" with "hello, alice!" in the modal window - And I press "Send" in the modal window - And I wait for the ajax to finish + Given I send a message with subject "Greetings" and text "hello, alice!" to "Alice Awesome" Then I should see "Greetings" within "#conversation_inbox" And I should see "Greetings" within "#conversation_show" And "Alice Awesome" should be part of active conversation diff --git a/features/step_definitions/conversations_steps.rb b/features/step_definitions/conversations_steps.rb index a5b53e752..49ca7f4cf 100644 --- a/features/step_definitions/conversations_steps.rb +++ b/features/step_definitions/conversations_steps.rb @@ -3,3 +3,15 @@ Then /^"([^"]*)" should be part of active conversation$/ do |name| find("img.avatar[title^='#{name} ']").should_not be_nil end end + +Then /^I send a message with subject "([^"]*)" and text "([^"]*)" to "([^"]*)"$/ do |subject, text, person| + Given %(I am on the conversations page) + And %(I follow "New Message") + And %(I wait for the ajax to finish) + And %(I fill in "contact_autocomplete" with "#{person}" in the modal window) + And %(I press the first ".as-result-item" within ".as-results" in the modal window) + And %(I fill in "conversation_subject" with "#{subject}" in the modal window) + And %(I fill in "conversation_text" with "#{text}" in the modal window) + And %(I press "Send" in the modal window) + And %(I wait for the ajax to finish) +end