Skip to content

Commit

Permalink
[t2] Fix the annoying RSpec bug. (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferduan45 authored Nov 17, 2022
1 parent faa764d commit ae2a31d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion spec/controllers/users_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
end

describe "POST #create" do
let!(:user) {FactoryGirl.create(:user)}

context "When successfully create a new user" do
it "should store the new user in the database and go to welcome" do
Expand All @@ -23,6 +22,7 @@

context "When fails to create a new user due to duplicate username" do
it "should not store the new user in the database and go to new user page" do
user = User.create({:username => "testuser", :password => "12345"})
params = ActionController::Parameters.new(:username => "testuser", :password => "test")
expect{post :create, {:user => params}}.to change{User.count}.by(0)
expect(response).to redirect_to '/users/new?'
Expand Down

0 comments on commit ae2a31d

Please sign in to comment.