watirsplash 2.3.2 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- watirsplash (2.3.1)
4
+ watirsplash (2.3.2)
5
5
  bundler (~> 1.0)
6
6
  rake (= 0.8.7)
7
7
  require_all
@@ -22,8 +22,7 @@ GEM
22
22
  commonwatir (>= 1.9.2)
23
23
  hoe (2.12.3)
24
24
  rake (~> 0.8)
25
- json_pure (1.5.4)
26
- spruz (~> 0.2.8)
25
+ json_pure (1.6.1)
27
26
  mini_magick (3.2.1)
28
27
  subexec (~> 0.0.4)
29
28
  nokogiri (1.5.0-x86-mingw32)
@@ -41,7 +40,7 @@ GEM
41
40
  rubyzip (0.9.4)
42
41
  s4t-utils (1.0.4)
43
42
  hoe (>= 1.3.0)
44
- selenium-webdriver (2.5.0)
43
+ selenium-webdriver (2.7.0)
45
44
  childprocess (>= 0.2.1)
46
45
  ffi (>= 1.0.7)
47
46
  json_pure
@@ -50,7 +49,6 @@ GEM
50
49
  win32-process
51
50
  spork-local_process (0.0.1)
52
51
  spork (~> 0.9.0.rc9)
53
- spruz (0.2.13)
54
52
  subexec (0.0.4)
55
53
  syntax (1.0.0)
56
54
  thor (0.14.6)
@@ -65,7 +63,7 @@ GEM
65
63
  rautomation (~> 0.6.3)
66
64
  win32-process (>= 0.5.5)
67
65
  windows-pr (>= 0.6.6)
68
- watir-webdriver (0.3.3)
66
+ watir-webdriver (0.3.4)
69
67
  selenium-webdriver (>= 0.2.2)
70
68
  win32-api (1.4.8-x86-mingw32)
71
69
  win32-process (0.6.5)
@@ -90,6 +88,6 @@ DEPENDENCIES
90
88
  spork (~> 0.9.0.rc9)
91
89
  spork-local_process
92
90
  watir (= 2.0.2)
93
- watir-webdriver (~> 0.3.3)
91
+ watir-webdriver (~> 0.3.4)
94
92
  watirsplash!
95
93
  win32screenshot (~> 1.0.5)
data/History.rdoc CHANGED
@@ -1,3 +1,9 @@
1
+ === Version 2.4.0 / 2011-09-25
2
+
3
+ * add WatirSplash::Browser.exist? method
4
+ * redirect all method invocations on WatirSplash::Browser.current when method doesn't exist in WatirSplash::Browser class itself
5
+
6
+
1
7
  === Version 2.3.2 / 2011-09-25
2
8
 
3
9
  * add support for spork-local_process
@@ -10,7 +10,7 @@ module WatirSplash
10
10
  browser.execute_script "window.__browserErrorMessage = undefined"
11
11
  raise JavaScriptError, "JavaScript error: #{error_message}"
12
12
  end
13
-
13
+
14
14
  browser.execute_script %q[
15
15
  if (!window.onErrorFn) {
16
16
  window.onErrorFn = function(errorMsg, url, lineNumber) {
@@ -26,7 +26,7 @@ module WatirSplash
26
26
  window.onerror = window.onErrorFn;
27
27
  }]
28
28
  end
29
-
29
+
30
30
  class << self
31
31
 
32
32
  attr_accessor :current
@@ -35,6 +35,12 @@ module WatirSplash
35
35
  prepare Watir::Browser.new
36
36
  end
37
37
 
38
+ def exist?
39
+ current && current.exists?
40
+ end
41
+
42
+ alias_method :exists?, :exist?
43
+
38
44
  private
39
45
 
40
46
  def prepare browser
@@ -43,6 +49,19 @@ module WatirSplash
43
49
  browser
44
50
  end
45
51
 
52
+ def method_missing name, *args
53
+ if current.respond_to?(name)
54
+ instance_eval %Q[
55
+ def #{name}(*args)
56
+ current.send(:#{name}, *args) {yield}
57
+ end
58
+ ]
59
+ send(name, *args) {yield}
60
+ else
61
+ super
62
+ end
63
+ end
64
+
46
65
  end
47
66
  end
48
67
  end
@@ -32,12 +32,12 @@ module WatirSplash
32
32
 
33
33
  def example_started(example) # :nodoc:
34
34
  @files_saved_during_example.clear
35
- example.metadata[:description] += "#{example.metadata[:location].scan(/:\d+$/)} (#{Time.now.strftime("%H:%M:%S")})"
35
+ example.metadata[:description] += "#{example.metadata[:location].scan(/:\d+$/).flatten.first} (#{Time.now.strftime("%H:%M:%S")})"
36
36
  super
37
37
  end
38
38
 
39
39
  def extra_failure_content(exception) # :nodoc:
40
- if WatirSplash::Browser.current && WatirSplash::Browser.current.exists?
40
+ if WatirSplash::Browser.exists?
41
41
  save_screenshot
42
42
  save_html
43
43
  end
@@ -16,8 +16,7 @@ module WatirSplash
16
16
  if browser
17
17
  @browser = browser
18
18
  else
19
- reuse_current = WatirSplash::Browser.current && WatirSplash::Browser.current.exists?
20
- @browser = reuse_current ? WatirSplash::Browser.current : (WatirSplash::Browser.current = WatirSplash::Browser.new)
19
+ @browser = WatirSplash::Browser.exists? ? WatirSplash::Browser.current : (WatirSplash::Browser.current = WatirSplash::Browser.new)
21
20
  @browser.goto @@url
22
21
  end
23
22
  end
@@ -1,6 +1,6 @@
1
1
  module WatirSplash
2
2
  module Version
3
- WATIRSPLASH = "2.3.2"
3
+ WATIRSPLASH = "2.4.0"
4
4
 
5
5
  # possible runtime dependencies
6
6
  WATIR = "2.0.2"
data/spec/browser_spec.rb CHANGED
@@ -31,6 +31,28 @@ describe WatirSplash::Browser do
31
31
  }.not_to raise_error
32
32
  end
33
33
 
34
+ it ".exist? && .exists?" do
35
+ WatirSplash::Browser.current = nil
36
+ WatirSplash::Browser.should_not exist
37
+
38
+ WatirSplash::Browser.new
39
+ WatirSplash::Browser.should exist
40
+
41
+ WatirSplash::Browser.close
42
+ WatirSplash::Browser.should_not exist
43
+
44
+ WatirSplash::Browser.should respond_to(:exists?)
45
+ end
46
+
47
+ it "redirects missing method calls to browser object" do
48
+ b = WatirSplash::Browser.new
49
+ WatirSplash::Browser.should_not respond_to(:goto)
50
+ expect {
51
+ WatirSplash::Browser.goto "google.com"
52
+ }.to_not raise_exception
53
+ b.title.should =~ /google/i
54
+ end
55
+
34
56
  after :each do
35
57
  WatirSplash::Browser.current.close
36
58
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watirsplash
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
- - 3
9
- - 2
10
- version: 2.3.2
8
+ - 4
9
+ - 0
10
+ version: 2.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jarmo Pertman
@@ -173,7 +173,7 @@ rubyforge_project:
173
173
  rubygems_version: 1.8.4
174
174
  signing_key:
175
175
  specification_version: 3
176
- summary: watirsplash 2.3.2
176
+ summary: watirsplash 2.4.0
177
177
  test_files:
178
178
  - spec/browser_spec.rb
179
179
  - spec/page_spec.rb