Sha256: 3c6358b67ea090b7192ca1006240913368b4a86ba6df39c7f08641c883c2df15
Contents?: true
Size: 1.95 KB
Versions: 1
Compression:
Stored size: 1.95 KB
Contents
require 'test_helper' <% module_namespacing do -%> class <%= controller_class_name %>ControllerTest < ActionController::TestCase <% if goma_config.unlock_strategies.include? :email -%> setup do @<%= resource_name %> = <%= resource_name.pluralize %>(:one) end test "should get new" do get :new assert_response :success end test "should resend unlock token with <%= goma_config.email_attribute_name %>" do @<%= resource_name %>.lock_access! <%= goma_config.unlock_token_attribute_name %> = @<%= resource_name %>.<%= goma_config.unlock_token_attribute_name %> assert_difference 'ActionMailer::Base.deliveries.size', 1 do post :create, <%= goma_config.authentication_keys.to_field_name %>: @<%= resource_name %>.<%= goma_config.email_attribute_name %> end assert_redirected_to <%= login_url %> @<%= resource_name %>.reload assert_not_equal <%= goma_config.unlock_token_attribute_name %>, @<%= resource_name %>.<%= goma_config.unlock_token_attribute_name %> end test "should unlock <%= resource_name %>" do @<%= resource_name %>.lock_access! <%= goma_config.unlock_token_to_send_attribute_name %> = @<%= resource_name%>.<%= goma_config.unlock_token_to_send_attribute_name %> get :show, id: <%= goma_config.unlock_token_to_send_attribute_name %> assert_redirected_to <%= login_url %> assert_match /Your account has been unlocked successfully/, flash[:notice] @<%= resource_name %>.reload refute @<%=resource_name %>.access_locked? end test "should not unlock <%= resource_name %> with wrong token" do @<%= resource_name %>.lock_access! <%= goma_config.unlock_token_to_send_attribute_name %> = @<%= resource_name%>.<%= goma_config.unlock_token_to_send_attribute_name %> get :show, id: 'oops' assert_template :new assert_match /Not found any account by this URL/, flash[:alert] @<%= resource_name %>.reload assert @<%=resource_name %>.access_locked? end <% end -%> end <% end -%>
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
goma-0.0.1.rc3 | lib/generators/test_unit/goma/scaffold/templates/unlock_functional_test.rb |