Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/solver-it-sro/govbox-pro in…
Browse files Browse the repository at this point in the history
…to GO-293/forms_and_templates_core_domain
  • Loading branch information
luciajanikova committed Dec 5, 2023
2 parents bcc7b21 + 97c2852 commit 47f814d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion app/components/message_draft_body_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<% if @message.being_submitted? %>
<p class="flex-grow-0 flex-shrink-0 text-sm text-left text-purple-600">Správa sa odosiela</p>
<% elsif @message.submitted? %>
<p class="flex-grow-0 flex-shrink-0 text-sm text-left text-purple-600">Správa je odoslaná</p>
<p class="flex-grow-0 flex-shrink-0 text-sm text-left text-purple-600">Správa bola odoslaná</p>
<% end %>
</div>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/models/upvs/delivery_notification_tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Upvs::DeliveryNotificationTag < ::Tag
def self.find_or_create_for_tenant!(tenant)
find_or_create_by!(
type: self.to_s,
tenant_id: tenant
tenant: tenant
) do |tag|
tag.name = "Na prevzatie"
tag.visible = true
Expand Down
12 changes: 0 additions & 12 deletions test/fixtures/tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ ssd_other:
visible: true
tenant: ssd

ssd_delivery_notification:
name: Na prevzatie
type: Upvs::DeliveryNotificationTag
visible: true
tenant: ssd

ssd_construction:
name: Construction
type: SimpleTag
Expand Down Expand Up @@ -79,9 +73,3 @@ solver_drafts:
type: DraftTag
visible: true
tenant: solver

solver_delivery_notification:
name: Na prevzatie
type: Upvs::DeliveryNotificationTag
visible: true
tenant: solver
9 changes: 9 additions & 0 deletions test/jobs/govbox/process_message_job_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,13 @@ class Govbox::ProcessMessageJobTest < ActiveJob::TestCase

assert outbox_message.reload.collapsed?
end

test "successfully processes a delivery notification" do
inbox_govbox_message = govbox_messages(:solver_delivery_notification)
Govbox::ProcessMessageJob.new.perform(inbox_govbox_message)

message = Message.find_by_uuid(inbox_govbox_message.payload["message_id"])

assert message
end
end
15 changes: 10 additions & 5 deletions test/models/message_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@ class MessageTest < ActiveSupport::TestCase
end

test "remove_cascade_tag method should delete tag from message and also message thread if no more messages with the tag" do
message = messages(:solver_main_delivery_notification_one)
tag = tags(:solver_delivery_notification)
message = messages(:ssd_main_general_one)
tag = tags(:ssd_finance)

message.add_cascading_tag(tag)

assert message.tags.include?(tag)
assert message.thread.tags.include?(tag)

message.remove_cascading_tag(tag)

assert_equal message.tags.include?(tag), false
assert_equal message.thread.tags.include?(tag), false
assert_not message.tags.include?(tag)
assert_not message.thread.tags.include?(tag)
end

test "remove_cascade_tag method should delete tag from message and keep it on message thread if more messages with the tag" do
Expand All @@ -27,7 +32,7 @@ class MessageTest < ActiveSupport::TestCase

message.remove_cascading_tag(tag)

assert_equal message.tags.include?(tag), false
assert_not message.tags.include?(tag)
assert message.thread.tags.include?(tag)
end
end

0 comments on commit 47f814d

Please sign in to comment.