Sha256: 487faf4531eabac9fe20ae84379a7e88b031d9906c134cb4fe528f7bee6618bb
Contents?: true
Size: 695 Bytes
Versions: 2
Compression:
Stored size: 695 Bytes
Contents
require "spec_helper" describe GraphQL::EnumType do let(:enum) { DairyAnimalEnum } it "coerces names to underlying values" do assert_equal("YAK", enum.coerce_input("YAK")) assert_equal(1, enum.coerce_input("COW")) end it "coerces result values to value's value" do assert_equal("YAK", enum.coerce_result("YAK")) assert_equal("COW", enum.coerce_result(1)) end it "has value description" do assert_equal("Animal with horns", enum.values["GOAT"].description) end describe "validate_input with bad input" do let(:result) { DairyAnimalEnum.validate_input("bad enum") } it "returns an invalid result" do assert(!result.valid?) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
graphql-0.14.0 | spec/graphql/enum_type_spec.rb |
graphql-0.13.0 | spec/graphql/enum_type_spec.rb |