Created
September 13, 2011 13:42
-
-
Save Marchino/1213828 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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