watir-rspec 3.0.0 → 5.0.0

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
- SHA1:
3
- metadata.gz: 79391a6ea4c2729fa6b41d3c7cef576a5c3727aa
4
- data.tar.gz: 81760cabffa847b04dcf5bf86349bac2598e6649
2
+ SHA256:
3
+ metadata.gz: 075674ef554cab10ca8fc130f8ec96b389d6b035b23a35393c1b4097c81295b5
4
+ data.tar.gz: 2cbbe9711a15d4f6d4bfe5bfb53c695be1fad1c3033d38391dfedc590d64ace9
5
5
  SHA512:
6
- metadata.gz: 210322d1cbbd2a1f2b3b00d7efe2096440521b6f98b87fb344bd5d4541aabebf5ab77c9a94a1cf1385bb532f438d88d5126d9c7873157a93f54f4f7980aa984f
7
- data.tar.gz: 1d7f029dfe8c93997b9feda0258ef88acd6b651d96ee29c7a454013bd9b289667f2ed913e6eb15c8b4acae0f543856c935634989bdc6596ff95b8877af2a6593
6
+ metadata.gz: 2727b90b605d9a59f5b4410b2ac0c2bf0060296ba32db50181e354b481bd76c0881d5153562385b8f142f8edf67571e43b21311049545cdbb85c91e085ae16f4
7
+ data.tar.gz: 21913c5591868965b04321c5d16fc9630c033d1b3957ec242942bdd32b1bab65477ff8cd57c58947c10edc3b7b2ad73fe71e4fbe8b8708c836a3d06ae7679f7b
data/.gitignore CHANGED
File without changes
data/.travis.yml CHANGED
File without changes
data/.yardopts CHANGED
File without changes
data/CHANGES.md CHANGED
@@ -1,3 +1,14 @@
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
+
1
12
  ### 3.0.0 - 2016/09/24
2
13
 
3
14
  * Add support for Watir 6.0.
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 = "3.0.0"
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", ">= 6.0.0.beta4"
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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watir-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
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: 2016-09-24 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
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 6.0.0.beta4
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: 6.0.0.beta4
40
+ version: 7.2.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: yard
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -131,8 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
133
  requirements: []
134
- rubyforge_project:
135
- rubygems_version: 2.6.4
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: