From 468bbf13883d00d220fdc6b3d8c2cd0f475f242c Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Thu, 10 Apr 2025 13:15:29 +0200 Subject: [PATCH] Add test --- test/fixtures/cards.yml | 1 + test/models/card/colored_test.rb | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 test/models/card/colored_test.rb diff --git a/test/fixtures/cards.yml b/test/fixtures/cards.yml index 3ff63f1a3..0373030f3 100644 --- a/test/fixtures/cards.yml +++ b/test/fixtures/cards.yml @@ -27,6 +27,7 @@ text: created_at: <%= 1.week.ago %> status: published last_active_at: <%= Time.current %> + stage: qa_in_progress shipping: collection: writebook diff --git a/test/models/card/colored_test.rb b/test/models/card/colored_test.rb new file mode 100644 index 000000000..f4bd1bf36 --- /dev/null +++ b/test/models/card/colored_test.rb @@ -0,0 +1,16 @@ +require "test_helper" + +class Card::ColoredTest < ActiveSupport::TestCase + test "use default color no stage" do + assert_equal Colorable::DEFAULT_COLOR, cards(:logo).color + end + + test "use default color not in doing stage" do + assert_equal Colorable::DEFAULT_COLOR, cards(:text).color + end + + test "infer color from stage when in doing stage" do + cards(:text).engage + assert_equal cards(:text).stage.color, cards(:text).color + end +end