diff options
Diffstat (limited to 'spec/requests/api/graphql/terraform/state/unlock_spec.rb')
-rw-r--r-- | spec/requests/api/graphql/terraform/state/unlock_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/requests/api/graphql/terraform/state/unlock_spec.rb b/spec/requests/api/graphql/terraform/state/unlock_spec.rb new file mode 100644 index 00000000000..e90730f2d8f --- /dev/null +++ b/spec/requests/api/graphql/terraform/state/unlock_spec.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'unlock a terraform state' do + include GraphqlHelpers + + let_it_be(:project) { create(:project) } + let_it_be(:user) { create(:user, maintainer_projects: [project]) } + + let(:state) { create(:terraform_state, :locked, project: project) } + let(:mutation) { graphql_mutation(:terraform_state_unlock, id: state.to_global_id.to_s) } + + before do + expect(state).to be_locked + post_graphql_mutation(mutation, current_user: user) + end + + include_examples 'a working graphql query' + + it 'unlocks the state' do + expect(state.reload).not_to be_locked + end +end |