debian-mirror-gitlab/spec/graphql/resolvers/branch_commit_resolver_spec.rb

27 lines
602 B
Ruby
Raw Normal View History

2020-05-24 23:13:21 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Resolvers::BranchCommitResolver do
2020-05-24 23:13:21 +05:30
include GraphqlHelpers
subject(:commit) { resolve(described_class, obj: branch) }
let_it_be(:repository) { create(:project, :repository).repository }
let(:branch) { repository.find_branch('master') }
describe '#resolve' do
it 'resolves commit' do
is_expected.to eq(repository.commits('master', limit: 1).last)
end
context 'when branch does not exist' do
let(:branch) { nil }
it 'returns nil' do
is_expected.to be_nil
end
end
end
end