Skip to content

Commit

Permalink
Add basic pages field spec
Browse files Browse the repository at this point in the history
  • Loading branch information
bricesanchez committed Oct 30, 2017
1 parent e5138bd commit 38d9e54
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions api/spec/graph/refinery/api/fields/pages/pages_field_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# frozen_string_literal: true

require 'spec_helper'

module Refinery
module Api
module Fields
module Pages
describe 'PagesField' do

let!(:page) { FactoryBot.create(:page) }

let(:context) { { } }
let(:variables) { {} }

let(:result) do
GraphqlSchema.execute(
query_string,
context: context,
variables: variables
)
end

let(:query_string) do
<<-QUERY
query {
pages {
title
}
}
QUERY
end

context "as a normal user" do
it 'returns the page fields' do
page_result = result['data']['pages'].first
expect(page_result).to include(
'title' => page.title,
)
end
end
end
end
end
end
end

0 comments on commit 38d9e54

Please sign in to comment.