generic_test 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae34d605d9250ca864a45a7cdd5223f20f0b263c16a4370e0e6937ad6a556e44
4
- data.tar.gz: f1029f23cca8a43d97ce0009c76e2d84e52d98503df721b3cf4ba32e66dae2a8
3
+ metadata.gz: a26e58a5231c7f1444638e6dc4219c013ae3108515bc4c59d1d8effb2d158716
4
+ data.tar.gz: 179bbb4eb223b5b968a65df26e0a1a06a3637014adf11fa34a3737f72b15d611
5
5
  SHA512:
6
- metadata.gz: 1911d364dd5eeb59fcdb07a42e5907a2b2a27bbbdd7e08edd922de589cfdb3c94c6c1abe822bbfd0a41f94af379bd6dd57ba74572f815479f808864f8eeac78d
7
- data.tar.gz: f200908096e6318cbebc90851edbf837dd1554ecf70a37ecf5281faab595bb5bdee6335ef54f8201631954770de228dfc7aef3e4e0e15c2526ae5ac70cd852b6
6
+ metadata.gz: 441b369d19b0121e8c3b60e416e9e502f501ffa2fb24b55dc3bd43138508ec25a035da396d40cd30039a619ad1d6a04bb6b5db28ff3228d2662cbc083ce62802
7
+ data.tar.gz: 6ad1cd8861cfeb69266aba9b433bcbe8d92aecc5dcc754fdd0da19586db4de71adb47a961a7dfe1640c797718789ae4b52b8a05fe38bb825127ec124801a8358
data/.rspec CHANGED
@@ -1,3 +1,4 @@
1
1
  --format documentation
2
2
  --color
3
3
  --require spec_helper
4
+ --format RspecJunitFormatter --out logs/rspec_page_<%= ENV['PAGE_NUM'] %>.xml
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ Version 0.1.3
2
+ * Enhancement
3
+ * Run gem outside of gem context
4
+
1
5
  Version 0.1.2
2
6
  * Bug fix
3
7
  * Include dev dependencies within gem
data/exe/generic_test CHANGED
@@ -10,7 +10,14 @@ class Exe < Thor
10
10
  desc 'page page_url', 'Test web page'
11
11
  def page(page_url)
12
12
  ENV['PAGE_URL'] = page_url
13
- system "cd #{File.join(File.dirname(__FILE__), '..')} && rspec spec/generic_test_spec.rb"
13
+ puts File.join(File.dirname(__FILE__))
14
+ test_file_path = File.join(Dir.pwd, File.dirname(__FILE__), '..', 'spec', 'generic_test_spec.rb')
15
+ puts 'no file' unless File.exist? test_file_path
16
+ command = "rspec #{test_file_path} --format documentation --require generic_test/setup"
17
+ puts command
18
+ #require_relative '../lib/generic_test/setup'
19
+ system command # "rspec #{test_file_path} --format documentation --require generic_test"
20
+ #puts `rspec #{test_file_path} --format documentation --require generic_test`
14
21
  end
15
22
  end
16
23
 
data/generic_test.gemspec CHANGED
@@ -26,10 +26,12 @@ Gem::Specification.new do |spec|
26
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
27
  spec.require_paths = ['lib']
28
28
  # Development dependencies are installed too since running external tests within gem
29
- spec.add_dependency 'jekyll' # For hosting test website
29
+ spec.add_development_dependency 'jekyll' # For hosting test website
30
30
  spec.add_dependency 'rake'
31
- spec.add_dependency 'rspec'
32
31
 
32
+ spec.add_dependency 'rspec'
33
+ spec.add_dependency 'rspec_html_reporter' # Pretty HTML reports
34
+ spec.add_dependency 'rspec_junit_formatter' # Needed for nicer reporting of rspec for use in Gitlab
33
35
  spec.add_dependency 'spellcheck'
34
36
  spec.add_dependency 'thor' # Command line utility
35
37
  spec.add_dependency 'watir' # UI interaction
data/lib/generic_test.rb CHANGED
@@ -14,5 +14,20 @@ module GenericTest
14
14
  class << self
15
15
  attr_accessor :browser
16
16
  attr_accessor :pages
17
+
18
+ def setup
19
+ ENV['HEADLESS'] ||= 'true'
20
+ ENV['PAGE_NUM'] ||= '1'
21
+ browser_args = %w[--disable-popup-blocking --no-sandbox --disable-dev-shm-usage]
22
+ browser_args << '--headless' if ENV['HEADLESS'] == 'true'
23
+
24
+ GenericTest.browser = Watir::Browser.new :chrome, args: browser_args
25
+
26
+ raise 'PAGE_URL environment variable not set' unless ENV['PAGE_URL']
27
+
28
+ browser = GenericTest.browser
29
+ browser.goto ENV['PAGE_URL']
30
+ GenericTest.pages << GenericTest::Page.new(browser)
31
+ end
17
32
  end
18
33
  end
@@ -0,0 +1,4 @@
1
+ # One file to require gem and set things up
2
+ require 'generic_test'
3
+
4
+ GenericTest.setup
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GenericTest
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
@@ -2,11 +2,12 @@
2
2
 
3
3
  GenericTest.pages.each do |page|
4
4
  links = page.links
5
- RSpec.describe "Checking broken links at #{page.url}" do
5
+ RSpec.describe 'Links respond' do
6
+ puts "Found #{links} links"
6
7
  links.each_with_index do |link, index|
7
8
  next unless link.href && !link.href.empty?
8
9
 
9
- it "Link (#{index}) #{link.text} to '#{link.href}' responds" do
10
+ it "Link (#{index + 1}) \"#{link.text}\" to '#{link.href}' responds" do
10
11
  expect(Checker.link_status(link.href)).to be_between 200, 399
11
12
  end
12
13
  end
data/spec/spec_helper.rb CHANGED
@@ -1,17 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'bundler/setup'
4
- require 'generic_test'
4
+ require 'generic_test/setup'
5
5
 
6
- ENV['HEADLESS'] ||= 'true'
7
- browser_args = %w[--disable-popup-blocking --no-sandbox --disable-dev-shm-usage]
8
- browser_args << '--headless' if ENV['HEADLESS'] == 'true'
9
-
10
- GenericTest.browser = Watir::Browser.new :chrome, args: browser_args
11
-
12
- browser = GenericTest.browser
13
- browser.goto ENV['PAGE_URL']
14
- GenericTest.pages << GenericTest::Page.new(browser)
6
+ #GenericTest.setup
15
7
 
16
8
  RSpec.configure do |config|
17
9
  # Close test server after all RSpec tests have run
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: generic_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Garratt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-14 00:00:00.000000000 Z
11
+ date: 2020-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -17,7 +17,7 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
- type: :runtime
20
+ type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
@@ -52,6 +52,34 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec_html_reporter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec_junit_formatter
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: spellcheck
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -134,6 +162,7 @@ files:
134
162
  - lib/generic_test.rb
135
163
  - lib/generic_test/checker.rb
136
164
  - lib/generic_test/page.rb
165
+ - lib/generic_test/setup.rb
137
166
  - lib/generic_test/version.rb
138
167
  - spec/generic_test_spec.rb
139
168
  - spec/spec_helper.rb