Sha256: d7cba229413e1e49724096064e99ef3e6e88aee4f55dc5d6af2afcdac552b1f6

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

require 'test_helper'

class UserFlowsTest < ActionDispatch::IntegrationTest
  test "create user and browe home and finally signout and signin again" do
    #get new_user_path
    get "/as_user/users/new"
    assert_response :success

    post_via_redirect "/as_user/users", user: {email: "dummy@example.com", name: "dummy", password: "dummy", password_confirmation: "dummy"}
    loged_in_path = path
    assert path =~ /as_user\/users\/\d+/
    assert_equal "User was successfully created.", flash[:notice]

    get "/as_user"
    assert_response :success

    get_via_redirect "/as_user/signin"
    assert_equal loged_in_path, path

    delete_via_redirect "/as_user/signout"
    assert_equal "/as_user/", path
    get_via_redirect "/as_user/signin"
    assert_equal "/as_user/signin", path

    post_via_redirect "/as_user/sessions", session: {email: "dummy", password: "dummy"}
    assert_template :new
    assert_equal "Invalid email/password combination", flash[:error]
    post_via_redirect "/as_user/sessions", session: {email: "dummy@example.com", password: "dummy"}
    assert_equal loged_in_path, path

    get_via_redirect "/as_user/signin"
    assert_equal loged_in_path, path
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
as_user-0.0.3 test/integration/as_user/user_flows_test.rb