Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Jason Resnick's Profile

GitHub User: rezzz-dev

Site: http://www.rezzz.com

Comments by Jason Resnick

Avatar

I'm trying to set up this and use rspec integration tests and I thank you for this, but isn't this always going to pass when testing?

``` sessions_spec.rb
describe "Login" do
before do
@user = Factory(:user)
ApplicationController.stub(:current_user).and_return(@user)
end

it "should allow a valid user to log in" do
  # visit new_session_path
  # fill_in 'Email', :with => @user.email
  # fill_in 'Password', :with => @user.password

  # click_button 'Login'
  # current_path.should == root_path
  # page.should have_content "Logged in"
  page.driver.post sessions_path, :user => {:email => @user.email, :password => @user.password }
  ApplicationController.current_user.should_not be_nil
end

```