quke 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ RSpec.describe Quke::DriverRegistration do
6
+ describe "#register" do
7
+
8
+ context "A valid driver is passed to the method" do
9
+ %i[firefox chrome browserstack phantomjs].each do |driver|
10
+ it "returns the value :#{driver} when that driver is selected" do
11
+ Quke::Configuration.file_location = data_path(".#{driver}.yml")
12
+ config = Quke::Configuration.new
13
+ driver_config = Quke::DriverConfiguration.new(config)
14
+ driver_reg = Quke::DriverRegistration.new(driver_config, config)
15
+ driver = driver_reg.register(config.driver)
16
+ expect(driver).to eq(driver)
17
+ end
18
+ end
19
+ end
20
+
21
+ context "An unrecognised driver is passed to the method" do
22
+ it "returns the default value :phantomjs" do
23
+ Quke::Configuration.file_location = data_path(".invalid.yml")
24
+ config = Quke::Configuration.new
25
+ driver_config = Quke::DriverConfiguration.new(config)
26
+ driver_reg = Quke::DriverRegistration.new(driver_config, config)
27
+ driver = driver_reg.register(config.driver)
28
+ expect(driver).to eq(driver)
29
+ end
30
+ end
31
+ end
32
+
33
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ RSpec.describe Quke do
6
+ describe ".execute" do
7
+ %i[firefox chrome browserstack phantomjs].each do |driver|
8
+ before(:example) do
9
+ Quke::Configuration.file_location = data_path(".#{driver}.yml")
10
+ Quke::Quke.config = Quke::Configuration.new
11
+ end
12
+
13
+ it "does not raise an error when called with driver :#{driver}" do
14
+ expect { Quke::Quke.execute }.not_to raise_error
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Require and run our simplecov initializer as the very first thing we do.
4
+ # This is as per its docs https://github.com/colszowka/simplecov#getting-started
5
+ require "./spec/support/simplecov"
6
+
7
+ # Support debugging in the tests
8
+ require "byebug"
9
+
10
+ # The following line is provided for convenience purposes. It has the downside
11
+ # of increasing the boot-up time by auto-requiring all files in the support
12
+ # directory. However in a small gem like this the increase should be neglible
13
+ Dir[File.join(__dir__, "support", "**", "*.rb")].each { |f| require f }
14
+
15
+ # Need to require our actual code files
16
+ require "quke"
17
+
18
+ RSpec.configure do |config|
19
+ # Allows RSpec to persist some state between runs in order to support
20
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
21
+ # you configure your source control system to ignore this file.
22
+ config.example_status_persistence_file_path = "spec/examples.txt"
23
+
24
+ # Disable RSpec exposing methods globally on `Module` and `main`
25
+ config.disable_monkey_patching!
26
+
27
+ config.expect_with :rspec do |c|
28
+ c.syntax = :expect
29
+ end
30
+
31
+ # Enable the ability to run only selected tests. This means rather than
32
+ # having to pass the specifics in at the command line we can denote which
33
+ # tests we want to run in the code.
34
+ # https://www.relishapp.com/rspec/rspec-core/docs/filtering/inclusion-filters
35
+ config.filter_run focus: true
36
+ config.run_all_when_everything_filtered = true
37
+
38
+ # Makes our helper methods available to all specs
39
+ config.include Helpers
40
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Helpers methods for use in all rspec tests
4
+ module Helpers
5
+
6
+ # Returns the full path to a named file in the 'data' folder, for example
7
+ #
8
+ # data_path('.simple_config.yml') # "/Users/jsmith/freakin/data/.simple_config.yml"
9
+ #
10
+ def data_path(path)
11
+ File.expand_path(path, data_root)
12
+ end
13
+
14
+ # Returns the full path to the 'data' folder in this project, for example
15
+ #
16
+ # "/Users/jsmith/freakin/data"
17
+ #
18
+ def data_root
19
+ File.expand_path("spec/data", Dir.pwd)
20
+ end
21
+
22
+ # Returns a string which contains all the preferences set in an instance of
23
+ # Selenium::WebDriver::Firefox::Profile.
24
+ #
25
+ # Though we can set the properties of an Selenium::WebDriver::Firefox::Profile
26
+ # it makes it bloody awkward (!) to read them back. For example we can set
27
+ #
28
+ # profile = Selenium::WebDriver::Firefox::Profile.new
29
+ # profile.proxy = Selenium::WebDriver::Proxy.new(...)
30
+ #
31
+ # Because it has a writer method (+proxy=+). However there is no reader and
32
+ # this appears to be the case for most of its properties.
33
+ # https://github.com/SeleniumHQ/selenium/blob/master/rb/lib/selenium/webdriver/firefox/profile.rb
34
+ #
35
+ # However having checked how they have written their tests for this class
36
+ # (https://github.com/SeleniumHQ/selenium/blob/master/rb/spec/integration/selenium/webdriver/firefox/profile_spec.rb)
37
+ # we were able to find Selenium::WebDriver::Firefox::Profile has a method
38
+ # called +layout_on_disk+ which writes the profile to files. The Selenium team
39
+ # use a helper method in their specs which writes the profile to disk and then
40
+ # reads `user.js` to a string. It then tests the values in the string.
41
+ #
42
+ # This helper method is a tweeked version of theirs to allow us to do the same
43
+ # thing.
44
+ def read_profile_preferences(profile)
45
+ dir = profile.layout_on_disk
46
+ File.read(File.join(dir, "user.js"))
47
+ end
48
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "simplecov"
4
+
5
+ # We start it with the rails param to ensure it includes coverage for all code
6
+ # started by the rails app, and not just the files touched by our unit tests.
7
+ # This gives us the most accurate assessment of our unit test coverage
8
+ # https://github.com/colszowka/simplecov#getting-started
9
+ SimpleCov.start("rails") do
10
+ # We filter the spec folder, mainly to ensure that any dummy apps don't get
11
+ # included in the coverage report. However our intent is that nothing in the
12
+ # spec folder should be included
13
+ add_filter "/spec/"
14
+ # We filter the lib/features/support folder because the only way we can test
15
+ # the code in there is to actually run Cucumber with a feature, something
16
+ # we're currently trying to avoid in our tests.
17
+ add_filter "/lib/features/support/"
18
+ # The version file is simply just that, so we do not feel the need to ensure
19
+ # we have a test for it
20
+ add_filter "lib/quke/version"
21
+
22
+ # You can make Simplecov ignore sections of code by wrapping them in # :nocov:
23
+ # tags. However without knowledge of this `nocov` doesn't mean a lot so here
24
+ # we take advantage of a feature that allows us to use a custom token to do
25
+ # the same thing `nocov` does. Now in our code any sections we want to exclude
26
+ # from test coverage stats we wrap in # :simplecov_ignore: tokens.
27
+ # https://github.com/colszowka/simplecov#ignoringskipping-code
28
+ nocov_token "simplecov_ignore"
29
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "webmock/rspec"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quke
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
- - Alan Cruikshanks
7
+ - Defra
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-08 00:00:00.000000000 Z
11
+ date: 2019-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -16,98 +16,112 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.4'
19
+ version: '3.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.4'
26
+ version: '3.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: capybara
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.9'
33
+ version: '3.14'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.9'
40
+ version: '3.14'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec-expectations
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.4'
47
+ version: '3.8'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.4'
54
+ version: '3.8'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: poltergeist
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.10'
61
+ version: '1.18'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.10'
68
+ version: '1.18'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: selenium-webdriver
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '2.53'
75
+ version: '3.14'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '2.53'
82
+ version: '3.14'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: chromedriver-helper
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '1.0'
89
+ version: '2.1'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.1'
97
+ - !ruby/object:Gem::Dependency
98
+ name: geckodriver-helper
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.23'
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: '1.0'
110
+ version: '0.23'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: site_prism
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: '2.9'
117
+ version: '3.0'
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: '2.9'
124
+ version: '3.0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: launchy
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -137,103 +151,117 @@ dependencies:
137
151
  - !ruby/object:Gem::Version
