Skip to content

Commit dea38b0

Browse files
committed
Fix some tests and docs
1 parent 81d1d90 commit dea38b0

File tree

8 files changed

+28
-28
lines changed

8 files changed

+28
-28
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.0
1+
0.0.0

app/graphql/types/metadata_type.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
module Types
44
class MetadataType < Types::BaseObject
5-
graphql_name 'Metadata'
65
description 'Application metadata'
76

8-
field :version, GraphQL::Types::String, null: false, description: 'Application version'
97
field :extensions, [GraphQL::Types::String], null: false, description: 'List of loaded extensions'
8+
field :version, GraphQL::Types::String, null: false, description: 'Application version'
109
end
1110
end

app/graphql/types/query_type.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ def application_settings
6969

7070
def metadata
7171
{
72-
version: Sagittarius::VERSION,
73-
extensions: Sagittarius::Extensions.active.map(&:to_s)
72+
version: Sagittarius::Version,
73+
extensions: Sagittarius::Extensions.active.map(&:to_s),
7474
}
7575
end
7676

docs/graphql/object/metadata.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: Metadata
3+
---
4+
5+
Application metadata
6+
7+
## Fields without arguments
8+
9+
| Name | Type | Description |
10+
|------|------|-------------|
11+
| `extensions` | [`[String!]!`](../scalar/string.md) | List of loaded extensions |
12+
| `version` | [`String!`](../scalar/string.md) | Application version |
13+

docs/graphql/object/query.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Root Query type
1212
| `currentAuthentication` | [`Authentication`](../union/authentication.md) | Get the currently logged in authentication |
1313
| `currentUser` | [`User`](../object/user.md) | Get the currently logged in user |
1414
| `globalRuntimes` | [`RuntimeConnection!`](../object/runtimeconnection.md) | Find runtimes |
15+
| `metadata` | [`Metadata!`](../object/metadata.md) | Get application metadata |
1516
| `organizations` | [`OrganizationConnection!`](../object/organizationconnection.md) | Find organizations |
1617
| `userAbilities` | [`InstanceUserAbilities!`](../object/instanceuserabilities.md) | Abilities for the current user on this Instance |
1718
| `users` | [`UserConnection!`](../object/userconnection.md) | Find users |

lib/sagittarius/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module Sagittarius
4-
VERSION = File.read(File.expand_path('../../VERSION', __dir__)).strip.freeze
4+
Version = File.read(File.expand_path('../../VERSION', __dir__)).strip.freeze
55
end

spec/graphql/types/metadata_type_spec.rb

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,13 @@
33
require 'rails_helper'
44

55
RSpec.describe Types::MetadataType do
6-
it { expect(described_class.graphql_name).to eq('Metadata') }
7-
it { expect(described_class).to have_graphql_fields(:version, :extensions) }
8-
9-
describe 'fields' do
10-
subject(:field) { described_class.fields[field_name] }
11-
12-
shared_examples 'metadata field' do |expected_type|
13-
it { expect(field.type).to eq(expected_type) }
14-
end
15-
16-
describe 'version' do
17-
let(:field_name) { 'version' }
18-
19-
it_behaves_like 'metadata field', 'String!'
20-
end
21-
22-
describe 'extensions' do
23-
let(:field_name) { 'extensions' }
24-
25-
it_behaves_like 'metadata field', '[String!]!'
26-
end
6+
let(:fields) do
7+
%w[
8+
version
9+
extensions
10+
]
2711
end
12+
13+
it { expect(described_class.graphql_name).to eq('Metadata') }
14+
it { expect(described_class).to have_graphql_fields(fields) }
2815
end

spec/requests/graphql/query/metadata_query_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
before { post_graphql query }
2020

2121
it 'returns the application version' do
22-
expect(graphql_data_at(:metadata, :version)).to eq(Sagittarius::VERSION)
22+
expect(graphql_data_at(:metadata, :version)).to eq(Sagittarius::Version)
2323
end
2424

2525
it 'returns the list of active extensions' do

0 commit comments

Comments
 (0)