debian-mirror-gitlab/spec/requests/api/graphql/current_user_query_spec.rb

34 lines
679 B
Ruby
Raw Normal View History

2019-12-26 22:10:19 +05:30
# frozen_string_literal: true
require 'spec_helper'
describe 'getting project information' do
include GraphqlHelpers
let(:query) do
graphql_query_for('currentUser', {}, 'name')
end
subject { graphql_data['currentUser'] }
before do
post_graphql(query, current_user: current_user)
end
context 'when there is a current_user' do
set(:current_user) { create(:user) }
it_behaves_like 'a working graphql query'
it { is_expected.to include('name' => current_user.name) }
end
context 'when there is no current_user' do
let(:current_user) { nil }
it_behaves_like 'a working graphql query'
it { is_expected.to be_nil }
end
end