Sha256: 4dec71c0969d898464b1637811caf2be814ce1ebd221c546f6b8aa8e4e0c4d87

Contents?: true

Size: 1011 Bytes

Versions: 11

Compression:

Stored size: 1011 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"
require "decidim/api/test/type_context"

module Decidim
  describe ProcessType, type: :graphql do
    include_context "graphql type"

    let(:model) { create(:participatory_process) }

    describe "id" do
      let(:query) { "{ id }" }

      it "returns all the required fields" do
        expect(response).to include("id" => model.id.to_s)
      end
    end

    describe "title" do
      let(:query) { '{ title { translation(locale: "en")}}' }

      it "returns all the required fields" do
        expect(response["title"]["translation"]).to eq(model.title["en"])
      end
    end

    describe "steps" do
      let!(:step) { create(:participatory_process_step, participatory_process: model) }

      let(:query) { "{ steps { edges { node { id } } } }" }

      it "returns all the required fields" do
        step_response = response["steps"]["edges"].first["node"]
        expect(step_response["id"]).to eq(step.id.to_s)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
decidim-0.6.8 decidim-core/spec/types/process_type_spec.rb
decidim-0.6.7 decidim-core/spec/types/process_type_spec.rb
decidim-0.6.6 decidim-core/spec/types/process_type_spec.rb
decidim-0.6.5 decidim-core/spec/types/process_type_spec.rb
decidim-0.6.4 decidim-core/spec/types/process_type_spec.rb
decidim-0.6.3 decidim-core/spec/types/process_type_spec.rb
decidim-0.6.2 decidim-core/spec/types/process_type_spec.rb
decidim-0.6.1 decidim-core/spec/types/process_type_spec.rb
decidim-0.6.0 decidim-core/spec/types/process_type_spec.rb
decidim-0.5.1 decidim-core/spec/types/process_type_spec.rb
decidim-0.5.0 decidim-core/spec/types/process_type_spec.rb