2019-10-30 08:06:34 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 02:09:01 -04:00
|
|
|
RSpec.describe 'getting project information' do
|
2019-10-30 08:06:34 -04:00
|
|
|
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
|
2020-02-17 10:09:01 -05:00
|
|
|
let_it_be(:current_user) { create(:user) }
|
2019-10-30 08:06:34 -04:00
|
|
|
|
|
|
|
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
|