Skip to content
Snippets Groups Projects
Commit a0e6433f authored by Dennis Collinson's avatar Dennis Collinson
Browse files

test multiple file upload in cucumber

parent 60420f10
No related branches found
No related tags found
No related merge requests found
......@@ -41,13 +41,23 @@ Then /^"([^"]*)" should be a (limited|public) post in my stream$/ do |post_text,
end
When /^I upload a fixture picture with filename "([^"]*)"$/ do |file_name|
orig_photo_count = all(".photos img").size
within ".new_photo" do
attach_file "photo[user_file]", Rails.root.join("spec", "fixtures", file_name)
wait_until { all(".photos img").size == orig_photo_count + 1 }
end
@image_source = find(".photos img")["src"]
@image_sources ||= {}
@image_sources[file_name] = all(".photos img").last["src"]
@image_sources[file_name].should be_present
end
Then /^"([^"]*)" should have the "([^"]*)" picture$/ do |post_text, file_name|
image = find_post_by_text(post_text).find(".photo_attachments img[src='#{@image_sources[file_name]}']")
image.should be_present
end
Then /^"([^"]*)" should have my photo$/ do |status_text|
find_post_by_text(status_text).find(".photo_attachments img")["src"].should == @image_source
Then /^"([^"]*)" should have (\d+) pictures$/ do |post_text, number_of_pictures|
find_post_by_text(post_text).all(".photo_attachments img").size.should == number_of_pictures.to_i
end
\ No newline at end of file
......@@ -5,13 +5,15 @@ Feature: Creating a new post
And I sign in as "bob@bob.bob"
And I trumpet
Scenario: Posting a public message
And I write "Rectangles are awesome"
Scenario: Posting a public message with a photo
And I write "I love RMS"
When I select "Public" in my aspects dropdown
And I upload a fixture picture with filename "button.gif"
When I press "Share"
When I go to "/stream"
Then I should see "Rectangles are awesome" as the first post in my stream
And "Rectangles are awesome" should be a public post in my stream
Then I should see "I love RMS" as the first post in my stream
And "I love RMS" should be a public post in my stream
Then "I love RMS" should have the "button.gif" picture
Scenario: Posting to Aspects
And I write "This is super skrunkle"
......@@ -29,9 +31,10 @@ Feature: Creating a new post
And I go to "/stream"
Then I follow "Alice Smith"
Scenario: Uploading a photo
When I write "check out this picture"
Scenario: Uploading multiple photos
When I write "check out these pictures"
And I upload a fixture picture with filename "button.gif"
And I upload a fixture picture with filename "button.gif"
And I press "Share"
And I go to "/stream"
Then "check out this picture" should have my photo
Then "check out these pictures" should have 2 pictures
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment