docbrown/spec/labor/hex_comparer_spec.rb
rhymes a1787d0702 Fixed some Style/* rubocop violations (#2314)
* Fix Style/FormatString and Style/TrivialAccessors

* Fix Style/NegatedIf and Style/DoubleNegation

* Style/ClassAndModuleChildren is already enabled by default

* Fix Style/GlobalVars

* Group all style/ cops inside rubocop config file
2019-04-06 14:24:33 -04:00

26 lines
786 B
Ruby

require "rails_helper"
RSpec.describe HexComparer do
it "returns biggest hex" do
expect(described_class.new(["#ffffff", "#000000"]).biggest).to eq("#ffffff")
end
it "returns smallest hex" do
expect(described_class.new(["#ffffff", "#000000"]).smallest).to eq("#000000")
end
it "orders hexes" do
result = described_class.new(["#ffffff", "#111111", "#333333", "#000000"]).order
expect(result).to eq(["#000000", "#111111", "#333333", "#ffffff"])
end
it "changes brightness to the smallest color" do
hc = described_class.new(["#ccddee", "#ffffff"])
expect(hc.brightness(0.5)).to eq("#666f77")
end
it "adds an accent to the smallest color" do
hc = described_class.new(["#ccddee", "#ffffff"])
expect(hc.accent).to eq("#d8eafc")
end
end