Created
February 15, 2010 20:45
-
-
Save maurcs/304970 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Then /^the "([^\"]*)" "([^\"]*)" should have a "([^\"]*)" attachment$/ do |meth, mdl, field| | |
user = mdl.constantize.send(meth,:order=>"created_at") | |
user.image.should be_a_kind_of Grip::Attachment | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given I am on create account | |
... | |
When I attach the file "features/support/assets/test_profile_image.jpg" to "user[image]" | |
When I press "Save Changes" | |
Then my account should be created | |
And the "last" "User" should have a "image" attachment | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adds support for validates_attachment_content_type. Without the mime-type getting | |
# passed to attach_file() you will get a "Photo file is not one of the allowed file types." | |
# error message | |
When /^(?:|I )attach the file "([^\"]*)" to "([^\"]*)"$/ do |path, field| | |
type = path.split(".")[1] | |
case type | |
when "jpg" | |
type = "image/jpg" | |
when "jpeg" | |
type = "image/jpeg" | |
when "png" | |
type = "image/png" | |
when "gif" | |
type = "image/gif" | |
end | |
attach_file(field, path, type) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment