step "there are standard website pages" do
  create_site_pages
end

step "I fill in the website contact form" do
  find('#contact_form_name').set "Benji"
  find('#contact_form_body').set "Awesome website!"
  find('#contact_form_email').set "benji@mozo.bar"
end

step "I submit the website contact form" do
  find('[type="submit"]').click
end

step "I should be redirected to the homepage" do
  page.current_path.should eq '/'
end

step "a contact form object should be created having the proper data" do
  cf = Cmtool::ContactForm.last
  cf.name.should eq 'Benji'
  cf.body.should eq "Awesome website!"
  cf.email.should eq "benji@mozo.bar"
end

step "an email should be sent containing the contact form body" do
  sleep 0.2 # webkit issue
  mail = ActionMailer::Base.deliveries.last
  mail.should be_present
  mail.body.should include "Awesome website!"
end
