Sha256: 7f6706359490d815208742e99fed02aec65be6bcfd23da521f5295d5bf95473e

Contents?: true

Size: 671 Bytes

Versions: 39

Compression:

Stored size: 671 Bytes

Contents

require "spec_helper"

describe GraphQL::Query::Variables do
  let(:query_string) {%|
  query getCheese($animals: [DairyAnimal]) {
    cheese(id: 1) {
      similarCheese(source: $animals)
    }
  }
  |}
  let(:ast_variables) { GraphQL.parse(query_string).definitions.first.variables }
  let(:variables) { GraphQL::Query::Variables.new(
    DummySchema,
    ast_variables,
    provided_variables)
  }

  describe "#initialize" do
    describe "coercing inputs" do
      let(:provided_variables) {
        {"animals" => "YAK"}
      }
      it "coerces single items into one-element lists" do
        assert_equal ["YAK"], variables["animals"]
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
graphql-1.0.0 spec/graphql/query/variables_spec.rb
graphql-0.19.4 spec/graphql/query/variables_spec.rb
graphql-0.19.3 spec/graphql/query/variables_spec.rb
graphql-0.19.2 spec/graphql/query/variables_spec.rb
graphql-0.19.1 spec/graphql/query/variables_spec.rb
graphql-0.19.0 spec/graphql/query/variables_spec.rb
graphql-0.18.15 spec/graphql/query/variables_spec.rb
graphql-0.18.14 spec/graphql/query/variables_spec.rb
graphql-0.18.13 spec/graphql/query/variables_spec.rb
graphql-0.18.12 spec/graphql/query/variables_spec.rb
graphql-0.18.11 spec/graphql/query/variables_spec.rb
graphql-0.18.10 spec/graphql/query/variables_spec.rb
graphql-0.18.9 spec/graphql/query/variables_spec.rb
graphql-0.18.8 spec/graphql/query/variables_spec.rb
graphql-0.18.7 spec/graphql/query/variables_spec.rb
graphql-0.18.6 spec/graphql/query/variables_spec.rb
graphql-0.18.5 spec/graphql/query/variables_spec.rb
graphql-0.18.4 spec/graphql/query/variables_spec.rb
graphql-0.18.3 spec/graphql/query/variables_spec.rb
graphql-0.18.2 spec/graphql/query/variables_spec.rb