Skip to content

Commit

Permalink
Add Archive#view
Browse files Browse the repository at this point in the history
  • Loading branch information
jarib committed Oct 9, 2011
1 parent 0de401d commit b1bd4ce
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/har/archive.rb
Expand Up @@ -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'])
Expand Down
11 changes: 11 additions & 0 deletions spec/har/archive_spec.rb
Expand Up @@ -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.