diff options
| author | Rosemary Sanchez <rsanchez@madebyuppercut.com> | 2013-07-19 15:28:00 -0600 |
|---|---|---|
| committer | Rosemary Sanchez <rsanchez@madebyuppercut.com> | 2013-07-19 15:28:00 -0600 |
| commit | 1e6228482364d72a667db69479ef90958d1d787e (patch) | |
| tree | 3842c34f93c05469bdf05c14ea335bd521ba3ffb | |
| parent | c2156d0da03d5a2fb6383c1a1ad411a2de230e9b (diff) | |
Update test for sign up controller.
| -rw-r--r-- | db/schema.rb | 3 | ||||
| -rw-r--r-- | spec/controllers/sign_ups_controller_spec.rb | 23 | ||||
| -rw-r--r-- | spec/models/sign_up_spec.rb | 2 |
3 files changed, 17 insertions, 11 deletions
diff --git a/db/schema.rb b/db/schema.rb index 56feeb7..19cb362 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -13,9 +13,6 @@ ActiveRecord::Schema.define(version: 20130719165834) do - # These are extensions that must be enabled in order to support this database - enable_extension "plpgsql" - create_table "sign_ups", force: true do |t| t.string "email" t.datetime "created_at" diff --git a/spec/controllers/sign_ups_controller_spec.rb b/spec/controllers/sign_ups_controller_spec.rb index 3faa7a7..a8a778e 100644 --- a/spec/controllers/sign_ups_controller_spec.rb +++ b/spec/controllers/sign_ups_controller_spec.rb @@ -1,25 +1,27 @@ -require 'spec_helper' +require "spec_helper" describe SignUpsController do def valid_attributes - { - sign_up: { email: "customer@example.com" } - } + { sign_up: { email: "customer@example.com" } } + end + + def invalid_attributes + { sign_up: { email: "invalidemailaddress" } } end def valid_session {} end - describe 'GET new' do - it 'should show signup form' do + describe "GET new" do + it "should show signup form" do get :new, {}, valid_session assigns(:sign_up).should be_a_new(SignUp) end end - describe 'POST create' do + describe "POST create" do describe "with valid params" do it "creates a new SignUp" do expect { @@ -27,5 +29,12 @@ describe SignUpsController do }.to change(SignUp, :count).by(1) end end + describe "with invalid params" do + it "goes back to the sign up form with errors" do + expect { + post :create, invalid_attributes, valid_session + }.not_to change(SignUp, :count) + end + end end end diff --git a/spec/models/sign_up_spec.rb b/spec/models/sign_up_spec.rb index eee6fc8..e43bbf3 100644 --- a/spec/models/sign_up_spec.rb +++ b/spec/models/sign_up_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require "spec_helper" describe SignUp do before do |
