diff --git a/app/views/devise/shared/_links.erb b/app/views/devise/shared/_links.erb index 56b9cc73..414904bd 100644 --- a/app/views/devise/shared/_links.erb +++ b/app/views/devise/shared/_links.erb @@ -14,6 +14,6 @@ <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
<% end -%> -<%- if devise_mapping.lockable? && controller_name != 'unlocks' %> +<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
<% end -%> diff --git a/test/integration/lockable_test.rb b/test/integration/lockable_test.rb index 9eb4138f..02b02175 100644 --- a/test/integration/lockable_test.rb +++ b/test/integration/lockable_test.rb @@ -37,8 +37,16 @@ class LockTest < ActionController::IntegrationTest end test 'unlocked pages should not be available if email strategy is disabled' do - visit new_user_unlock_path + visit "/users/sign_in" + click_link "Didn't receive unlock instructions?" + swap Devise, :unlock_strategy => :time do + visit "/users/sign_in" + + assert_raise Webrat::NotFoundError do + click_link "Didn't receive unlock instructions?" + end + assert_raise AbstractController::ActionNotFound do visit new_user_unlock_path end diff --git a/test/rails_app/config/initializers/secret_token.rb b/test/rails_app/config/initializers/secret_token.rb index aba22be6..d27fc2d9 100644 --- a/test/rails_app/config/initializers/secret_token.rb +++ b/test/rails_app/config/initializers/secret_token.rb @@ -1,2 +1,2 @@ -Rails.application.config.cookie_secret = 'ea942c41850d502f2c8283e26bdc57829f471bb18224ddff0a192c4f32cdf6cb5aa0d82b3a7a7adbeb640c4b06f3aa1cd5f098162d8240f669b39d6b49680571' +Rails.application.config.secret_token = 'ea942c41850d502f2c8283e26bdc57829f471bb18224ddff0a192c4f32cdf6cb5aa0d82b3a7a7adbeb640c4b06f3aa1cd5f098162d8240f669b39d6b49680571' Rails.application.config.session_store :cookie_store, :key => "_my_app" \ No newline at end of file