From db217a70d69694f42939969670774f10079e9a37 Mon Sep 17 00:00:00 2001 From: Adeynack Date: Tue, 22 Oct 2024 19:34:13 +0000 Subject: [PATCH] update Ruby version + fix spec --- .devcontainer/Dockerfile | 2 +- .devcontainer/devcontainer.json | 10 +--------- .rubocop.yml | 2 +- .ruby-version | 2 +- .vscode/settings.json | 5 +++++ Dockerfile | 2 +- client/src/components/core/MenuBar.tsx | 4 ++-- spec/graphql/queries/books_spec.rb | 6 ++---- spec/support/graphql_helper.rb | 6 ++++++ 9 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 1ab9c793..8d479d38 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.3.4 +FROM ruby:3.3.5 WORKDIR /workspaces/${LOCAL_WORKSPACE_FOLDER_BASENAME} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 7a29c562..d24aebd8 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -52,15 +52,7 @@ "cweijan.vscode-database-client2", "DrMerfy.overtype", "apollographql.vscode-apollo" - ], - "settings": { - "typescript.tsdk": "node_modules/typescript/lib", - "rubyLsp.rubyVersionManager": "none", - "[ruby]": { - "editor.formatOnSave": true, - "editor.defaultFormatter": "Shopify.ruby-lsp" - } - } + ] } } } diff --git a/.rubocop.yml b/.rubocop.yml index 9454fe01..5c24cc98 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,5 @@ AllCops: - TargetRubyVersion: 3.3.2 + TargetRubyVersion: 3.3.5 DisplayCopNames: true DisplayStyleGuide: true NewCops: disable diff --git a/.ruby-version b/.ruby-version index a0891f56..fa7adc7a 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.3.4 +3.3.5 diff --git a/.vscode/settings.json b/.vscode/settings.json index ae143827..9e94a889 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,4 +7,9 @@ "editor.defaultFormatter": "esbenp.prettier-vscode" }, "typescript.tsserver.experimental.enableProjectDiagnostics": true, + "typescript.tsdk": "node_modules/typescript/lib", + "[ruby]": { + "editor.formatOnSave": true, + "editor.defaultFormatter": "Shopify.ruby-lsp" + } } diff --git a/Dockerfile b/Dockerfile index bc47a6d9..7ece452a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # syntax = docker/dockerfile:1 # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile -ARG RUBY_VERSION=3.3.2 +ARG RUBY_VERSION=3.3.5 FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base # Rails app lives here diff --git a/client/src/components/core/MenuBar.tsx b/client/src/components/core/MenuBar.tsx index 2ef808e2..6f6f83c5 100644 --- a/client/src/components/core/MenuBar.tsx +++ b/client/src/components/core/MenuBar.tsx @@ -1,5 +1,5 @@ import { Menu } from "antd"; -import React, { useContext } from "react"; +import React from "react"; import { AccountBookOutlined, BookOutlined, @@ -7,7 +7,7 @@ import { UserOutlined, } from "@ant-design/icons"; import { Link, useLocation, useParams } from "react-router-dom"; -import { SessionContext, useSession } from "../../models/session"; +import { useSession } from "../../models/session"; import { ItemType, MenuItemType } from "antd/es/menu/interface"; import { bookAccountsPath, diff --git a/spec/graphql/queries/books_spec.rb b/spec/graphql/queries/books_spec.rb index 0eda41c8..07204b57 100644 --- a/spec/graphql/queries/books_spec.rb +++ b/spec/graphql/queries/books_spec.rb @@ -16,9 +16,7 @@ } GQL end - let(:queried_books) do - gql_data(query:).dig("books", "nodes") - end + let(:queried_books) { gql_data(query:).dig("books", "nodes") } before do login!(user:) if user @@ -28,7 +26,7 @@ let(:user) { nil } it "returns no book" do - expect(queried_books).to be_empty + expect(gql_errors(query:).sole["message"]).to eq FinancesSchema::NOT_FOUND_OR_NOT_AUTHORIZED_ERROR_MESSAGE end end diff --git a/spec/support/graphql_helper.rb b/spec/support/graphql_helper.rb index c24e734d..893740a6 100644 --- a/spec/support/graphql_helper.rb +++ b/spec/support/graphql_helper.rb @@ -14,6 +14,12 @@ def gql_data(query:, variables: nil) raise "GraphQL Errors: #{JSON.pretty_generate(result["errors"])}" if result["errors"].present? result.fetch("data") end + + def gql_errors(query:, variables: nil) + errors = gql(query:, variables:)["errors"] + raise "GraphQL did not return errors as expected" unless errors.present? + errors + end end RSpec.configure do |config|