watir-rspec 2.0.3 → 5.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 17aea3a055c86e44d544fc3afca4290e951b60fe
4
- data.tar.gz: 78034a62b03accd0bed96ed385f8f36757c3536e
2
+ SHA256:
3
+ metadata.gz: 075674ef554cab10ca8fc130f8ec96b389d6b035b23a35393c1b4097c81295b5
4
+ data.tar.gz: 2cbbe9711a15d4f6d4bfe5bfb53c695be1fad1c3033d38391dfedc590d64ace9
5
5
  SHA512:
6
- metadata.gz: 5dfa485af98c2e3302ba14a1ebff06fd52d92513dbffb82ac8f092e44cfaaa5f19161e10ee2c760ab67d54b562ceebbbe514c4a7e0cfb6ac307f4fb7ac288730
7
- data.tar.gz: 47d2bedea996603336f9693ad7fbde25f17c8867314c8414238851570edfedb3edc2c39da373843367ae38501313af7353c409bace69ad47be27270bfd476a7b
6
+ metadata.gz: 2727b90b605d9a59f5b4410b2ac0c2bf0060296ba32db50181e354b481bd76c0881d5153562385b8f142f8edf67571e43b21311049545cdbb85c91e085ae16f4
7
+ data.tar.gz: 21913c5591868965b04321c5d16fc9630c033d1b3957ec242942bdd32b1bab65477ff8cd57c58947c10edc3b7b2ad73fe71e4fbe8b8708c836a3d06ae7679f7b
data/.gitignore CHANGED
File without changes
data/.travis.yml CHANGED
@@ -1,7 +1,6 @@
1
1
  rvm:
2
- - 2.2.1
3
- - 2.1.5
4
- - 2.0.0
2
+ - 2.3.1
3
+ - 2.2.5
5
4
  - ruby-head
6
5
  notifications:
7
6
  recipients:
data/.yardopts CHANGED
File without changes
data/CHANGES.md CHANGED
@@ -1,3 +1,18 @@
1
+ ### 5.0.0 - 2023/04/07
2
+
3
+ * Fix a problem of deleting everything from current working directory when using Ruby >= 3.2.2. Closes #18.
4
+
5
+ ### 4.0.0 - 2023/03/14
6
+
7
+ !!! yanked due to possible data loss when using Ruby 3.2.2 !!!
8
+
9
+ * Add support for Ruby 3.x version.
10
+ * Update Watir dependency to 7.x version.
11
+
12
+ ### 3.0.0 - 2016/09/24
13
+
14
+ * Add support for Watir 6.0.
15
+
1
16
  ### 2.0.3 - 2015/05/09
2
17
 
3
18
  * Improve readme/documentation.
data/Gemfile CHANGED
File without changes
data/LICENSE CHANGED
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
@@ -1,10 +1,9 @@
1
- require "bundler/gem_tasks"
2
-
3
1
  require "rspec/core/rake_task"
4
2
  RSpec::Core::RakeTask.new(:spec)
5
3
 
6
4
  task :default => :spec
7
5
  task :release => :spec
6
+ require "bundler/gem_tasks"
8
7
 
9
8
  require "yard"
10
9
  YARD::Rake::YardocTask.new
File without changes
@@ -120,8 +120,8 @@ Make sure you run the watir-rspec command within your projects' directory.]
120
120
  return @options[:rails] if @options.has_key? :rails
121
121
 
122
122
  @using_rails ||= begin
123
- File.exists?("Gemfile.lock") && File.read("Gemfile.lock") =~ /rspec-rails/ ||
124
- File.exists?("Gemfile") && File.read("Gemfile") =~ /rspec-rails/
123
+ File.exist?("Gemfile.lock") && File.read("Gemfile.lock") =~ /rspec-rails/ ||
124
+ File.exist?("Gemfile") && File.read("Gemfile") =~ /rspec-rails/
125
125
  end
126
126
  end
127
127
  end
@@ -17,20 +17,20 @@ module Watir
17
17
  # # notice that we're calling Watir::Browser#text_field here directly
