gatling 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +0 -17
- data/lib/gatling.rb +3 -5
- data/lib/gatling/config.rb +2 -20
- data/lib/gatling/version.rb +1 -1
- data/spec/acceptance/gatling_acceptance_spec.rb +0 -29
- data/spec/acceptance/rspec_matcher_spec.rb +0 -7
- data/spec/configuration_spec.rb +2 -35
- data/spec/integration/gatling_integration_spec.rb +0 -1
- data/spec/spec_helper.rb +0 -1
- metadata +16 -16
data/README.rdoc
CHANGED
@@ -64,23 +64,6 @@ If no reference image exits, the test will fail, an exception will be raised and
|
|
64
64
|
|
65
65
|
-------------------------------------
|
66
66
|
|
67
|
-
=== Training mode:
|
68
|
-
|
69
|
-
Gatling can be run in training mode which will create reference images where ones do not exist.
|
70
|
-
|
71
|
-
<b>CAUTION: Trainer mode will pass all the test which rely on the Gatling custom matcher, this can mean a false green build.
|
72
|
-
Please make sure you are saving 'clean' references</b>
|
73
|
-
|
74
|
-
Trainer mode will not overwrite existing references. If you are updating, just delete the old reference image.
|
75
|
-
|
76
|
-
To set trainer mode, prefix rspec command line with $GATLING_TRAINER = true
|
77
|
-
|
78
|
-
|
79
|
-
Example:
|
80
|
-
$GATLING_TRAINER = true rspec spec/my_spec.rb
|
81
|
-
|
82
|
-
-------------------------------------
|
83
|
-
|
84
67
|
==== Non-gem dependencies:
|
85
68
|
|
86
69
|
Imagemagick must be installed:
|
data/lib/gatling.rb
CHANGED
@@ -21,11 +21,9 @@ module Gatling
|
|
21
21
|
|
22
22
|
expected_reference_file = (File.join(Gatling::Configuration.path(:reference), expected_reference_filename))
|
23
23
|
|
24
|
-
if
|
25
|
-
|
26
|
-
|
27
|
-
return true
|
28
|
-
end
|
24
|
+
if ENV['GATLING_TRAINER']
|
25
|
+
raise 'GATLING_TRAINER has been depreciated. Gatling will now create reference files where ones are missing. Delete bad references and re-run Gatling to re-train'
|
26
|
+
end
|
29
27
|
|
30
28
|
if !File.exists?(expected_reference_file)
|
31
29
|
actual_image = Gatling::ImageFromElement.new(actual_element, expected_reference_filename)
|
data/lib/gatling/config.rb
CHANGED
@@ -5,12 +5,12 @@ module Gatling
|
|
5
5
|
|
6
6
|
class << self
|
7
7
|
|
8
|
-
attr_accessor :reference_image_path, :
|
8
|
+
attr_accessor :reference_image_path, :max_no_tries, :sleep_between_tries, :browser_folders
|
9
9
|
|
10
10
|
attr_reader :paths
|
11
11
|
|
12
12
|
def reference_image_path
|
13
|
-
|
13
|
+
construct_path
|
14
14
|
end
|
15
15
|
|
16
16
|
def max_no_tries
|
@@ -33,24 +33,6 @@ module Gatling
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
def trainer_toggle
|
37
|
-
@trainer_value = ENV['GATLING_TRAINER']
|
38
|
-
|
39
|
-
case @trainer_value
|
40
|
-
when nil
|
41
|
-
@trainer_value = nil
|
42
|
-
when 'true'
|
43
|
-
@trainer_value = true
|
44
|
-
when 'false'
|
45
|
-
@trainer_value = false
|
46
|
-
else
|
47
|
-
@trainer_value = false
|
48
|
-
puts 'Unknown GATLING_TRAINER argument. Please supply true, false or nil. DEFAULTING TO FALSE'
|
49
|
-
end
|
50
|
-
@trainer_toggle ||= @trainer_value ||= false
|
51
|
-
end
|
52
|
-
|
53
|
-
|
54
36
|
def construct_path
|
55
37
|
private
|
56
38
|
reference_image_path = user_set_reference_path || default_reference_path
|
data/lib/gatling/version.rb
CHANGED
@@ -73,35 +73,6 @@ describe 'Gatling' do
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
describe 'Gatling trainer toggle' do
|
77
|
-
|
78
|
-
it 'will save a reference file if no reference file already exists' do
|
79
|
-
Gatling::Configuration.trainer_toggle = true
|
80
|
-
File.exists?(File.join(@ref_path, "black.png")).should be_false
|
81
|
-
$stdout.should_receive(:puts).with "Saved #{@ref_path}/#{"black.png"} as reference"
|
82
|
-
black_element = element_for_spec
|
83
|
-
|
84
|
-
expect {Gatling.matches?("black.png", black_element)}.should_not raise_error
|
85
|
-
|
86
|
-
File.exists?(File.join(@ref_path, "black.png")).should be_true
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'will warn if a reference already exists and not overwrite it' do
|
90
|
-
create_square_image(@ref_path, 'black')
|
91
|
-
Gatling::Configuration.trainer_toggle = true
|
92
|
-
expected_message = "#{File.join(@ref_path,"black.png")} already exists. reference image was not overwritten. " +
|
93
|
-
"please delete the old file to update reference"
|
94
|
-
black_element = element_for_spec
|
95
|
-
reference_file_ctime = File.ctime(File.join(@ref_path,"black.png"))
|
96
|
-
|
97
|
-
$stdout.should_receive(:puts).with expected_message
|
98
|
-
Gatling.matches?("black.png", black_element).should be_true
|
99
|
-
|
100
|
-
sleep(1)
|
101
|
-
reference_file_ctime.eql?(File.ctime(File.join(@ref_path, "black.png"))).should be_true
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
76
|
describe 'Gatling browser folders' do
|
106
77
|
|
107
78
|
it 'should set image path according to the driver\'s browser' do
|
@@ -28,12 +28,5 @@ describe 'rspec matcher' do
|
|
28
28
|
expect{red_element.should look_like(@black_box)}.should raise_error
|
29
29
|
end
|
30
30
|
|
31
|
-
it 'will return true if it makes a new reference image in trainer mode' do
|
32
|
-
Gatling::Configuration.trainer_toggle = true
|
33
|
-
black_element = element_for_spec("#black")
|
34
|
-
black_element.should look_like(@black_box)
|
35
|
-
File.exists?(File.join(@ref_path, @black_box)).should be_true
|
36
|
-
end
|
37
|
-
|
38
31
|
end
|
39
32
|
end
|
data/spec/configuration_spec.rb
CHANGED
@@ -35,12 +35,12 @@ describe Gatling::Configuration do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should be overrideable in a rails environment" do
|
38
|
-
|
38
|
+
Gatling.reference_image_path = "my custom path"
|
39
39
|
Gatling::Configuration.reference_image_path.should eql("my custom path")
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'should return the directory for a type of image' do
|
43
|
-
Gatling
|
43
|
+
Gatling.reference_image_path = "a_path"
|
44
44
|
subject.path(:temp).should == 'a_path/temp'
|
45
45
|
end
|
46
46
|
|
@@ -87,39 +87,6 @@ describe Gatling::Configuration do
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
-
describe '#trainer_toggle' do
|
91
|
-
|
92
|
-
it 'should default to false' do
|
93
|
-
subject.trainer_toggle.should eql(false)
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'can be toggled to true' do
|
97
|
-
Gatling::Configuration.trainer_toggle = true
|
98
|
-
subject.trainer_toggle.should eql(true)
|
99
|
-
end
|
100
|
-
|
101
|
-
it 'toggeled using GATLING_TRAINER = false' do
|
102
|
-
ENV['GATLING_TRAINER'] = 'false'
|
103
|
-
subject.trainer_toggle.should eql(false)
|
104
|
-
end
|
105
|
-
|
106
|
-
it 'toggeled using GATLING_TRAINER = true' do
|
107
|
-
ENV['GATLING_TRAINER'] = 'true'
|
108
|
-
subject.trainer_toggle.should eql(true)
|
109
|
-
end
|
110
|
-
|
111
|
-
it 'toggeled using GATLING_TRAINER = nil' do
|
112
|
-
ENV['GATLING_TRAINER'] = nil
|
113
|
-
subject.trainer_toggle.should eql(false)
|
114
|
-
end
|
115
|
-
|
116
|
-
after(:each) do
|
117
|
-
Gatling::Configuration.trainer_toggle = false
|
118
|
-
ENV['GATLING_TRAINER'] = nil
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
|
123
90
|
describe "#max_no_tries" do
|
124
91
|
|
125
92
|
it "should default to 5" do
|
data/spec/spec_helper.rb
CHANGED
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: 1.1.
|
4
|
+
version: 1.1.2
|
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: 2012-
|
12
|
+
date: 2012-08-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rmagick
|
16
|
-
requirement: &
|
16
|
+
requirement: &70284092348740 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.13.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70284092348740
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec-core
|
27
|
-
requirement: &
|
27
|
+
requirement: &70284092347260 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 2.8.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70284092347260
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70284092346420 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.8.0
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70284092346420
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: capybara
|
49
|
-
requirement: &
|
49
|
+
requirement: &70284092345580 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.1.2
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70284092345580
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rake
|
60
|
-
requirement: &
|
60
|
+
requirement: &70284092344680 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 0.9.2
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70284092344680
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec-instafail
|
71
|
-
requirement: &
|
71
|
+
requirement: &70284092343720 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 0.1.8
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70284092343720
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: pry
|
82
|
-
requirement: &
|
82
|
+
requirement: &70284092343120 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: 0.9.8.2
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70284092343120
|
91
91
|
description: Add visual comparison matchers for rspec
|
92
92
|
email:
|
93
93
|
- grotbart@gmail.com
|