Skip to content

Commit

Permalink
Renomme le model en shipment parce que c'est mieux et beaucoup plus c…
Browse files Browse the repository at this point in the history
…ourt
  • Loading branch information
jbfeldis committed Jun 11, 2024
1 parent 103d443 commit 33bcc6a
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 39 deletions.
19 changes: 0 additions & 19 deletions app/interactors/create_quotient_familial_request.rb

This file was deleted.

19 changes: 19 additions & 0 deletions app/interactors/create_shipment.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class CreateShipment < BaseInteractor
def call
shipment = Shipment.new(params)
if shipment.save
context.shipment = shipment
else
context.fail!(message: shipment.errors.full_messages)
end
end

private

def params
{
sub: context.identity.sub,
hubee_folder_id: context.folder.id,
}
end
end
2 changes: 0 additions & 2 deletions app/models/quotient_familial_request.rb

This file was deleted.

2 changes: 2 additions & 0 deletions app/models/shipment.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Shipment < ApplicationRecord
end
2 changes: 1 addition & 1 deletion app/organizers/store_quotient_familial.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class StoreQuotientFamilial < BaseOrganizer
organize UploadQuotientFamilialToHubEE, CreateQuotientFamilialRequest
organize UploadQuotientFamilialToHubEE, CreateShipment
end
10 changes: 0 additions & 10 deletions db/migrate/20240603084727_create_quotient_familial_requests.rb

This file was deleted.

10 changes: 10 additions & 0 deletions db/migrate/20240603084727_create_shipments.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateShipments < ActiveRecord::Migration[7.1]
def change
create_table :shipments do |t|
t.string :sub
t.string :hubee_folder_id

t.timestamps
end
end
end
2 changes: 1 addition & 1 deletion db/schema.rb

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

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FactoryBot.define do
factory :quotient_familial_request do
factory :shipment do
sub { "uuid" }
hubee_folder_id { "folder_uuid" }
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe CreateQuotientFamilialRequest, type: :interactor do
RSpec.describe CreateShipment, type: :interactor do
describe ".call" do
subject(:interactor) { described_class.call(**params) }

Expand All @@ -17,7 +17,7 @@
it { is_expected.to be_a_success }

it "creates a quotient familial request" do
expect { interactor }.to change(QuotientFamilialRequest, :count).by(1)
expect { interactor }.to change(Shipment, :count).by(1)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/organizers/store_quotient_familial_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
let(:interactors) do
[
UploadQuotientFamilialToHubEE,
CreateQuotientFamilialRequest,
CreateShipment,
]
end

Expand Down Expand Up @@ -37,8 +37,8 @@

it { is_expected.to be_a_success }

it "creates a quotient_familial_request" do
expect { organizer }.to change(QuotientFamilialRequest, :count).by(1)
it "creates a shipment" do
expect { organizer }.to change(Shipment, :count).by(1)
end
end
end

0 comments on commit 33bcc6a

Please sign in to comment.