My users_controller.rb
# GET /users/1/edit
def edit
@user = current_user
#@user = User.find(params[:id])
end
my sweet looking users_controller_spec.rb ( notice all my commented out attempts )
describe "Authenticated examples" do
before(:each) do
activate_authlogic
UserSession.create Factory.build(:valid_user)
end
describe "GET edit" do
it "assigns the requested user as @user" do
@user = Factory.create(:valid_user)
assigns(:user).should be(Factory.build(:valid_user))
end
end
user.rb - factories
Factory.define :valid_user, :class => User do |u|
u.username "Trippy"
u.password "password"
u.password_confirmation "password"
u.email "[email protected]"
u.single_access_token "k3cFzLIQnZ4MHRmJvJzg"
end
Basically I'm just trying to get this RSpec test to pass in the most appropriate way.
I need to be able to say very simply, that the mock_user
is the current_user
.
This test passes if I use in my users_controller.rb the @user = User.find(params[:id])
Thanks!!