Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'spec_helper'
- describe 'GraphQL acceptance' do
- describe 'allLinks' do
- it 'returns all links' do
- link1 = create :link, description: 'first'
- link2 = create :link, description: 'second'
- query = %(
- {
- allLinks {
- id
- description
- }
- }
- )
- expect_query_result(query).to eq(
- allLinks: [
- { id: link1.id, description: link1.description },
- { id: link2.id, description: link2.description },
- ]
- )
- end
- def expect_query_result(query, variables: {}, context: {})
- expect(GraphqlTutorialSchema.execute(query, variables: variables, context: context, operation_name: 'Test'))
- end
- end
- end
Add Comment
Please, Sign In to add comment