Guest User

Untitled

a guest
Mar 18th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. require 'spec_helper'
  2.  
  3. describe 'GraphQL acceptance' do
  4. describe 'allLinks' do
  5. it 'returns all links' do
  6. link1 = create :link, description: 'first'
  7. link2 = create :link, description: 'second'
  8.  
  9. query = %(
  10. {
  11. allLinks {
  12. id
  13. description
  14. }
  15. }
  16. )
  17.  
  18. expect_query_result(query).to eq(
  19. allLinks: [
  20. { id: link1.id, description: link1.description },
  21. { id: link2.id, description: link2.description },
  22. ]
  23. )
  24. end
  25.  
  26. def expect_query_result(query, variables: {}, context: {})
  27. expect(GraphqlTutorialSchema.execute(query, variables: variables, context: context, operation_name: 'Test'))
  28. end
  29. end
  30. end
Add Comment
Please, Sign In to add comment