138
152
  version: '0'
139
153
  - !ruby/object:Gem::Dependency
140
- name: bundler
154
+ name: byebug
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
- - - "~>"
157
+ - - ">="
144
158
  - !ruby/object:Gem::Version
145
- version: '1.12'
159
+ version: '0'
146
160
  type: :development
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
- - - "~>"
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: defra_ruby_style
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
151
179
  - !ruby/object:Gem::Version
152
- version: '1.12'
180
+ version: '0'
153
181
  - !ruby/object:Gem::Dependency
154
182
  name: github_changelog_generator
155
183
  requirement: !ruby/object:Gem::Requirement
156
184
  requirements:
157
- - - "~>"
185
+ - - ">="
158
186
  - !ruby/object:Gem::Version
159
- version: '1.13'
187
+ version: '0'
160
188
  type: :development
161
189
  prerelease: false
162
190
  version_requirements: !ruby/object:Gem::Requirement
163
191
  requirements:
164
- - - "~>"
192
+ - - ">="
165
193
  - !ruby/object:Gem::Version
166
- version: '1.13'
194
+ version: '0'
167
195
  - !ruby/object:Gem::Dependency
168
196
  name: rake
169
197
  requirement: !ruby/object:Gem::Requirement
170
198
  requirements:
171
- - - "~>"
199
+ - - ">="
172
200
  - !ruby/object:Gem::Version
