learn-co-curriculum / sinatra-fwitter-group-project

Other
2 stars 318 forks source link

The test fix I added didn't seem to actually work in master (seems like it worked in solution) #47

Closed DakotaLMartinez closed 6 years ago

DakotaLMartinez commented 6 years ago

@DanielSeehausen Had a couple of students bring this one up today. For whatever reason, the commit I added before removes the first line here:

user = User.create(:username => "becky567", :email => "starz@aol.com", :password => "kittens")

which in this case actually breaks the test. Adding it back in ensures that it works properly. Here's the full test:

it 'does not let user view login page if already logged in' do
  user = User.create(:username => "becky567", :email => "starz@aol.com", :password => "kittens")
  params = {
    :username => "becky567",
    :password => "kittens"
  }
  post '/login', params
  get '/login'
  expect(last_response.location).to include("/tweets")
end

I've submitted a PR to master to add back in the creation of a user before the attempted login. I've also added a PR to solution to remove some of the extra session[:user_id] = user.id stuff that isn't actually doing anything. (Because the app doesn't have access to the session hash created within the test)

Sorry for the trouble!

drakeltheryuujin commented 6 years ago

Submitted new PR #46 for this