diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-13 09:09:23 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-13 09:09:23 +0000 |
commit | 4cb5e5011abfe8d50ac3a7ebd0018c563c6d7af4 (patch) | |
tree | 82591df15758864325897043f855b4e4dfcb6a56 /spec/controllers/profiles/keys_controller_spec.rb | |
parent | 0301a0cad0063d76b1607358dc6c711ea043fdda (diff) | |
download | gitlab-ce-4cb5e5011abfe8d50ac3a7ebd0018c563c6d7af4.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/profiles/keys_controller_spec.rb')
-rw-r--r-- | spec/controllers/profiles/keys_controller_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/controllers/profiles/keys_controller_spec.rb b/spec/controllers/profiles/keys_controller_spec.rb index 3bed117deb0..8582ecbb06d 100644 --- a/spec/controllers/profiles/keys_controller_spec.rb +++ b/spec/controllers/profiles/keys_controller_spec.rb @@ -5,6 +5,22 @@ require 'spec_helper' describe Profiles::KeysController do let(:user) { create(:user) } + 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 + describe "#get_keys" do describe "non existent user" do it "does not generally work" do |