173
- version: '10.5'
201
+ version: '0'
174
202
  type: :development
175
203
  prerelease: false
176
204
  version_requirements: !ruby/object:Gem::Requirement
177
205
  requirements:
178
- - - "~>"
206
+ - - ">="
179
207
  - !ruby/object:Gem::Version
180
- version: '10.5'
208
+ version: '0'
181
209
  - !ruby/object:Gem::Dependency
182
210
  name: rdoc
183
211
  requirement: !ruby/object:Gem::Requirement
184
212
  requirements:
185
- - - "~>"
213
+ - - ">="
186
214
  - !ruby/object:Gem::Version
187
- version: '4.2'
215
+ version: '0'
188
216
  type: :development
189
217
  prerelease: false
190
218
  version_requirements: !ruby/object:Gem::Requirement
191
219
  requirements:
192
- - - "~>"
220
+ - - ">="
193
221
  - !ruby/object:Gem::Version
194
- version: '4.2'
222
+ version: '0'
195
223
  - !ruby/object:Gem::Dependency
196
224
  name: rspec
197
225
  requirement: !ruby/object:Gem::Requirement
198
226
  requirements:
199
227
  - - "~>"
200
228
  - !ruby/object:Gem::Version
201
- version: '3.5'
229
+ version: '3.8'
202
230
  type: :development
203
231
  prerelease: false
204
232
  version_requirements: !ruby/object:Gem::Requirement
205
233
  requirements:
206
234
  - - "~>"
207
235
  - !ruby/object:Gem::Version
208
- version: '3.5'
236
+ version: '3.8'
209
237
  - !ruby/object:Gem::Dependency
210
238
  name: simplecov
211
239
  requirement: !ruby/object:Gem::Requirement
212
240
  requirements:
213
- - - "~>"
241
+ - - ">="
214
242
  - !ruby/object:Gem::Version
215
- version: '0.13'
243
+ version: '0'
216
244
  type: :development
217
245
  prerelease: false
218
246
  version_requirements: !ruby/object:Gem::Requirement
219
247
  requirements:
220
- - - "~>"
248
+ - - ">="
221
249
  - !ruby/object:Gem::Version
222
- version: '0.13'
250
+ version: '0'
223
251
  - !ruby/object:Gem::Dependency
