Skip to content

Commit

Permalink
Add unit test for non hexadecimal string
Browse files Browse the repository at this point in the history
  • Loading branch information
chiting committed Jun 7, 2018
1 parent 21b18bc commit e4f74cf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion spec/unit/color_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module Rainbow
specify { expect(subject.b).to eq(112) }
end

context "when single string given" do
context "when single hexadecimal string given" do
let(:values) { ['#deadcc'] }

it { should be_instance_of(Color::RGB) }
Expand All @@ -48,6 +48,14 @@ module Rainbow
specify { expect(subject.b).to eq(204) }
end

context "when single non hexadecimal string given" do
let(:values) { ['green'] }

it 'raises ArgumentError' do
expect { subject }.to raise_error(ArgumentError)
end
end

context "when 2 elements" do
let(:values) { [1, 2] }

Expand Down

0 comments on commit e4f74cf

Please sign in to comment.