This should be very simple to test, but for some reason my test is failing, please consider the following, model bit:
class User < ActiveRecord::Base def active! update_attribute(:active, true) end end controller :
def activate user = User.find_by_uuid(params[:id]) user.active! puts "id #{user.id}" end test :
describe 'activate user' do let(:user) { FactoryGirl.create(:user) } before do sign_in user visit activate_user_path(id: user.uuid) puts "id #{user.id}" end it 'should be true' do save_and_open_page user.active.should be_true end end This test fails :
expected: true value got: false But when I do it with browser, the user gets activated without problems. What am I doing wrong? This really looks like a sily test but still doesn't pass, I've spend more than one hour trying out different stuff, none of which worked.