Skip to content

Instantly share code, notes, and snippets.

@Marchino
Created September 13, 2011 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marchino/1213828 to your computer and use it in GitHub Desktop.
Save Marchino/1213828 to your computer and use it in GitHub Desktop.
require 'spec_helper.rb'
describe "Phone call", :search => true do
it "should be created without user logged in" do
email_sent_until_now = email_count
item = RareBook.last
visit send("new_rare_book_phone_call_path", :title => item.to_url_param, :id => item.id)
fill_in "phone_call_name", :with => "User name"
fill_in "phone_call_phone_number", :with => "1234567890"
select "tra_un_ora", :from => "phone_call_availability"
click_button "phone_call_submit"
page.should have_content I18n.t('phone_calls.created')
email_count.should eq(email_sent_until_now + 1)
last_email.should have_content "User name"
last_email.should have_content "1234567890"
last_email.should have_content item.title
last_email.should_not have_content "UTENTE REGISTRATO CON ID"
end
it "should be created with user logged in" do
d Buyer.all
user = Buyer.first
login_user(user.username, user.username)
save_and_open_page
email_sent_until_now = email_count
item = RareBook.last
visit send("new_rare_book_phone_call_path", :title => item.to_url_param, :id => item.id)
fill_in "phone_call_name", :with => "User name"
fill_in "phone_call_phone_number", :with => "1234567890"
select "tra_un_ora", :from => "phone_call_availability"
click_button "phone_call_submit"
page.should have_content I18n.t('phone_calls.created')
email_count.should eq(email_sent_until_now + 1)
last_email.should have_content "User name"
last_email.should have_content "1234567890"
last_email.should have_content item.title
last_email.should have_content "UTENTE REGISTRATO CON ID"
last_email.should have_content user.id
logout_user
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment