Permalink
Browse files

Raise ArgumentError if given an empty Array

  • Loading branch information...
1 parent 4c7548e commit 225d9d909b813f20707c74e819ed9886702a65f1 @jarib committed Jan 17, 2011
Showing with 5 additions and 1 deletion.
  1. +1 −1 lib/har/archive.rb
  2. +4 −0 spec/har/archive_spec.rb
View
@@ -13,7 +13,7 @@ def self.from_file(path)
def self.by_merging(hars)
hars = hars.dup
- result = hars.shift
+ result = hars.shift or raise ArgumentError, "no HARs given"
result = from_file(result) unless result.kind_of? self
hars.each do |har|
View
@@ -22,6 +22,10 @@ module HAR
ar = Archive.by_merging [har_path("browser-blocking-time"), har_path("google.com")]
ar.pages.size.should == 3
end
+
+ it "raises ArgumentError if the given array is empty" do
+ lambda { Archive.by_merging [] }.should raise_error(ArgumentError)
+ end
end
context "fetching data" do

0 comments on commit 225d9d9

Please sign in to comment.