Add tests for `Retrospring::Version`
This commit is contained in:
parent
7e8ba6c647
commit
b5c40619be
|
@ -0,0 +1,36 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "version"
|
||||
|
||||
RSpec.describe Retrospring::Version do
|
||||
before(:each) do
|
||||
allow(Retrospring::Version).to receive(:year) { 1984 }
|
||||
allow(Retrospring::Version).to receive(:month) { 1 }
|
||||
allow(Retrospring::Version).to receive(:day) { 1 }
|
||||
allow(Retrospring::Version).to receive(:patch) { 0 }
|
||||
end
|
||||
|
||||
describe "#to_s" do
|
||||
context "without suffix" do
|
||||
it "should return the correct version string" do
|
||||
expect(Retrospring::Version.to_s).to eq("1984.0101.0")
|
||||
end
|
||||
end
|
||||
|
||||
context "with suffix" do
|
||||
before(:each) do
|
||||
allow(Retrospring::Version).to receive(:suffix) { "+shutdown" }
|
||||
end
|
||||
|
||||
it "should return the correct version string" do
|
||||
expect(Retrospring::Version.to_s).to eq("1984.0101.0+shutdown")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#to_a" do
|
||||
it "should return the correct version as array" do
|
||||
expect(Retrospring::Version.to_a).to eq(["1984", "0101", "0"])
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue