This is an example of how to test paperclip with cucumber. Base on {authlogic_example}(github.com/binarylogic/authlogic_example).
-
git clone git://github.com/rainchen/authlogic_example.git authlogic_paperclip_example
-
cd authlogic_paperclip_example
-
cp config/database.yml.example config/database.yml
-
rake db:migrate
-
rake db:test:prepare
cucumber -q
Feature: Manage users
In order to signup Scenario: Register new user Given I am on the new user page When I fill in "Login" with "Rain" And I fill in "Password" with "mypass" And I fill in "Password confirmation" with "mypass" And I press "Register" Then I should see "Account registered!" Scenario: Upload an image as avatar Given I am registered as "Rain/mypass" When I go to "/account/edit" And I attach the file "rails.png" to "avatar" And I press "Update" Then I should see "Account updated!" And the "avatar.file?" of the user which login is "Rain" should be "true" And the "avatar_file_size" of the user which login is "Rain" should not be blank
2 scenarios (2 passed) 13 steps (13 passed)
Copyright © 2009 {RainChen}(github.com/rainchen/authlogic_example), released under the MIT license