Skip to content

Commit

Permalink
change before filter with before_action
Browse files Browse the repository at this point in the history
  • Loading branch information
neumerance committed Dec 6, 2023
1 parent f4a9d4e commit 7328999
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/controllers/decrypted_secrets_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class DecryptedSecretsController < ApplicationController
include RetrieveSecret
before_filter :retrieve_secret
before_filter :require_validated_email
before_action :retrieve_secret
before_action :require_validated_email

def create
begin
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/secrets_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class SecretsController < ApplicationController
include RetrieveSecret
before_filter :retrieve_secret, only: :show
before_filter :require_validated_email, only: [:new, :create]
before_action :retrieve_secret, only: :show
before_action :require_validated_email, only: [:new, :create]

def show
# As the receipient has now clicked a link, we know their email address is also
Expand Down
4 changes: 2 additions & 2 deletions spec/models/secret_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
end

it 'is false if the expiry is in the future' do
secret.update_attributes(expire_at: Time.now + 2.days)
secret.update(expire_at: Time.now + 2.days)
expect(secret.expired?).to be(false)
end

it 'is false if the expiry date is nil' do
secret.update_attributes(expire_at: nil)
secret.update(expire_at: nil)
expect(secret.expired?).to be(false)
end

Expand Down

0 comments on commit 7328999

Please sign in to comment.