Sha256: 461d3d4972e640ddb2f19bcdeca9d7ead4fd1875e0ccedfbfd439746f2cea48e

Contents?: true

Size: 623 Bytes

Versions: 1

Compression:

Stored size: 623 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"
require "decidim/api/test/type_context"

describe Decidim::Api::QueryType do
  include_context "graphql type"

  describe "session" do
    let(:query) { "{ session { user { name } } }" }

    context "When the user is logged in" do
      it "return current user data" do
        expect(response["session"]).to include("user" => { "name" => current_user.name })
      end
    end

    context "When the user is not logged in" do
      let!(:current_user) { nil }

      it "return a nil object" do
        expect(response["session"]).to be_nil
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decidim-0.1.0 decidim-comments/spec/types/query_type_spec.rb