summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRosemary Sanchez <rsanchez@madebyuppercut.com>2013-07-19 15:28:00 -0600
committerRosemary Sanchez <rsanchez@madebyuppercut.com>2013-07-19 15:28:00 -0600
commit1e6228482364d72a667db69479ef90958d1d787e (patch)
tree3842c34f93c05469bdf05c14ea335bd521ba3ffb /spec
parentc2156d0da03d5a2fb6383c1a1ad411a2de230e9b (diff)
Update test for sign up controller.
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/sign_ups_controller_spec.rb23
-rw-r--r--spec/models/sign_up_spec.rb2
2 files changed, 17 insertions, 8 deletions
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