18
18
  # expect(text_field(id: "foo")).to be_present
19
19
  # end
20
- def method_missing(name, *args)
20
+ def method_missing(name, *args, &block)
21
21
  if browser.respond_to?(name)
22
22
  Helper.module_eval %Q[
23
- def #{name}(*args)
24
- if block_given?
25
- browser.send(:#{name}, *args, &Proc.new)
23
+ def #{name}(*args, &block)
24
+ if block
25
+ browser.send(:#{name}, *args, &block)
26
26
  else
27
27
  browser.send(:#{name}, *args)
28
28
  end
29
29
  end
30
30
  ]
31
31
 
32
- if block_given?
33
- self.send(name, *args, &Proc.new)
32
+ if block
33
+ self.send(name, *args, &block)
34
34
  else
35
35
  self.send(name, *args)
36
36
  end
@@ -10,16 +10,17 @@ module Watir
10
10
  # * saves html of the browser upon test failure
11
11
  # * saves all files generated/downloaded during the test and shows them in the report
12
12
  class HtmlFormatter < ::RSpec::Core::Formatters::HtmlFormatter
13
-
14
13
  ::RSpec::Core::Formatters.register self, *(::RSpec::Core::Formatters::Loader.formatters[::RSpec::Core::Formatters::HtmlFormatter])
15
14
 
15
+ DEFAULT_REPORT_PATH = File.expand_path("tmp/spec-results/index.html")
16
+
16
17
  # @private
17
18
  def initialize(output)
18
- @output_path = File.expand_path(ENV["WATIR_RESULTS_PATH"] || (output.respond_to?(:path) ? output.path : "tmp/spec-results/index.html"))
19
- FileUtils.rm_rf File.dirname(@output_path), :verbose => true if File.exists?(@output_path)
19
+ @output_path = File.expand_path(ENV["WATIR_RESULTS_PATH"] || output.kind_of?(File) && output.path || DEFAULT_REPORT_PATH)
20
+ cleanup_report_path(@output_path)
20
21
 
21
- @output_relative_path = Pathname.new(@output_path).relative_path_from(Pathname.new(Dir.pwd))
22
- puts "Results will be saved to #{@output_relative_path}"
22
+ output_relative_path = Pathname.new(@output_path).relative_path_from(Pathname.new(Dir.pwd))
23
+ log "results will be saved to #{output_relative_path}"
23
24
 
24
25
  @files_dir = File.dirname(@output_path)
25
26
  FileUtils.mkdir_p(@files_dir)
@@ -57,7 +58,19 @@ module Watir
57
58
 
58
59
  private
59
60
 
60
- # @private
61
+ def cleanup_report_path(path)
62
+ if File.exist?(path)
63
+ reports_directory = File.dirname(path)
64
+
65
+ if path == DEFAULT_REPORT_PATH
66
+ log "cleaning up reports path at #{reports_directory}..."
67
+ FileUtils.rm_rf reports_directory
68
+ else
69
+ $stderr.puts "[WARN] #{self.class.name} reports directory automatically not deleted at #{reports_directory} to avoid possible data loss - make sure to do that manually before running specs to avoid this message and clutter from previous runs"
70
+ end
71
+ end
72
+ end
73
+
61
74
  def extra_failure_content(exception)
62
75
  return super unless example_group # apparently there are cases where rspec failures are encountered and the example_group is not set (i.e. nil)
63
76
  browser = example_group.before_context_ivars[:@browser] || $browser
@@ -74,7 +87,7 @@ module Watir
74
87
  end
75
88
 
76
89
  def link_for(file)
77
- return unless File.exists?(file[:path])
90
+ return unless File.exist?(file[:path])
78
91
 
79
92
  description = file[:desc] ? file[:desc] : File.extname(file[:path]).upcase[1..-1]
80
93
  path = Pathname.new(file[:path])
@@ -98,6 +111,10 @@ module Watir
98
111
  file_name
99
112
  end
100
113
 
114
+ def log(message)
115
+ puts "[#{self.class.name}] #{message}"
116
+ end
117
+
101
118
  end
102
119
  end
103
120
  end
File without changes
File without changes
@@ -1,5 +1,5 @@
1
1
  module Watir
2
2
  class RSpec
3
- VERSION = "2.0.3"
3
+ VERSION = "5.0.0"
4
4
  end
5
5
  end
data/lib/watir/rspec.rb CHANGED
File without changes
data/spec/spec_helper.rb CHANGED
File without changes
@@ -5,7 +5,7 @@ end
5
5
 
6
6
  describe TestModel do
7
7
  context ".connection" do
8
- before { described_class.class_variable_set :@@shared_connection, nil }
8
+ before { ActiveRecord::Base.class_variable_set :@@shared_connection, nil }
9
9
 
10
10
  it "reuses the connection" do
11
11
  expect(described_class).to receive(:retrieve_connection).once.and_return(:established_connection)
@@ -25,14 +25,14 @@ describe Watir::RSpec::Helper do
25
25
  before { @browser = double("browser") }
26
26
 
27
27
  it "are delegated to browser" do
28
- expect(@browser).to receive(:window).with(title: "my_window") { |&block| block.call }
28
+ expect(@browser).to receive(:window).with({title: "my_window"}) { |&block| block.call }
29
29
 
30
30
  block_parameter = lambda { "my block content" }
31
31
  expect(window(title: "my_window", &block_parameter)).to be == "my block content"
32
32
  end
33
33
 
34
34
  it "having parameters are properly delegated to browser" do
35
- expect(@browser).to receive(:window).with(:title => "my_window").and_yield("first", "second")
35
+ expect(@browser).to receive(:window).with({title: "my_window"}).and_yield("first", "second")
36
36
 
37
37
  block_parameter = lambda { |parameter_1, parameter_2| [parameter_1, parameter_2] }
38
38
  expect(window(title: "my_window", &block_parameter)).to be == ["first", "second"]
File without changes
File without changes
File without changes
data/watir-rspec.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
17
17
  gem.license = "MIT"
18
18
 
19
19
  gem.add_dependency "rspec", "~>3.0"
20
- gem.add_dependency "watir", "~>5.0"
20
+ gem.add_dependency "watir", ">= 7.2.2"
21
21
 
22
22
  gem.add_development_dependency "yard"
23
23
  gem.add_development_dependency "rake"
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watir-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarmo Pertman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-09 00:00:00.000000000 Z
11
+ date: 2023-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.0'
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
26
  version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: watir
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '5.0'
33
+ version: 7.2.2
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: '5.0'
40
+ version: 7.2.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: yard
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: redcarpet
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: Use Watir with RSpec with ease.
@@ -88,9 +88,9 @@ executables:
88
88
  extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
- - .gitignore
92
- - .travis.yml
93
- - .yardopts
91
+ - ".gitignore"
92
+ - ".travis.yml"
93
+ - ".yardopts"
94
94
  - CHANGES.md
95
95
  - Gemfile
96
96
  - LICENSE
@@ -122,17 +122,16 @@ require_paths:
122
122
  - lib
123
123
  required_ruby_version: !ruby/object:Gem::Requirement
124
124
  requirements:
125
- - - '>='
125
+ - - ">="
126
126
  - !ruby/object:Gem::Version
127
127
  version: '0'
128
128
  required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - '>='
130
+ - - ">="
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
133
  requirements: []
134
- rubyforge_project:
135
- rubygems_version: 2.4.6
134
+ rubygems_version: 3.4.10
136
135
  signing_key:
137
136
  specification_version: 4
138
137
  summary: Use Watir with RSpec with ease.
@@ -143,4 +142,3 @@ test_files:
143
142
  - spec/watir/rspec/matchers/base_matcher_spec.rb
144
143
  - spec/watir/rspec/matchers_spec.rb
145
144
  - spec/watir/rspec_spec.rb
146
- has_rdoc: