Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require File.dirname(__FILE__) + '/../../spec_helper'
- describe "/my_account/index" do
- before(:each) do
- @user = mock_model(User,
- :get_avatar => "foo.png",
- :name => "Piotr",
- :surname => "Kowalski",
- :password => "famfaramfa",
- :password_confirmation => "famfaramfa",
- :email => "piotr@gmail.com",
- :profile_id => 1,
- :informations => "FooBarBaz")
- assigns[:user] = @user
- end
- it "should render forms to change account data" do
- render 'my_account/index'
- response.should have_tag('form#data_form')
- response.should have_tag('form#passwd_form')
- response.should have_tag('form#avatar_form')
- response.should have_tag('div#em_for_data')
- response.should have_tag('div#em_for_passwd')
- response.should have_tag('div#em_for_avatar')
- end
- it "should have #data_form filled with @user data " do
- render 'my_account/index'
- response.should have_tag('form#data_form') do
- with_tag('input#user_name[value=?]', @user.name)
- with_tag('input#user_surname[value=?]', @user.surname)
- with_tag('input#user_email[value=?]', @user.email)
- with_tag('textarea#user_informations', @user.informations)
- end
- end
- it "should have fieldset with avatar" do
- render 'my_account/index'
- response.should have_tag('fieldset') do
- with_tag('img[src=?]', "/images/#{@user.get_avatar}")
- end
- end
- end
Add Comment
Please, Sign In to add comment