gatling 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "gatling/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "gatling"
7
+ s.version = Gatling::VERSION
8
+ s.authors = ["Gabriel Rotbart, Amanda Koh"]
9
+ s.email = ["grotbart@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Automated visual testing}
12
+ s.description = %q{Add visual comparison matchers for rspec}
13
+
14
+ s.rubyforge_project = "gatling"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ <<<<<<< HEAD
23
+ s.add_dependency "rspec"
24
+ s.add_dependency "rmagick"
25
+ s.add_dependency "selenium-client"
26
+ s.add_dependency "capybara"
27
+ =======
28
+ s.add_dependency "rmagick"
29
+ >>>>>>> 01f1c5b58a3aa249141ef026447e2fbe9f5a8b0f
30
+ end
data/lib/gatling.rb CHANGED
@@ -1,19 +1,15 @@
1
- require "gatling/version"
2
1
  require 'RMagick'
3
2
  include Magick
4
3
 
5
- # The Gatling Comparison class allows you to build an Rspec / Capybara custom matcher comparing a :css or :xpath element to a referenced screenshot:
6
- # Example:
7
- # -----------
8
- # RSpec::Matchers.define :look_like do |expected|
9
- # match do |actual|
10
- # Gatling::Comparison.new(expected, actual).matches?
11
- # end
12
- # end
13
- # -----------
14
-
15
4
  module Gatling
16
5
  class Comparison
6
+
7
+ #TODO: Training mode
8
+ #TODO: Diff with reports
9
+ #TODO: Canidate in spec
10
+ #TODO: Point ref files to desired folder
11
+ #TODO: Fuzz matches
12
+ #TODO: Helpers for cucumber
17
13
 
18
14
  def initialize expected, actual
19
15
  @expected = expected
@@ -22,7 +18,7 @@ module Gatling
22
18
 
23
19
  def capture
24
20
  page.driver.browser.save_screenshot('temp.png')
25
- temp_screenshot = Image.read('temp.png').first
21
+ temp_screenshot = Magick::Image.read('temp.png').first
26
22
  end
27
23
 
28
24
  def crop_element
@@ -42,7 +38,7 @@ module Gatling
42
38
  def matches?
43
39
  cropped_element = crop_element
44
40
  if File.exists?(@expected)
45
- expected_img = Image.read(@expected).first
41
+ expected_img = Magick::Image.read(@expected).first
46
42
  diff_metric = cropped_element.compare_channel(expected_img, MeanAbsoluteErrorMetric)
47
43
  matches = diff_metric[1] == 0.0
48
44
  diff_metric.first.write('diff.png') unless matches
@@ -54,3 +50,5 @@ module Gatling
54
50
  end
55
51
  end
56
52
  end
53
+
54
+
@@ -1,3 +1,3 @@
1
1
  module Gatling
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gatling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-05 00:00:00.000000000Z
12
+ date: 2011-12-02 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rmagick
16
- requirement: &70351589674980 !ruby/object:Gem::Requirement
16
+ requirement: &70159714602700 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70351589674980
24
+ version_requirements: *70159714602700
25
25
  description: Add visual comparison matchers for rspec
26
26
  email:
27
27
  - grotbart@gmail.com
@@ -35,6 +35,7 @@ files:
35
35
  - README.rdoc
36
36
  - Rakefile
37
37
  - gatling.gemspec
38
+ - gatling.gemspec.orig
38
39
  - lib/gatling.rb
39
40
  - lib/gatling/version.rb
40
41
  homepage: ''