Skip to content

Commit 3ba0e23

Browse files
committed
Add specs to reach 100% line coverage
1 parent ce35994 commit 3ba0e23

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

spec/lib/http/form_data/file_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,15 @@
228228

229229
it { is_expected.to eq "application/json" }
230230
end
231+
232+
context "when given with deprecated :mime_type option" do
233+
let(:opts) { { :mime_type => "application/json" } }
234+
235+
it "uses the value and emits a deprecation warning" do
236+
expect { expect(form_file.content_type).to eq "application/json" }
237+
.to output(/DEPRECATED/).to_stderr
238+
end
239+
end
231240
end
232241

233242
describe "#mime_type" do

spec/lib/http/form_data/urlencoded_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
let(:data) { { "foo[bar]" => "test" } }
77

8+
it "raises ArgumentError when given a non-Hash top-level value" do
9+
expect { described_class.new(42) }.to raise_error(HTTP::FormData::Error)
10+
end
11+
812
it "supports any Enumerables of pairs" do
913
form_data = described_class.new([%w[foo bar], ["foo", %w[baz moo]]])
1014

@@ -46,6 +50,12 @@
4650
it { is_expected.to eq "foo[bar]=test" }
4751
end
4852

53+
context "with nil value" do
54+
let(:data) { { "foo" => nil } }
55+
56+
it { is_expected.to eq "foo" }
57+
end
58+
4959
it "rewinds content" do
5060
content = form_data.read
5161
expect(form_data.to_s).to eq content

spec/support/simplecov.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515

1616
SimpleCov.start do
1717
add_filter "/spec/"
18-
minimum_coverage 80
18+
minimum_coverage 100
1919
end

0 commit comments

Comments
 (0)