On 2/12/08, Ben Mabey <[EMAIL PROTECTED]> wrote:
> I'll check it out when I get a chance. BTW, would you mind posting some
> example code of how you are using the story runner in testing a
> multi-part form?
>
require File.expand_path(File.dirname(__FILE__) + "/helper.rb")
Test::Unit::TestCase.fixture_path = RAILS_ROOT + '/spec/fixtures/'
def add_the_rebelz
@image_filename = "therebelz.jpg"
upload_data = fixture_file_upload(@image_filename, "image/jpg")
post_via_redirect("/artists", {:artist => {:name => "The Rebelz"},
:image => {:uploaded_data => upload_data}})
@artist = Artist.find_by_name("The Rebelz")
end
Story "Sign up an Artist", %{
As an administrator
I want to add the Artist to the system
So that the Artist can be accessed
}, :type => RailsStory do
Scenario "New Artist" do
Given "The Artist is not in the system" do
pm = Artist.find_by_name("The Rebelz")
pm.destroy if pm
end
When "I add the Artist" do
add_the_rebelz
end
Then "The Artist page should show the Artist's name" do
response.should have_text(/The Rebelz/)
end
And "The page should show the artist's picture or logo" do
response.should have_tag("span.artist_logo") do
with_tag("img[src*=?]", @image_filename)
end
end
...
--
Rick DeNatale
My blog on Ruby
http://talklikeaduck.denhaven2.com/
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users