Guest User

Untitled

a guest
Jan 22nd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. require 'spec_helper.rb'
  2.  
  3. describe "Phone call", :search => true do
  4.  
  5. it "should be created without user logged in" do
  6. email_sent_until_now = email_count
  7. item = RareBook.last
  8. visit send("new_rare_book_phone_call_path", :title => item.to_url_param, :id => item.id)
  9. fill_in "phone_call_name", :with => "User name"
  10. fill_in "phone_call_phone_number", :with => "1234567890"
  11. select "tra_un_ora", :from => "phone_call_availability"
  12. click_button "phone_call_submit"
  13. page.should have_content I18n.t('phone_calls.created')
  14. email_count.should eq(email_sent_until_now + 1)
  15. last_email.should have_content "User name"
  16. last_email.should have_content "1234567890"
  17. last_email.should have_content item.title
  18. last_email.should_not have_content "UTENTE REGISTRATO CON ID"
  19. end
  20.  
  21. it "should be created with user logged in" do
  22. d Buyer.all
  23. user = Buyer.first
  24. login_user(user.username, user.username)
  25. save_and_open_page
  26. email_sent_until_now = email_count
  27. item = RareBook.last
  28. visit send("new_rare_book_phone_call_path", :title => item.to_url_param, :id => item.id)
  29. fill_in "phone_call_name", :with => "User name"
  30. fill_in "phone_call_phone_number", :with => "1234567890"
  31. select "tra_un_ora", :from => "phone_call_availability"
  32. click_button "phone_call_submit"
  33. page.should have_content I18n.t('phone_calls.created')
  34. email_count.should eq(email_sent_until_now + 1)
  35. last_email.should have_content "User name"
  36. last_email.should have_content "1234567890"
  37. last_email.should have_content item.title
  38. last_email.should have_content "UTENTE REGISTRATO CON ID"
  39. last_email.should have_content user.id
  40. logout_user
  41. end
  42.  
  43. end
Add Comment
Please, Sign In to add comment