50e21a89a0
This suggests possibly related issues when the user types a title. This uses GraphQL to allow the frontend to request the exact data that is requires. We also get free caching through the Vue Apollo plugin. With this we can include the ability to import .graphql files in JS and Vue files. Also we now have the Vue test utils library to make testing Vue components easier. Closes #22071
40 lines
1 KiB
Ruby
40 lines
1 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe Resolvers::IssuesResolver do
|
|
include GraphqlHelpers
|
|
|
|
let(:current_user) { create(:user) }
|
|
set(:project) { create(:project) }
|
|
set(:issue) { create(:issue, project: project) }
|
|
set(:issue2) { create(:issue, project: project, title: 'foo') }
|
|
|
|
before do
|
|
project.add_developer(current_user)
|
|
end
|
|
|
|
describe '#resolve' do
|
|
it 'finds all issues' do
|
|
expect(resolve_issues).to contain_exactly(issue, issue2)
|
|
end
|
|
|
|
it 'searches issues' do
|
|
expect(resolve_issues(search: 'foo')).to contain_exactly(issue2)
|
|
end
|
|
|
|
it 'sort issues' do
|
|
expect(resolve_issues(sort: 'created_desc')).to eq [issue2, issue]
|
|
end
|
|
|
|
it 'returns issues user can see' do
|
|
project.add_guest(current_user)
|
|
|
|
create(:issue, confidential: true)
|
|
|
|
expect(resolve_issues).to contain_exactly(issue, issue2)
|
|
end
|
|
end
|
|
|
|
def resolve_issues(args = {}, context = { current_user: current_user })
|
|
resolve(described_class, obj: project, args: args, ctx: context)
|
|
end
|
|
end
|