codeforboston / cambridge_energy_app

EnerSave is designed to help and encourage Cambridge residents to reduce their electric bills.
https://www.enersaveapp.org/
MIT License
33 stars 25 forks source link

Test that occasionally fails. #286

Open FrankCardillo opened 8 years ago

FrankCardillo commented 8 years ago

./spec/features/user_can_create_new_bill_spec.rb:4

user can add a new bill user successfully adds new bill

ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_users_on_email" DETAIL: Key (email)=(guest_147206697996@example.com) already exists. : INSERT INTO "users" ("first_name", "email", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id"

 # ./app/controllers/application_controller.rb:54:in `create_guest_user'
 # ./app/controllers/application_controller.rb:24:in `guest_user'
 # ./app/controllers/application_controller.rb:16:in `current_or_guest_user'
 # ./app/controllers/bills_controller.rb:42:in `create'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:186:in `call!'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:164:in `call'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/warden-1.2.6/lib/warden/manager.rb:35:in `block in call'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/warden-1.2.6/lib/warden/manager.rb:34:in `catch'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/warden-1.2.6/lib/warden/manager.rb:34:in `call'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/rack-1.6.4/lib/rack/etag.rb:24:in `call'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/rack-1.6.4/lib/rack/conditionalget.rb:38:in `call'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:225:in `context'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:220:in `call'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.7/lib/rails/rack/logger.rb:38:in `call_app'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.7/lib/rails/rack/logger.rb:20:in `block in call'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.7/lib/rails/rack/logger.rb:20:in `call'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/rack-1.6.4/lib/rack/methodoverride.rb:22:in `call'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/rack-1.6.4/lib/rack/runtime.rb:18:in `call'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/rack-1.6.4/lib/rack/lock.rb:17:in `call'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/rack-1.6.4/lib/rack/sendfile.rb:113:in `call'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.7/lib/rails/engine.rb:518:in `call'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.7/lib/rails/application.rb:165:in `call'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/rack-1.6.4/lib/rack/urlmap.rb:66:in `block in call'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/rack-1.6.4/lib/rack/urlmap.rb:50:in `each'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/rack-1.6.4/lib/rack/urlmap.rb:50:in `call'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/rack-test-0.6.3/lib/rack/mock_session.rb:30:in `request'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/rack-test-0.6.3/lib/rack/test.rb:244:in `process_request'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/rack-test-0.6.3/lib/rack/test.rb:67:in `post'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/capybara-2.7.1/lib/capybara/rack_test/browser.rb:61:in `process'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/capybara-2.7.1/lib/capybara/rack_test/browser.rb:36:in `process_and_follow_redirects'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/capybara-2.7.1/lib/capybara/rack_test/browser.rb:27:in `submit'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/capybara-2.7.1/lib/capybara/rack_test/form.rb:78:in `submit'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/capybara-2.7.1/lib/capybara/rack_test/node.rb:62:in `click'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/capybara-2.7.1/lib/capybara/node/element.rb:135:in `block in click'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/capybara-2.7.1/lib/capybara/node/base.rb:85:in `synchronize'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/capybara-2.7.1/lib/capybara/node/element.rb:135:in `click'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/capybara-2.7.1/lib/capybara/node/actions.rb:40:in `click_button'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/capybara-2.7.1/lib/capybara/session.rb:699:in `block (2 levels) in <class:Session>'
 # /Users/frankcardillo/.rvm/gems/ruby-2.2.5/gems/capybara-2.7.1/lib/capybara/dsl.rb:52:in `block (2 levels) in <module:DSL>'
 # ./spec/features/user_can_create_new_bill_spec.rb:9:in `block (2 levels) in <top (required)>'
 # ------------------
 # --- Caused by: ---
 # PG::UniqueViolation:
 #   ERROR:  duplicate key value violates unique constraint "index_users_on_email"
 #   DETAIL:  Key (email)=(guest_147206697996@example.com) already exists.
 #   ./app/controllers/application_controller.rb:54:in `create_guest_user'
mzagaja commented 8 years ago

This is a good opportunity for someone to try out RSpec bisect!

http://blog.arkency.com/2016/02/how-rspec-helped-me-with-resolving-random-spec-failures/