Permalink
Browse files

Add Archive#view

  • Loading branch information...
1 parent 0de401d commit b1bd4ce840f8b409cab39f918f4566402bb182d8 @jarib committed Oct 9, 2011
Showing with 15 additions and 0 deletions.
  1. +4 −0 lib/har/archive.rb
  2. +11 −0 spec/har/archive_spec.rb
View
@@ -41,6 +41,10 @@ def initialize(input, uri = nil)
@uri = uri
end
+ def view
+ Viewer.new([self]).show
+ end
+
def pages
@pages ||= raw_log.fetch('pages').map { |page|
Page.new page, entries_for(page['id'])
@@ -141,5 +141,16 @@ module HAR
end
end
+ context "viewing" do
+ let(:archive) { Archive.from_file har_path("browser-blocking-time") }
+ let(:viewer) { mock(Viewer) }
+ it "launches the viewer" do
+ Viewer.should_receive(:new).with([archive]).and_return viewer
+ viewer.should_receive(:show)
+
+ archive.view
+ end
+ end
+
end # Archive
end # HAR

0 comments on commit b1bd4ce

Please sign in to comment.