Sha256: cc0fcffa88e061e91f43796f36f6157a6f5e70428f2e42585af0563ddadb6e9a

Contents?: true

Size: 674 Bytes

Versions: 8

Compression:

Stored size: 674 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

module Decidim
  module Api
    describe QueriesController, type: :controller do
      let!(:participatory_process) { create(:participatory_process) }
      let!(:other_participatory_process) { create(:participatory_process) }

      before do
        @request.env["decidim.current_organization"] = participatory_process.organization
      end

      it "executes a query" do
        post :create, params: { query: "{ processes { id }}" }

        parsed_response = JSON.parse(response.body)["data"]
        expect(parsed_response["processes"]).to eq(["id" => participatory_process.id.to_s])
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
decidim-0.4.3 decidim-api/spec/controllers/queries_controller_spec.rb
decidim-0.4.2 decidim-api/spec/controllers/queries_controller_spec.rb
decidim-0.4.1 decidim-api/spec/controllers/queries_controller_spec.rb
decidim-0.4.0 decidim-api/spec/controllers/queries_controller_spec.rb
decidim-0.3.2 decidim-api/spec/controllers/queries_controller_spec.rb
decidim-0.3.1 decidim-api/spec/controllers/queries_controller_spec.rb
decidim-0.3.0 decidim-api/spec/controllers/queries_controller_spec.rb
decidim-0.2.0 decidim-api/spec/controllers/queries_controller_spec.rb