2019-04-15 06:17:05 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-02-11 13:15:13 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-03 14:08:28 -04:00
|
|
|
RSpec.describe Profiles::KeysController do
|
2016-04-14 06:20:16 -04:00
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
2020-03-13 05:09:23 -04:00
|
|
|
describe 'POST #create' do
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'creates a new key' do
|
|
|
|
expires_at = 3.days.from_now
|
|
|
|
|
|
|
|
expect do
|
|
|
|
post :create, params: { key: build(:key, expires_at: expires_at).attributes }
|
|
|
|
end.to change { Key.count }.by(1)
|
|
|
|
|
|
|
|
expect(Key.last.expires_at).to be_like_time(expires_at)
|
|
|
|
end
|
|
|
|
end
|
2014-02-11 13:15:13 -05:00
|
|
|
end
|