Skip to content

Commit

Permalink
fix rubocop warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mattlindsey committed Nov 20, 2020
1 parent 2e8150a commit 63a8ee7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions app/controllers/graphql_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class GraphqlController < ApplicationController
before_action :fetch_params, only: [:execute]
skip_before_action :verify_authenticity_token

def execute
result = WebsiteOneBackendApiSchema.execute(
Expand Down
16 changes: 8 additions & 8 deletions spec/graphql/queries/show_event_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
require 'graphql_helper'

RSpec.describe 'Events' do
it "queries and returns all events" do
e = create(:event, name: 'FirstEvent')
e2 = create(:event, name: 'AnotherEvent')

it 'queries and returns all events' do
create(:event, name: 'FirstEvent')
create(:event, name: 'AnotherEvent')

query_string = <<-GRAPHQL
query
{
Expand All @@ -19,9 +19,9 @@
}
}
GRAPHQL
result = WebsiteOneBackendApiSchema.execute(query_string)["data"]["events"]

result = WebsiteOneBackendApiSchema.execute(query_string)['data']['events']

expect(result).to json_contains('FirstEvent', 'name')
expect(result).to json_contains('AnotherEvent', 'name')
end
Expand Down
8 changes: 4 additions & 4 deletions spec/graphql_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
RSpec::Matchers.define :json_contains do |expected, key|
match do |actual|
a = actual.collect {|x| x[key]}
a.detect { |e| e == expected }
end
match do |actual|
a = actual.collect {|x| x[key]}
a.detect { |e| e == expected }
end
end

0 comments on commit 63a8ee7

Please sign in to comment.