From dc3d8e039b55529a5ed5bacc56c418c87b2fc4ea Mon Sep 17 00:00:00 2001 From: Eric Mueller Date: Fri, 9 Jun 2023 22:59:20 -0400 Subject: [PATCH] add specs covering the Message.load method this was tested incidentally through spec-support methods before, and not intentionally through behavioral tests --- spec/quiet_quality/message_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/quiet_quality/message_spec.rb b/spec/quiet_quality/message_spec.rb index ff9a2b1..8b72b47 100644 --- a/spec/quiet_quality/message_spec.rb +++ b/spec/quiet_quality/message_spec.rb @@ -1,4 +1,19 @@ RSpec.describe QuietQuality::Message do + describe ".load" do + let(:data) { {path: "foo.rb", body: "some text", tool_name: :rspec, start_line: 52, level: "high"} } + subject(:loaded) { described_class.load(data) } + it { is_expected.to be_a(described_class) } + + it "has the supplied attributes" do + expect(loaded.path).to eq("foo.rb") + expect(loaded.body).to eq("some text") + expect(loaded.tool_name).to eq(:rspec) + expect(loaded.start_line).to eq(52) + expect(loaded.level).to eq("high") + expect(loaded.rule).to be_nil + end + end + subject(:message) { described_class.new(**attributes) } let(:attributes) do