diff options
| author | mo khan <mo@mokhan.ca> | 2014-09-17 21:20:14 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-09-17 21:20:14 -0600 |
| commit | cda9d573bf273eaafa213c06543c071841041306 (patch) | |
| tree | 4840c92cef78b41d122a422477cfd9bf590f3ed3 /spec/controllers | |
| parent | cf417328ba8bb04d1c6d13f7bf5ddae2a9014293 (diff) | |
add email validation.
Diffstat (limited to 'spec/controllers')
| -rw-r--r-- | spec/controllers/registrations_controller_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb new file mode 100644 index 00000000..a625959a --- /dev/null +++ b/spec/controllers/registrations_controller_spec.rb @@ -0,0 +1,18 @@ +require 'rails_helper' + +describe RegistrationsController do + describe "#create" do + it 'creates a new user' do + post :create, user: { name: 'mo', email: 'mo@cakeside.com', password: 'password', password_confirmation: 'password' } + + expect(User.count).to eql(1) + expect(response).to redirect_to(my_root_path) + end + + it 'displays errors' do + post :create, user: { name: 'mo', email: 'mo', password: 'password', password_confirmation: 'password' } + expect(response).to redirect_to(new_session_path) + expect(flash[:error]).to_not be_empty + end + end +end |
