Guest User

Untitled

a guest
Apr 20th, 2018
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. require File.dirname(__FILE__) + '/../../spec_helper'
  2.  
  3. describe "/my_account/index" do
  4. before(:each) do
  5. @user = mock_model(User,
  6. :get_avatar => "foo.png",
  7. :name => "Piotr",
  8. :surname => "Kowalski",
  9. :password => "famfaramfa",
  10. :password_confirmation => "famfaramfa",
  11. :email => "piotr@gmail.com",
  12. :profile_id => 1,
  13. :informations => "FooBarBaz")
  14. assigns[:user] = @user
  15. end
  16.  
  17. it "should render forms to change account data" do
  18. render 'my_account/index'
  19. response.should have_tag('form#data_form')
  20. response.should have_tag('form#passwd_form')
  21. response.should have_tag('form#avatar_form')
  22. response.should have_tag('div#em_for_data')
  23. response.should have_tag('div#em_for_passwd')
  24. response.should have_tag('div#em_for_avatar')
  25. end
  26.  
  27. it "should have #data_form filled with @user data " do
  28. render 'my_account/index'
  29. response.should have_tag('form#data_form') do
  30. with_tag('input#user_name[value=?]', @user.name)
  31. with_tag('input#user_surname[value=?]', @user.surname)
  32. with_tag('input#user_email[value=?]', @user.email)
  33. with_tag('textarea#user_informations', @user.informations)
  34. end
  35. end
  36.  
  37. it "should have fieldset with avatar" do
  38. render 'my_account/index'
  39. response.should have_tag('fieldset') do
  40. with_tag('img[src=?]', "/images/#{@user.get_avatar}")
  41. end
  42. end
  43. end
Add Comment
Please, Sign In to add comment