Make and use a single cucumber step to send a private message

This commit is contained in:
Andrej Kacian 2011-08-13 05:03:27 +02:00
parent 9c99331bb7
commit 48282e3402
2 changed files with 13 additions and 10 deletions

View file

@ -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

View file

@ -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