spec/model/password_reset_spec.rb in authenticate-0.2.3 vs spec/model/password_reset_spec.rb in authenticate-0.3.0

- old
+ new

@@ -1,13 +1,10 @@ require 'spec_helper' require 'authenticate/model/password_reset' describe Authenticate::Model::PasswordReset do - before(:all) { - Authenticate.configuration.reset_password_within = 5.minutes - } context 'forgot_password!' do subject { create(:user) } before { subject.forgot_password! } it 'generates a password reset token' do @@ -20,18 +17,17 @@ end context '#reset_password_period_valid?' do subject { create(:user) } - before(:each) { - Authenticate.configuration.reset_password_within = 5.minutes - } it 'always true if reset_password_within config param is nil' do + within = Authenticate.configuration.reset_password_within subject.password_reset_sent_at = 10.days.ago Authenticate.configuration.reset_password_within = nil expect(subject.reset_password_period_valid?).to be_truthy + Authenticate.configuration.reset_password_within = within end it 'false if time exceeded' do subject.password_reset_sent_at = 10.minutes.ago expect(subject.reset_password_period_valid?).to be_falsey @@ -43,12 +39,9 @@ end end context '#update_password' do subject { create(:user) } - before(:each) { - Authenticate.configuration.reset_password_within = 5.minutes - } context 'within time time' do before(:each) { subject.password_reset_sent_at = 1.minutes.ago }