diff --git a/.gitignore b/.gitignore index 8b80bb7..26c65b8 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,6 @@ /spec/reports/ /tmp/ /bin/ +/vendor/bundle/ # rspec failure tracking .rspec_status diff --git a/spec/ruby_units/unit_spec.rb b/spec/ruby_units/unit_spec.rb index d919231..5970f3d 100644 --- a/spec/ruby_units/unit_spec.rb +++ b/spec/ruby_units/unit_spec.rb @@ -273,6 +273,43 @@ end end + # keyword arguments + describe RubyUnits::Unit.new(scalar: 1.5, numerator: [""], denominator: [""]) do + it { is_expected.to be_a Numeric } + it { is_expected.to be_an_instance_of Unit } + + describe "#scalar" do + subject { super().scalar } + + it { is_expected.to eq(1.5) } + it { is_expected.to be_a Float } + end + + describe "#units" do + subject { super().units } + + it { is_expected.to eq("m/s") } + end + + describe "#kind" do + subject { super().kind } + + it { is_expected.to eq(:speed) } + end + + it { is_expected.not_to be_temperature } + it { is_expected.not_to be_degree } + it { is_expected.to be_base } + it { is_expected.not_to be_unitless } + it { is_expected.not_to be_zero } + + describe "#base" do + subject { super().base } + + it { is_expected.to eq(subject) } + end + end + # scalar and unit describe RubyUnits::Unit.new("1 mm") do it { is_expected.to be_a Numeric }