Sha256: ccbd2d195ea876688ec0feb43c91e7c75019dfab08255d40b2c390bf1ddc509c
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
require "minitest_helper" describe SessionsController do describe "GET new" do before do SessionsController.any_instance.stubs(:warden).returns(stub(message: nil)) get :new end it { response.status.must_equal 200 } it { response.body.must_include "Log In" } end describe "POST create" do describe "with invalid params" do before do warden_manager = stub(authenticate!: nil, message: "Not Logged In") SessionsController.any_instance.stubs(:warden).returns(warden_manager) post :create, email: "notfound@blah.com", password: "xxx123" end it { response.status.must_equal 200 } end describe "with valid params" do let(:user) do User.create( email: "info@newleaders.com", password: "123456", password_confirmation: "1234546" ) end before do warden_manager = stub(authenticate!: user) SessionsController.any_instance.stubs(:warden).returns(warden_manager) post :create, email: "info@newleaders.com", password: "123456" end it { response.status.must_equal 302 } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
thincloud-auth-0.1.2 | lib/generators/thincloud/auth/templates/sessions_controller_test.rb |
thincloud-auth-0.1.1 | lib/generators/thincloud/auth/templates/sessions_controller_test.rb |