web_performo 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,4 +1,8 @@
1
- === 0.0.1 2010-05-11
1
+ === 0.1 2010-05-11
2
2
 
3
3
  * 1 major enhancement:
4
4
  * Initial release
5
+
6
+ === 0.2 2010-05-11
7
+
8
+ * Added missing lib to manifest (oops)
data/Manifest.txt CHANGED
@@ -3,10 +3,8 @@ Manifest.txt
3
3
  README.rdoc
4
4
  Rakefile
5
5
  lib/web_performo.rb
6
+ lib/web_performo/assertion.rb
6
7
  lib/web_performo/result.rb
7
- script/console
8
- script/destroy
9
- script/generate
10
8
  spec/web_performo_results_spec.rb
11
9
  spec/web_performo_spec.rb
12
- tasks/test.rake
10
+ tasks/test.rake
data/lib/web_performo.rb CHANGED
@@ -4,7 +4,7 @@ include Socket::Constants
4
4
  require 'selenium-webdriver'
5
5
 
6
6
  class WebPerformo
7
- VERSION = '0.1'
7
+ VERSION = '0.2'
8
8
 
9
9
  def initialize browser = 'firefox'
10
10
  @browser = browser.to_sym
@@ -52,4 +52,4 @@ class WebPerformo
52
52
  yield *params
53
53
  Time.now.to_f - before
54
54
  end
55
- end
55
+ end
@@ -0,0 +1,35 @@
1
+ class WebPerformo
2
+ class Assertion
3
+ def initialize result
4
+ @result = result
5
+ end
6
+
7
+ def > candidate
8
+ errors = []
9
+
10
+ errors << "first byte #{@result.first_byte_speed} !> #{candidate.first_byte_speed}" if @result.first_byte_speed <= candidate.first_byte_speed
11
+ errors << "render #{@result.render_speed} !> #{candidate.render_speed}" if @result.render_speed <= candidate.render_speed
12
+
13
+ format_errors '>', candidate, errors
14
+ end
15
+
16
+ def < candidate
17
+ errors = []
18
+
19
+ errors << "first byte #{@result.first_byte_speed} !< #{candidate.first_byte_speed}" if @result.first_byte_speed >= candidate.first_byte_speed
20
+ errors << "render #{@result.render_speed} !< #{candidate.render_speed}" if @result.render_speed >= candidate.render_speed
21
+
22
+ format_errors '<', candidate, errors
23
+ end
24
+
25
+ private
26
+
27
+ def format_errors operator, candidate, errors
28
+ return true if errors.length == 0
29
+
30
+ error_msg = "Failed asserting '#{@result.url}' #{operator} '#{candidate.url}'"
31
+
32
+ raise "#{error_msg} (#{errors.join(', ')})"
33
+ end
34
+ end
35
+ end
metadata CHANGED
@@ -1,7 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_performo
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.1"
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ version: "0.2"
5
9
  platform: ruby
6
10
  authors:
7
11
  - Stephen Hardisty
@@ -14,34 +18,46 @@ default_executable:
14
18
  dependencies:
15
19
  - !ruby/object:Gem::Dependency
16
20
  name: selenium-webdriver
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
21
+ prerelease: false
22
+ requirement: &id001 !ruby/object:Gem::Requirement
20
23
  requirements:
21
24
  - - ">="
22
25
  - !ruby/object:Gem::Version
26
+ segments:
27
+ - 0
28
+ - 0
29
+ - 18
23
30
  version: 0.0.18
24
- version:
31
+ type: :runtime
32
+ version_requirements: *id001
25
33
  - !ruby/object:Gem::Dependency
26
34
  name: rubyforge
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
30
37
  requirements:
31
38
  - - ">="
32
39
  - !ruby/object:Gem::Version
40
+ segments:
41
+ - 2
42
+ - 0
43
+ - 4
33
44
  version: 2.0.4
34
- version:
45
+ type: :development
46
+ version_requirements: *id002
35
47
  - !ruby/object:Gem::Dependency
36
48
  name: hoe
37
- type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
49
+ prerelease: false
50
+ requirement: &id003 !ruby/object:Gem::Requirement
40
51
  requirements:
41
52
  - - ">="
42
53
  - !ruby/object:Gem::Version
54
+ segments:
55
+ - 2
56
+ - 6
57
+ - 0
43
58
  version: 2.6.0
44
- version:
59
+ type: :development
60
+ version_requirements: *id003
45
61
  description: |-
46
62
  Measures the time it takes a given web page to both return the first byte
47
63
  and to render in a given browser.
@@ -60,10 +76,8 @@ files:
60
76
  - README.rdoc
61
77
  - Rakefile
62
78
  - lib/web_performo.rb
79
+ - lib/web_performo/assertion.rb
63
80
  - lib/web_performo/result.rb
64
- - script/console
65
- - script/destroy
66
- - script/generate
67
81
  - spec/web_performo_results_spec.rb
68
82
  - spec/web_performo_spec.rb
69
83
  - tasks/test.rake
@@ -81,18 +95,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
95
  requirements:
82
96
  - - ">="
83
97
  - !ruby/object:Gem::Version
98
+ segments:
99
+ - 0
84
100
  version: "0"
85
- version:
86
101
  required_rubygems_version: !ruby/object:Gem::Requirement
87
102
  requirements:
88
103
  - - ">="
89
104
  - !ruby/object:Gem::Version
105
+ segments:
106
+ - 0
90
107
  version: "0"
91
- version:
92
108
  requirements: []
93
109
 
94
110
  rubyforge_project: web_performo
95
- rubygems_version: 1.3.5
111
+ rubygems_version: 1.3.6
96
112
  signing_key:
97
113
  specification_version: 3
98
114
  summary: Measures the time it takes a given web page to both return the first byte and to render in a given browser.
data/script/console DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # File: script/console
3
- irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
-
5
- libs = " -r irb/completion"
6
- # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
- # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
- libs << " -r #{File.dirname(__FILE__) + '/../lib/web_performo.rb'}"
9
- puts "Loading web_performo gem"
10
- exec "#{irb} #{libs} --simple-prompt"
data/script/destroy DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/destroy'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/generate'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Generate.new.run(ARGV)