Sha256: 4af116699a6ea8d160e085826b7919d6c2428769839c5d6b5b35a3598539d5b0
Contents?: true
Size: 1.14 KB
Versions: 5
Compression:
Stored size: 1.14 KB
Contents
require "test_helper" class EmailsControllerTest < ActionDispatch::IntegrationTest setup do @<%= singular_table_name %> = sign_in_as(<%= table_name %>(:lazaro_nixon)) end test "should get edit" do get edit_email_url assert_response :success end test "should not get edit without sudo" do @<%= singular_table_name %>.sessions.last.update! sudo_at: 1.day.ago get edit_email_url assert_redirected_to new_sudo_path(proceed_to_url: edit_email_url) end test "should update email" do patch email_url, params: { <%= singular_table_name %>: { email: "new_email@hey.com" } } assert_redirected_to root_path end test "should not update email without sudo" do @<%= singular_table_name %>.sessions.last.update! sudo_at: 1.day.ago patch email_url, params: { <%= singular_table_name %>: { email: "new_email@hey.com" } } assert_redirected_to new_sudo_path(proceed_to_url: email_url) end def sign_in_as(<%= singular_table_name %>) post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }, headers: { "User-Agent" => "Firefox" }); <%= singular_table_name %> end end
Version data entries
5 entries across 5 versions & 1 rubygems