har 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/har.rb CHANGED
@@ -7,6 +7,7 @@ module HAR
7
7
  class ValidationError < StandardError; end
8
8
  end
9
9
 
10
+ require 'har/version'
10
11
  require 'har/serializable'
11
12
  require 'har/schema_type'
12
13
  require 'har/page'
@@ -1,3 +1,3 @@
1
1
  module HAR
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -74,7 +74,12 @@ module HAR
74
74
  options[:port] = int
75
75
  end
76
76
 
77
- opts.on "-v", "--validate" do
77
+ opts.on "-v", "--version" do
78
+ puts "har #{HAR::VERSION}"
79
+ exit
80
+ end
81
+
82
+ opts.on "-w", "--validate" do
78
83
  options[:validate] = true
79
84
  end
80
85
  end.parse!(args)
@@ -3,19 +3,31 @@ require File.expand_path("../../spec_helper", __FILE__)
3
3
  module HAR
4
4
  describe Viewer do
5
5
 
6
- context "creating" do
7
- it "validates the given HARs if asked to" do
8
- lambda { Viewer.new(["--validate", *all_hars]) }.should raise_error(ValidationError)
9
- end
6
+ context "options" do
7
+ it "has sensible defaults" do
8
+ v = Viewer.new([google_path])
10
9
 
11
- it "has a merged archive" do
12
- Viewer.new(good_hars).har.should be_kind_of(Archive)
10
+ v.options[:port] == 1234
11
+ v.options[:validate] == true
13
12
  end
14
13
 
15
- it "parses options" do
16
- v = Viewer.new(["-p", "1234", *good_hars])
14
+ it "parses the port option" do
15
+ v = Viewer.new(["-p", "1234", google_path])
17
16
  v.options[:port].should == 1234
18
17
  end
18
+
19
+ it "parses the --validate option" do
20
+ v = Viewer.new(["--validate", google_path])
21
+ v.options[:validate].should be_true
22
+ end
23
+ end
24
+
25
+ it "validates the given HARs if asked to" do
26
+ lambda { Viewer.new(["--validate", *all_hars]) }.should raise_error(ValidationError)
27
+ end
28
+
29
+ it "has a merged archive" do
30
+ Viewer.new(good_hars).har.should be_kind_of(Archive)
19
31
  end
20
32
 
21
33
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jari Bakken