224
252
  name: webmock
225
253
  requirement: !ruby/object:Gem::Requirement
226
254
  requirements:
227
255
  - - "~>"
228
256
  - !ruby/object:Gem::Version
229
- version: '3.1'
257
+ version: '3.5'
230
258
  type: :development
231
259
  prerelease: false
232
260
  version_requirements: !ruby/object:Gem::Requirement
233
261
  requirements:
234
262
  - - "~>"
235
263
  - !ruby/object:Gem::Version
236
- version: '3.1'
264
+ version: '3.5'
237
265
  description: Quke tries to simplify the process of writing and running acceptance
238
266
  tests by setting up Cucumber for you. It handles the config to allow you to run
239
267
  your tests in Firefox and Chrome, or the headless browser PhantomJS. It also has
@@ -246,15 +274,6 @@ executables:
246
274
  extensions: []
247
275
  extra_rdoc_files: []
248
276
  files:
249
- - ".browserstack.yml"
250
- - ".codeclimate.yml"
251
- - ".config.example.yml"
252
- - ".gitignore"
253
- - ".rspec"
254
- - ".rubocop.yml"
255
- - ".travis.yml"
256
- - CHANGELOG.md
257
- - Gemfile
258
277
  - LICENSE
259
278
  - README.md
260
279
  - Rakefile
@@ -273,13 +292,22 @@ files:
273
292
  - lib/quke/driver_configuration.rb
274
293
  - lib/quke/driver_registration.rb
275
294
  - lib/quke/version.rb
276
- - quke.gemspec
277
- - quke.png
295
+ - spec/quke/browserstack_configuration_spec.rb
296
+ - spec/quke/browserstack_status_reporter_spec.rb
297
+ - spec/quke/configuration_spec.rb
298
+ - spec/quke/cuke_runner_spec.rb
299
+ - spec/quke/driver_configuration_spec.rb
300
+ - spec/quke/driver_registration_spec.rb
301
+ - spec/quke/quke_spec.rb
302
+ - spec/spec_helper.rb
303
+ - spec/support/helpers.rb
304
+ - spec/support/simplecov.rb
305
+ - spec/support/webmock.rb
278
306
  homepage: https://github.com/DEFRA/quke
279
307
  licenses:
280
- - Nonstandard
308
+ - The Open Government Licence (OGL) Version 3
281
309
  metadata:
282
- allowed_push_host: https://rubygems.org/
310
+ allowed_push_host: https://rubygems.org
283
311
  post_install_message:
284
312
  rdoc_options: []
285
313
  require_paths:
@@ -288,7 +316,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
288
316
  requirements:
289
317
  - - ">="
290
318
  - !ruby/object:Gem::Version
291
- version: '1.9'
319
+ version: '2.4'
292
320
  required_rubygems_version: !ruby/object:Gem::Requirement
293
321
  requirements:
294
322
  - - ">="
@@ -296,8 +324,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
296
324
  version: '0'
297
325
  requirements: []
298
326
  rubyforge_project:
299
- rubygems_version: 2.7.3
327
+ rubygems_version: 2.6.14
300
328
  signing_key:
301
329
  specification_version: 4
302
330
  summary: A gem to simplify creating acceptance tests using Cucumber
303
- test_files: []
331
+ test_files:
332
+ - spec/quke/browserstack_configuration_spec.rb
333
+ - spec/quke/quke_spec.rb
334
+ - spec/quke/browserstack_status_reporter_spec.rb
335
+ - spec/quke/driver_registration_spec.rb
336
+ - spec/quke/driver_configuration_spec.rb
337
+ - spec/quke/cuke_runner_spec.rb
338
+ - spec/quke/configuration_spec.rb
339
+ - spec/spec_helper.rb
340
+ - spec/support/simplecov.rb
341
+ - spec/support/helpers.rb
342
+ - spec/support/webmock.rb