Skip to content

Commit

Permalink
wip: test ci
Browse files Browse the repository at this point in the history
  • Loading branch information
yhru committed Oct 23, 2024
1 parent 216dc07 commit 9d500a7
Show file tree
Hide file tree
Showing 17 changed files with 106 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
timeout-minutes: 20
env:
RUBY_YJIT_ENABLE: "1"
API_BASEROW_URL: ${{ secrets.API_BASEROW_URL }}
services:
postgres:
image: postgis/postgis:14-3.3
Expand Down Expand Up @@ -124,6 +125,7 @@ jobs:
timeout-minutes: 20
env:
RUBY_YJIT_ENABLE: "1"
API_BASEROW_URL: ${{ secrets.API_BASEROW_URL }}
services:
postgres:
image: postgis/postgis:14-3.3
Expand Down
2 changes: 2 additions & 0 deletions app/graphql/api/v2/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def self.resolve_type(type_definition, object, ctx)
Types::Champs::TextChampType,
Types::Champs::TitreIdentiteChampType,
Types::Champs::VisaChampType,
Types::Champs::ReferentielDePolynesieChampType,
Types::Champs::EngagementJuridiqueChampType,
Types::GeoAreas::ParcelleCadastraleType,
Types::GeoAreas::SelectionUtilisateurType,
Expand Down Expand Up @@ -128,6 +129,7 @@ def self.resolve_type(type_definition, object, ctx)
Types::Champs::Descriptor::TextChampDescriptorType,
Types::Champs::Descriptor::TitreIdentiteChampDescriptorType,
Types::Champs::Descriptor::VisaChampDescriptorType,
Types::Champs::Descriptor::ReferentielDePolynesieChampDescriptorType,
Types::Champs::Descriptor::YesNoChampDescriptorType,
Types::Champs::Descriptor::ExpressionReguliereChampDescriptorType,
Types::Champs::Descriptor::EngagementJuridiqueChampDescriptorType
Expand Down
61 changes: 61 additions & 0 deletions app/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4793,6 +4793,11 @@ enum TypeDeChamp {
"""
titre_identite

"""
Referentiel de Polynesie
"""
referentiel_de_polynesie

"""
Visa
"""
Expand Down Expand Up @@ -4909,6 +4914,62 @@ type VisaChampDescriptor implements ChampDescriptor {
type: TypeDeChamp! @deprecated(reason: "Utilisez le champ `__typename` à la place.")
}

type ReferentielDePolynesieChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
id: ID!

"""
Libellé du champ.
"""
label: String!

"""
La valeur sélectionnée dans le référentiel.
"""
selectedValue: String

"""
Identifiant de la table utilisée pour le référentiel.
"""
tableId: ID!

"""
La valeur du champ sous forme texte.
"""
stringValue: String

"""
Date de dernière modification du champ.
"""
updatedAt: ISO8601DateTime!
}

type ReferentielDePolynesieChampDescriptor implements ChampDescriptor {
"""
Description du champ.
"""
description: String
id: ID!

"""
Libellé du champ.
"""
label: String!

"""
Est-ce que le champ est obligatoire ?
"""
required: Boolean!

"""
Type de la valeur du champ.
"""
type: TypeDeChamp!
}

"""
Message d’alerte
"""
Expand Down
2 changes: 2 additions & 0 deletions app/graphql/types/champ_descriptor_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def resolve_type(object, context)
Types::Champs::Descriptor::TeFenuaChampDescriptorType
when TypeDeChamp.type_champs.fetch(:visa)
Types::Champs::Descriptor::VisaChampDescriptorType
when TypeDeChamp.type_champs.fetch(:referentiel_de_polynesie)
Types::Champs::Descriptor::ReferentielDePolynesieChampDescriptorType

# ----- DS champs
when TypeDeChamp.type_champs.fetch(:engagement_juridique)
Expand Down
2 changes: 2 additions & 0 deletions app/graphql/types/champ_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ def resolve_type(object, context)
Types::Champs::TitreIdentiteChampType
when ::Champs::VisaChamp
Types::Champs::VisaChampType
when ::Champs::ReferentielDePolynesieChamp
Types::Champs::ReferentielDePolynesieChampType
when ::Champs::EpciChamp
Types::Champs::EpciChampType
when ::Champs::RNAChamp
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Types::Champs::Descriptor
class ReferentielDePolynesieChampDescriptorType < Types::BaseObject
implements Types::ChampDescriptorType
end
end
21 changes: 21 additions & 0 deletions app/graphql/types/champs/referentiel_de_polynesie_champ_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module Types::Champs
class ReferentielDePolynesieChampType < Types::BaseObject
implements Types::ChampType

field :selected_value, String, null: true
field :table_id, ID, null: true
field :search_field, String, null: true

def selected_value
object.value
end

def table_id
object.table_id
end

def search_field
object.search_field
end
end
end
1 change: 1 addition & 0 deletions config/locales/models/type_de_champ/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fr:
numero_dn: 'Numéro DN'
te_fenua: 'Carte de Polynésie'
visa: 'Visa'
referentiel_de_polynesie: 'Référentiel de Polynésie'
header_section: 'Titre de section'
repetition: 'Bloc répétable'
dossier_link: 'Lien vers un autre dossier'
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions spec/models/referentiel_de_polynesie/baserow_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
'Token' => ENV['API_BASEROW_TOKEN'].to_s
})

VCR.use_cassette('baserow_search') do
VCR.use_cassette('baserow/baserow_search') do
results = ReferentielDePolynesie::BaserowAPI.search(123, "term")

expect(results).to be_an(Array)
Expand All @@ -29,7 +29,7 @@
'Token' => ENV['API_BASEROW_TOKEN'].to_s
})

VCR.use_cassette('baserow_fetch_row') do
VCR.use_cassette('baserow/baserow_fetch_row') do
result = ReferentielDePolynesie::BaserowAPI.fetch_row(123, 1)

expect(result[:row]["Nom"]).to eq("Communes de polynésie")
Expand All @@ -48,7 +48,7 @@
'Token' => ENV['API_BASEROW_TOKEN'].to_s
})

VCR.use_cassette('baserow404_error') do
VCR.use_cassette('baserow/baserow404_error') do
results = ReferentielDePolynesie::BaserowAPI.fetch_row(123, 99999)

expect(results).to eq(nil)
Expand All @@ -60,7 +60,7 @@
it 'fetch the available tables', :vcr do
allow(ReferentielDePolynesie::BaserowAPI).to receive(:config)

VCR.use_cassette('baserow_available_tables') do
VCR.use_cassette('baserow/baserow_available_tables') do
results = ReferentielDePolynesie::BaserowAPI.available_tables

expect(results).to be_an(Array)
Expand Down
7 changes: 0 additions & 7 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,6 @@
end
end

VCR.configure do |config|
config.cassette_library_dir = 'spec/vcr_cassettes'
config.hook_into :webmock
config.configure_rspec_metadata!
config.allow_http_connections_when_no_cassette = false
end

config.include ActiveSupport::Testing::TimeHelpers
config.include Shoulda::Matchers::ActiveRecord, type: :model
config.include Shoulda::Matchers::ActiveModel, type: :model
Expand Down
4 changes: 2 additions & 2 deletions spec/system/administrateurs/types_de_champ_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@
before { Flipper.enable(:referentiel_de_polynesie, administrateur.user) }

it "add referentiel_de_polynesie champ" do
VCR.use_cassette('baserow_api_available_tables', record: :new_episodes) do
VCR.use_cassette('baserow/baserow_api_available_tables', record: :new_episodes) do
add_champ

select('Referentiel De Polynesie', from: 'Type de champ')
select('Référentiel de Polynésie', from: 'Type de champ')
fill_in 'Libellé du champ', with: 'Libellé de champ Référentiel de Polynésie', fill_options: { clear: :backspace }

expect(page).to have_content('Formulaire enregistré')
Expand Down

0 comments on commit 9d500a7

Please sign in to comment.