spec/tasks/user_tasks_spec.rb in volt-0.9.3.pre1 vs spec/tasks/user_tasks_spec.rb in volt-0.9.3.pre2
- old
+ new
@@ -16,10 +16,12 @@
allow($page).to receive(:store).and_return fake_store
allow(User).to receive(:login_field).and_return 'user'
allow(fake_response).to receive(:fetch_first).and_yield(user)
end
+ subject { UserTasks.new(Volt.current_app) }
+
describe '#login' do
context 'with no matching user' do
let(:user) { false }
it 'raises VoltUserError' do
@@ -28,11 +30,11 @@
end
end
context 'with a matching user' do
let(:password) { BCrypt::Password.create(login_info['password']) }
- let(:user) { double('User', _id: 1, _hashed_password: password) }
+ let(:user) { double('User', id: 1, _hashed_password: password) }
it 'fails on bad password' do
expect { subject.login(login_info.merge 'password' => 'Not McFly') }.
to raise_error('Password did not match')
end
@@ -48,10 +50,10 @@
allow(Digest::SHA256).to receive(:hexdigest).and_call_original
subject.login(login_info)
expect(Digest::SHA256).to have_received(:hexdigest).with(
- "#{Volt.config.app_secret}::#{user._id}"
+ "#{Volt.config.app_secret}::#{user.id}"
)
end
end
end
end