acceptance_test 1.10.12 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.idea/acceptance_test.iml +1 -1
- data/CHANGES +4 -0
- data/lib/acceptance_test/acceptance_config.rb +29 -52
- data/lib/acceptance_test/acceptance_test.rb +38 -13
- data/lib/acceptance_test/version.rb +1 -1
- data/spec/spec_helper.rb +3 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjgxMjY2N2VjY2FiNjA5MjA3MmRhZmQ3Yzc4NWJkY2UxNmNlNjQ5Zg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmMzNTQ1NDc4MjBhNDA1ZGZlMjQ1OTM5NTFlMTE3NGM3NjZmMjZmZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Zjc1ODU4OWRmNTk2MGI5YmIwNjEwNGI5NjJiN2JhNzZlYzZiNGMyMTU2ZDNh
|
10
|
+
ZThjNDhiM2VlNjNmOTdlMmQ2M2IzZmZjMjQzNDI0Y2M1OTAxMDUzNGNkMDI2
|
11
|
+
ZmY3YzhlZTU0YWUwNmIxNDQzMTM5MTdlYjJjNDJmOTNmNjc1OTQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTA2ODJkNzEyYjkyZTJhM2U2ZjYyZDhlZDEyMjQyZTg4MTAyM2NiMzlmMjg1
|
14
|
+
ZjgyZGI5Nzg1MDRiNTJkZTc1YTAwYmYzMDAzZTYzMmY5N2RhM2YwNTUyMTVj
|
15
|
+
NDQ2MWNhYWZiZmQzNWVjYTg1MjljNTU0NjI2M2MzY2FhOWZlYTM=
|
data/.idea/acceptance_test.iml
CHANGED
@@ -297,7 +297,7 @@
|
|
297
297
|
<orderEntry type="sourceFolder" forTests="false" />
|
298
298
|
<orderEntry type="library" scope="PROVIDED" name="activesupport (v4.2.0, RVM: ruby-1.9.3-p551 [acceptance_test]) [gem]" level="application" />
|
299
299
|
<orderEntry type="library" scope="PROVIDED" name="builder (v3.2.2, RVM: ruby-1.9.3-p551 [acceptance_test]) [gem]" level="application" />
|
300
|
-
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.
|
300
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.8.2, RVM: ruby-1.9.3-p551 [acceptance_test]) [gem]" level="application" />
|
301
301
|
<orderEntry type="library" scope="PROVIDED" name="capybara (v2.4.4, RVM: ruby-1.9.3-p551 [acceptance_test]) [gem]" level="application" />
|
302
302
|
<orderEntry type="library" scope="PROVIDED" name="capybara-firebug (v2.1.0, RVM: ruby-1.9.3-p551 [acceptance_test]) [gem]" level="application" />
|
303
303
|
<orderEntry type="library" scope="PROVIDED" name="capybara-webkit (v1.4.1, RVM: ruby-1.9.3-p551 [acceptance_test]) [gem]" level="application" />
|
data/CHANGES
CHANGED
@@ -10,15 +10,21 @@ require 'gnawrnip'
|
|
10
10
|
class AcceptanceConfig
|
11
11
|
include Singleton
|
12
12
|
|
13
|
-
def configure workspace,
|
14
|
-
@app_name = app_name
|
13
|
+
def configure workspace, params
|
14
|
+
@app_name = params[:app_name]
|
15
15
|
|
16
16
|
support_dirs = load_code_from_support workspace
|
17
17
|
load_steps support_dirs
|
18
18
|
|
19
19
|
acceptance_test = AcceptanceTest.instance
|
20
20
|
|
21
|
-
|
21
|
+
if params[:enable_external_source]
|
22
|
+
data_reader = params[:data_reader] ? params[:data_reader] : default_data_reader
|
23
|
+
|
24
|
+
acceptance_test.enable_external_source data_reader # enable external source for gherkin
|
25
|
+
end
|
26
|
+
|
27
|
+
acceptance_test.ignore_case_in_steps if params[:ignore_case_in_steps]
|
22
28
|
|
23
29
|
acceptance_config = acceptance_config_file ? HashWithIndifferentAccess.new(YAML.load_file(acceptance_config_file)) : {}
|
24
30
|
acceptance_test.configure(acceptance_config)
|
@@ -28,7 +34,7 @@ class AcceptanceConfig
|
|
28
34
|
end
|
29
35
|
|
30
36
|
RSpec.configure do |config|
|
31
|
-
configure_turnip
|
37
|
+
acceptance_test.configure_turnip turnip_report_file, turnip_report_name
|
32
38
|
|
33
39
|
config.before(:type => :feature) do |example|
|
34
40
|
acceptance_test.setup page, example.metadata
|
@@ -82,6 +88,14 @@ class AcceptanceConfig
|
|
82
88
|
detect_file(results_dir, "#{app_name}.#{format}")
|
83
89
|
end
|
84
90
|
|
91
|
+
def turnip_report_file
|
92
|
+
File.expand_path("tmp/" + (app_name ? "#{app_name}-acceptance-report.html" : "acceptance-report.html"))
|
93
|
+
end
|
94
|
+
|
95
|
+
def turnip_report_name
|
96
|
+
"#{app_name[0].upcase+app_name[1..-1]} Acceptance"
|
97
|
+
end
|
98
|
+
|
85
99
|
def webapp_url name=:webapp_url
|
86
100
|
AcceptanceTest.instance.config[name]
|
87
101
|
end
|
@@ -106,44 +120,23 @@ class AcceptanceConfig
|
|
106
120
|
!!(AcceptanceTest.instance.config[:webapp_url] =~ /localhost/)
|
107
121
|
end
|
108
122
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
report_file = turnip_report_file(app_name)
|
113
|
-
|
114
|
-
configure_turnip_formatter report_file, app_name
|
115
|
-
|
116
|
-
configure_gnawrnip
|
117
|
-
end
|
118
|
-
|
119
|
-
def configure_turnip_formatter report_file, report_name
|
120
|
-
require 'turnip_formatter'
|
123
|
+
def default_data_reader
|
124
|
+
lambda do |source_path|
|
125
|
+
path = acceptance_data_file detect_file_from_script(source_path)
|
121
126
|
|
122
|
-
|
123
|
-
config.add_formatter RSpecTurnipFormatter, report_file
|
124
|
-
end
|
127
|
+
puts "Reading data from: #{path}"
|
125
128
|
|
126
|
-
|
127
|
-
config.title = "#{report_name[0].upcase+report_name[1..-1]} Acceptance"
|
128
|
-
end
|
129
|
-
end
|
129
|
+
ext = File.extname(path)
|
130
130
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
131
|
+
if ext == '.csv'
|
132
|
+
CSV.read(File.expand_path(path))
|
133
|
+
elsif ext == '.yml'
|
134
|
+
YAML.load_file(File.expand_path(path))
|
135
|
+
end
|
135
136
|
end
|
136
|
-
|
137
|
-
Gnawrnip.ready!
|
138
137
|
end
|
139
138
|
|
140
|
-
|
141
|
-
name = ENV['TURNIP_REPORT_PREFIX'] if ENV['TURNIP_REPORT_PREFIX']
|
142
|
-
|
143
|
-
file_name = name.nil? ? "acceptance-report.html" : "#{name}-acceptance-report.html"
|
144
|
-
|
145
|
-
File.expand_path("tmp/#{file_name}")
|
146
|
-
end
|
139
|
+
private
|
147
140
|
|
148
141
|
def load_code_from_support basedir
|
149
142
|
support_dirs = []
|
@@ -182,22 +175,6 @@ class AcceptanceConfig
|
|
182
175
|
File.exist?(full_path1) ? full_path1 : full_path2
|
183
176
|
end
|
184
177
|
|
185
|
-
def data_reader
|
186
|
-
lambda do |source_path|
|
187
|
-
path = acceptance_data_file detect_file_from_script(source_path)
|
188
|
-
|
189
|
-
puts "Reading data from: #{path}"
|
190
|
-
|
191
|
-
ext = File.extname(path)
|
192
|
-
|
193
|
-
if ext == '.csv'
|
194
|
-
CSV.read(File.expand_path(path))
|
195
|
-
elsif ext == '.yml'
|
196
|
-
YAML.load_file(File.expand_path(path))
|
197
|
-
end
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
178
|
def detect_file_from_script source_path
|
202
179
|
path = source_path % {acceptance_env: environment, format: format}
|
203
180
|
|
@@ -89,6 +89,44 @@ class AcceptanceTest
|
|
89
89
|
GherkinExt.enable_external_source data_reader
|
90
90
|
end
|
91
91
|
|
92
|
+
def configure_turnip report_file, title
|
93
|
+
# configure turnip formatter
|
94
|
+
|
95
|
+
require 'turnip_formatter'
|
96
|
+
|
97
|
+
RSpec.configure do |config|
|
98
|
+
config.add_formatter RSpecTurnipFormatter, report_file
|
99
|
+
end
|
100
|
+
|
101
|
+
TurnipFormatter.configure do |config|
|
102
|
+
config.title = title
|
103
|
+
end
|
104
|
+
|
105
|
+
# configure gnawrnip
|
106
|
+
|
107
|
+
Gnawrnip.configure do |c|
|
108
|
+
c.make_animation = true
|
109
|
+
c.max_frame_size = 1024 # pixel
|
110
|
+
end
|
111
|
+
|
112
|
+
Gnawrnip.ready!
|
113
|
+
end
|
114
|
+
|
115
|
+
def ignore_case_in_steps
|
116
|
+
require 'turnip/builder'
|
117
|
+
|
118
|
+
Turnip::Builder::Step.class_eval do
|
119
|
+
def initialize *params
|
120
|
+
description = params[0]
|
121
|
+
first_word = description[0..description.index(/\s/)]
|
122
|
+
first_word = downcase unless ["I ", "(I) "].include?(first_word)
|
123
|
+
|
124
|
+
params[0] = first_word + description[first_word.size..-1].downcase
|
125
|
+
super
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
92
130
|
private
|
93
131
|
|
94
132
|
def driver metadata
|
@@ -129,17 +167,4 @@ class AcceptanceTest
|
|
129
167
|
('a'..'z').to_a.shuffle[0, 12].join
|
130
168
|
end
|
131
169
|
|
132
|
-
# def self.get_localhost
|
133
|
-
# orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true # turn off reverse DNS resolution temporarily
|
134
|
-
#
|
135
|
-
# UDPSocket.open do |s|
|
136
|
-
# s.connect '192.168.1.1', 1
|
137
|
-
# s.addr.last
|
138
|
-
# end
|
139
|
-
# ensure
|
140
|
-
# Socket.do_not_reverse_lookup = orig
|
141
|
-
# end
|
142
|
-
|
143
|
-
# ip = `ifconfig | grep 'inet ' | grep -v 127.0.0.1 | cut -d ' ' -f2`.strip
|
144
|
-
# Capybara.app_host = http://#{ip}:#{Capybara.server_port}
|
145
170
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -3,7 +3,9 @@ require 'acceptance_test/acceptance_config'
|
|
3
3
|
ENV['CONFIG_DIR'] = "spec/wikipedia"
|
4
4
|
ENV['DATA_DIR'] = "spec/wikipedia/acceptance_data"
|
5
5
|
|
6
|
-
AcceptanceConfig.instance.configure "spec", "wikipedia"
|
6
|
+
AcceptanceConfig.instance.configure "spec", app_name: "wikipedia",
|
7
|
+
enable_external_source: true,
|
8
|
+
ignore_case_in_steps: true
|
7
9
|
|
8
10
|
RSpec.configure do |c|
|
9
11
|
# c.add_formatter 'progress'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acceptance_test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Shvets
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -295,7 +295,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
295
295
|
version: '0'
|
296
296
|
requirements: []
|
297
297
|
rubyforge_project:
|
298
|
-
rubygems_version: 2.4.
|
298
|
+
rubygems_version: 2.4.6
|
299
299
|
signing_key:
|
300
300
|
specification_version: 4
|
301
301
|
summary: Simplifies congiguration and run of acceptance tests.
|