watir-rails 1.0.3 → 1.0.4
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 +4 -4
- data/.travis.yml +5 -1
- data/CHANGES.md +4 -0
- data/README.md +0 -5
- data/gemfiles/Gemfile.rails-2.x +6 -0
- data/gemfiles/Gemfile.rails-3.x +6 -0
- data/lib/watir/rails.rb +157 -157
- data/lib/watir/version.rb +1 -1
- data/spec/watir/rails_spec.rb +132 -127
- metadata +24 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b32693f90099aad27d5da3471f0d8d01bd6b3172
|
4
|
+
data.tar.gz: 6a5844920d2d62a7ff57fda7717ef75ef3cd0367
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2892944f90aba0a3ca2f49d094d8cbc5bc6bf666a0be9ac61ed4d47af611ae197cf17bad082ffad37f0e1a9bc6faa940dd902c508c451825a6d1c00faf7f31f
|
7
|
+
data.tar.gz: 96b4b68e46419b5d3226e0e67ce85c257793600536f2f995dc4e9c3bd4c474fa554608389ea4540b35543c7e274ce6214de4267d72a7a5a285e4f37fa2ea4158
|
data/.travis.yml
CHANGED
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -42,11 +42,6 @@ Watir::Rails.ignore_exceptions = true
|
|
42
42
|
|
43
43
|
## Limitations
|
44
44
|
|
45
|
-
* Watir-Rails works currently only with the [Watir-WebDriver](http://github.com/watir/watir-webdriver) and not with
|
46
|
-
the [Watir-Classic](http://github.com/watir/watir-classic) due to the problems of running a server
|
47
|
-
in the separate thread when WIN32OLE is used.
|
48
|
-
The problem is probably caused by the fact that [WIN32OLE overwrites Thread#initialize](https://github.com/ruby/ruby/blob/trunk/test/ruby/test_thread.rb#L607).
|
49
|
-
|
50
45
|
* When using Rails path/url helpers in your tests then always use path instead of url methods, because latter won't work!
|
51
46
|
|
52
47
|
|
data/lib/watir/rails.rb
CHANGED
@@ -1,157 +1,157 @@
|
|
1
|
-
require "uri"
|
2
|
-
require "net/http"
|
3
|
-
require "rack"
|
4
|
-
require "watir"
|
5
|
-
|
6
|
-
begin
|
7
|
-
require "rails"
|
8
|
-
rescue LoadError
|
9
|
-
# Load legacy Rails
|
10
|
-
require "initializer"
|
11
|
-
end
|
12
|
-
|
13
|
-
require File.expand_path("browser.rb", File.dirname(__FILE__))
|
14
|
-
require File.expand_path("rails/middleware.rb", File.dirname(__FILE__))
|
15
|
-
|
16
|
-
module Watir
|
17
|
-
class Rails
|
18
|
-
class << self
|
19
|
-
private :new
|
20
|
-
attr_reader :port, :middleware
|
21
|
-
attr_writer :ignore_exceptions
|
22
|
-
|
23
|
-
# Start the Rails server for tests.
|
24
|
-
# Will be called automatically by {Watir::Browser#initialize}.
|
25
|
-
def boot
|
26
|
-
unless running?
|
27
|
-
@middleware = Middleware.new(app)
|
28
|
-
@port = find_available_port
|
29
|
-
|
30
|
-
@server_thread = Thread.new do
|
31
|
-
run_default_server @middleware, @port
|
32
|
-
end
|
33
|
-
|
34
|
-
Timeout.timeout(boot_timeout) { @server_thread.join(0.1) until running? }
|
35
|
-
end
|
36
|
-
rescue TimeoutError
|
37
|
-
raise TimeoutError, "Rails Rack application timed out during boot"
|
38
|
-
end
|
39
|
-
|
40
|
-
# Host for Rails app under test. Default is {.local_host}.
|
41
|
-
#
|
42
|
-
# @return [String] Host for Rails app under test.
|
43
|
-
def host
|
44
|
-
@host || local_host
|
45
|
-
end
|
46
|
-
|
47
|
-
# Set host for Rails app. Will be used by {Browser#goto} method.
|
48
|
-
#
|
49
|
-
# @param [String] host host to use when using {Browser#goto}.
|
50
|
-
def host=(host)
|
51
|
-
@host = host
|
52
|
-
end
|
53
|
-
|
54
|
-
# Local host for Rails app under test.
|
55
|
-
#
|
56
|
-
# @return [String] Local host with the value of "127.0.0.1".
|
57
|
-
def local_host
|
58
|
-
"127.0.0.1"
|
59
|
-
end
|
60
|
-
|
61
|
-
# Error rescued by the middleware.
|
62
|
-
#
|
63
|
-
# @return [Exception or NilClass]
|
64
|
-
def error
|
65
|
-
@middleware.error
|
66
|
-
end
|
67
|
-
|
68
|
-
# Set error rescued by the middleware.
|
69
|
-
#
|
70
|
-
# @param value
|
71
|
-
def error=(value)
|
72
|
-
@middleware.error = value
|
73
|
-
end
|
74
|
-
|
75
|
-
# Check if Rails exceptions should be ignored. Defaults to false.
|
76
|
-
#
|
77
|
-
# @return [Boolean] true if exceptions should be ignored, false otherwise.
|
78
|
-
def ignore_exceptions?
|
79
|
-
|
80
|
-
show_exceptions = if legacy_rails?
|
81
|
-
::Rails.configuration.action_dispatch.show_exceptions
|
82
|
-
else
|
83
|
-
::Rails.application.config.action_dispatch.show_exceptions
|
84
|
-
end
|
85
|
-
|
86
|
-
if show_exceptions
|
87
|
-
warn '[WARN] "action_dispatch.show_exceptions" is set to "true", disabling watir-rails exception catcher.'
|
88
|
-
@ignore_exceptions = true
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
!!@ignore_exceptions
|
93
|
-
end
|
94
|
-
|
95
|
-
# Check if Rails app under test is running.
|
96
|
-
#
|
97
|
-
# @return [Boolean] true when Rails app under test is running, false otherwise.
|
98
|
-
def running?
|
99
|
-
return false if @server_thread && @server_thread.join(0)
|
100
|
-
|
101
|
-
res = Net::HTTP.start(local_host, @port) { |http| http.get('/__identify__') }
|
102
|
-
|
103
|
-
if res.is_a?(Net::HTTPSuccess) or res.is_a?(Net::HTTPRedirection)
|
104
|
-
return res.body == @app.object_id.to_s
|
105
|
-
end
|
106
|
-
rescue Errno::ECONNREFUSED, Errno::EBADF
|
107
|
-
return false
|
108
|
-
end
|
109
|
-
|
110
|
-
# Rails app under test.
|
111
|
-
#
|
112
|
-
# @return [Object] Rails Rack app.
|
113
|
-
def app
|
114
|
-
legacy = legacy_rails?
|
115
|
-
@app ||= Rack::Builder.new do
|
116
|
-
map "/" do
|
117
|
-
if legacy
|
118
|
-
use ::Rails::Rack::Static
|
119
|
-
run ActionController::Dispatcher.new
|
120
|
-
else
|
121
|
-
run ::Rails.application
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end.to_app
|
125
|
-
end
|
126
|
-
|
127
|
-
private
|
128
|
-
|
129
|
-
def boot_timeout
|
130
|
-
60
|
131
|
-
end
|
132
|
-
|
133
|
-
def find_available_port
|
134
|
-
server = TCPServer.new(local_host, 0)
|
135
|
-
server.addr[1]
|
136
|
-
ensure
|
137
|
-
server.close if server
|
138
|
-
end
|
139
|
-
|
140
|
-
def run_default_server(app, port)
|
141
|
-
begin
|
142
|
-
require 'rack/handler/thin'
|
143
|
-
Thin::Logging.silent = true
|
144
|
-
Rack::Handler::Thin.run(app, :Port => port)
|
145
|
-
rescue LoadError
|
146
|
-
require 'rack/handler/webrick'
|
147
|
-
Rack::Handler::WEBrick.run(app, :Port => port, :AccessLog => [], :Logger => WEBrick::Log::new(nil, 0))
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
def legacy_rails?
|
152
|
-
::Rails.version.to_f < 3.0
|
153
|
-
end
|
154
|
-
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
1
|
+
require "uri"
|
2
|
+
require "net/http"
|
3
|
+
require "rack"
|
4
|
+
require "watir"
|
5
|
+
|
6
|
+
begin
|
7
|
+
require "rails"
|
8
|
+
rescue LoadError
|
9
|
+
# Load legacy Rails
|
10
|
+
require "initializer"
|
11
|
+
end
|
12
|
+
|
13
|
+
require File.expand_path("browser.rb", File.dirname(__FILE__))
|
14
|
+
require File.expand_path("rails/middleware.rb", File.dirname(__FILE__))
|
15
|
+
|
16
|
+
module Watir
|
17
|
+
class Rails
|
18
|
+
class << self
|
19
|
+
private :new
|
20
|
+
attr_reader :port, :middleware
|
21
|
+
attr_writer :ignore_exceptions
|
22
|
+
|
23
|
+
# Start the Rails server for tests.
|
24
|
+
# Will be called automatically by {Watir::Browser#initialize}.
|
25
|
+
def boot
|
26
|
+
unless running?
|
27
|
+
@middleware = Middleware.new(app)
|
28
|
+
@port = find_available_port
|
29
|
+
|
30
|
+
@server_thread = Thread.new do
|
31
|
+
run_default_server @middleware, @port
|
32
|
+
end
|
33
|
+
|
34
|
+
Timeout.timeout(boot_timeout) { @server_thread.join(0.1) until running? }
|
35
|
+
end
|
36
|
+
rescue TimeoutError
|
37
|
+
raise TimeoutError, "Rails Rack application timed out during boot"
|
38
|
+
end
|
39
|
+
|
40
|
+
# Host for Rails app under test. Default is {.local_host}.
|
41
|
+
#
|
42
|
+
# @return [String] Host for Rails app under test.
|
43
|
+
def host
|
44
|
+
@host || local_host
|
45
|
+
end
|
46
|
+
|
47
|
+
# Set host for Rails app. Will be used by {Browser#goto} method.
|
48
|
+
#
|
49
|
+
# @param [String] host host to use when using {Browser#goto}.
|
50
|
+
def host=(host)
|
51
|
+
@host = host
|
52
|
+
end
|
53
|
+
|
54
|
+
# Local host for Rails app under test.
|
55
|
+
#
|
56
|
+
# @return [String] Local host with the value of "127.0.0.1".
|
57
|
+
def local_host
|
58
|
+
"127.0.0.1"
|
59
|
+
end
|
60
|
+
|
61
|
+
# Error rescued by the middleware.
|
62
|
+
#
|
63
|
+
# @return [Exception or NilClass]
|
64
|
+
def error
|
65
|
+
@middleware.error
|
66
|
+
end
|
67
|
+
|
68
|
+
# Set error rescued by the middleware.
|
69
|
+
#
|
70
|
+
# @param value
|
71
|
+
def error=(value)
|
72
|
+
@middleware.error = value
|
73
|
+
end
|
74
|
+
|
75
|
+
# Check if Rails exceptions should be ignored. Defaults to false.
|
76
|
+
#
|
77
|
+
# @return [Boolean] true if exceptions should be ignored, false otherwise.
|
78
|
+
def ignore_exceptions?
|
79
|
+
if @ignore_exceptions.nil?
|
80
|
+
show_exceptions = if legacy_rails?
|
81
|
+
::Rails.configuration.action_dispatch.show_exceptions
|
82
|
+
else
|
83
|
+
::Rails.application.config.action_dispatch.show_exceptions
|
84
|
+
end
|
85
|
+
|
86
|
+
if show_exceptions
|
87
|
+
warn '[WARN] "action_dispatch.show_exceptions" is set to "true", disabling watir-rails exception catcher.'
|
88
|
+
@ignore_exceptions = true
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
!!@ignore_exceptions
|
93
|
+
end
|
94
|
+
|
95
|
+
# Check if Rails app under test is running.
|
96
|
+
#
|
97
|
+
# @return [Boolean] true when Rails app under test is running, false otherwise.
|
98
|
+
def running?
|
99
|
+
return false if @server_thread && @server_thread.join(0)
|
100
|
+
|
101
|
+
res = Net::HTTP.start(local_host, @port) { |http| http.get('/__identify__') }
|
102
|
+
|
103
|
+
if res.is_a?(Net::HTTPSuccess) or res.is_a?(Net::HTTPRedirection)
|
104
|
+
return res.body == @app.object_id.to_s
|
105
|
+
end
|
106
|
+
rescue Errno::ECONNREFUSED, Errno::EBADF
|
107
|
+
return false
|
108
|
+
end
|
109
|
+
|
110
|
+
# Rails app under test.
|
111
|
+
#
|
112
|
+
# @return [Object] Rails Rack app.
|
113
|
+
def app
|
114
|
+
legacy = legacy_rails?
|
115
|
+
@app ||= Rack::Builder.new do
|
116
|
+
map "/" do
|
117
|
+
if legacy
|
118
|
+
use ::Rails::Rack::Static
|
119
|
+
run ActionController::Dispatcher.new
|
120
|
+
else
|
121
|
+
run ::Rails.application
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end.to_app
|
125
|
+
end
|
126
|
+
|
127
|
+
private
|
128
|
+
|
129
|
+
def boot_timeout
|
130
|
+
60
|
131
|
+
end
|
132
|
+
|
133
|
+
def find_available_port
|
134
|
+
server = TCPServer.new(local_host, 0)
|
135
|
+
server.addr[1]
|
136
|
+
ensure
|
137
|
+
server.close if server
|
138
|
+
end
|
139
|
+
|
140
|
+
def run_default_server(app, port)
|
141
|
+
begin
|
142
|
+
require 'rack/handler/thin'
|
143
|
+
Thin::Logging.silent = true
|
144
|
+
Rack::Handler::Thin.run(app, :Port => port)
|
145
|
+
rescue LoadError
|
146
|
+
require 'rack/handler/webrick'
|
147
|
+
Rack::Handler::WEBrick.run(app, :Port => port, :AccessLog => [], :Logger => WEBrick::Log::new(nil, 0))
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
def legacy_rails?
|
152
|
+
::Rails.version.to_f < 3.0
|
153
|
+
end
|
154
|
+
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
data/lib/watir/version.rb
CHANGED
data/spec/watir/rails_spec.rb
CHANGED
@@ -1,127 +1,132 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Watir::Rails do
|
4
|
-
before do
|
5
|
-
described_class.stub(:warn)
|
6
|
-
described_class.ignore_exceptions =
|
7
|
-
described_class.instance_eval { @middleware = @port = @server_thread = @host = @app = nil }
|
8
|
-
end
|
9
|
-
|
10
|
-
context ".boot" do
|
11
|
-
it "starts the server unless already running" do
|
12
|
-
described_class.stub(app: double("app"), find_available_port: 42)
|
13
|
-
described_class.should_receive(:running?).twice.and_return(false, true)
|
14
|
-
described_class.should_receive(:run_default_server).once
|
15
|
-
|
16
|
-
described_class.boot
|
17
|
-
end
|
18
|
-
|
19
|
-
it "does nothing if server is already running" do
|
20
|
-
described_class.stub(app: double("app"), find_available_port: 42)
|
21
|
-
described_class.should_receive(:running?).once.and_return(true)
|
22
|
-
described_class.should_not_receive(:run_default_server)
|
23
|
-
|
24
|
-
described_class.boot
|
25
|
-
end
|
26
|
-
|
27
|
-
it "raises an error if Rails won't boot with timeout" do
|
28
|
-
described_class.stub(app: double("app"), find_available_port: 42, boot_timeout: 0.01)
|
29
|
-
described_class.should_receive(:running?).at_least(:twice).and_return(false)
|
30
|
-
described_class.should_receive(:run_default_server)
|
31
|
-
|
32
|
-
expect {
|
33
|
-
described_class.boot
|
34
|
-
}.to raise_error(Timeout::Error)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
context ".host" do
|
39
|
-
it "@host if specified" do
|
40
|
-
described_class.host = "my_host"
|
41
|
-
described_class.host.should == "my_host"
|
42
|
-
end
|
43
|
-
|
44
|
-
it "local_host if @host is not specified" do
|
45
|
-
described_class.host = nil
|
46
|
-
described_class.host.should == "127.0.0.1"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
context ".ignore_exceptions?" do
|
51
|
-
it "true if @ignore_exceptions is set to true" do
|
52
|
-
described_class.ignore_exceptions = true
|
53
|
-
described_class.should be_ignore_exceptions
|
54
|
-
end
|
55
|
-
|
56
|
-
it "
|
57
|
-
described_class.
|
58
|
-
described_class.
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
described_class.
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
described_class.
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
described_class.
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
described_class.
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
described_class.
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
described_class.
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Watir::Rails do
|
4
|
+
before do
|
5
|
+
described_class.stub(:warn)
|
6
|
+
described_class.ignore_exceptions = nil
|
7
|
+
described_class.instance_eval { @middleware = @port = @server_thread = @host = @app = nil }
|
8
|
+
end
|
9
|
+
|
10
|
+
context ".boot" do
|
11
|
+
it "starts the server unless already running" do
|
12
|
+
described_class.stub(app: double("app"), find_available_port: 42)
|
13
|
+
described_class.should_receive(:running?).twice.and_return(false, true)
|
14
|
+
described_class.should_receive(:run_default_server).once
|
15
|
+
|
16
|
+
described_class.boot
|
17
|
+
end
|
18
|
+
|
19
|
+
it "does nothing if server is already running" do
|
20
|
+
described_class.stub(app: double("app"), find_available_port: 42)
|
21
|
+
described_class.should_receive(:running?).once.and_return(true)
|
22
|
+
described_class.should_not_receive(:run_default_server)
|
23
|
+
|
24
|
+
described_class.boot
|
25
|
+
end
|
26
|
+
|
27
|
+
it "raises an error if Rails won't boot with timeout" do
|
28
|
+
described_class.stub(app: double("app"), find_available_port: 42, boot_timeout: 0.01)
|
29
|
+
described_class.should_receive(:running?).at_least(:twice).and_return(false)
|
30
|
+
described_class.should_receive(:run_default_server)
|
31
|
+
|
32
|
+
expect {
|
33
|
+
described_class.boot
|
34
|
+
}.to raise_error(Timeout::Error)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context ".host" do
|
39
|
+
it "@host if specified" do
|
40
|
+
described_class.host = "my_host"
|
41
|
+
described_class.host.should == "my_host"
|
42
|
+
end
|
43
|
+
|
44
|
+
it "local_host if @host is not specified" do
|
45
|
+
described_class.host = nil
|
46
|
+
described_class.host.should == "127.0.0.1"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context ".ignore_exceptions?" do
|
51
|
+
it "true if @ignore_exceptions is set to true" do
|
52
|
+
described_class.ignore_exceptions = true
|
53
|
+
described_class.should be_ignore_exceptions
|
54
|
+
end
|
55
|
+
|
56
|
+
it "false if @ignore_exceptions is set to false" do
|
57
|
+
described_class.ignore_exceptions = false
|
58
|
+
described_class.should_not be_ignore_exceptions
|
59
|
+
end
|
60
|
+
|
61
|
+
it "true if Rails.action_dispatch.show_exceptions is set to true for older Rails" do
|
62
|
+
described_class.stub(legacy_rails?: true)
|
63
|
+
described_class.ignore_exceptions = nil
|
64
|
+
::Rails.stub_chain(:configuration, :action_dispatch, :show_exceptions).and_return(true)
|
65
|
+
|
66
|
+
described_class.should be_ignore_exceptions
|
67
|
+
end
|
68
|
+
|
69
|
+
it "true if Rails.action_dispatch.show_exceptions is set to true for Rails 3" do
|
70
|
+
described_class.stub(legacy_rails?: false)
|
71
|
+
described_class.ignore_exceptions = nil
|
72
|
+
::Rails.stub_chain(:application, :config, :action_dispatch, :show_exceptions).and_return(true)
|
73
|
+
|
74
|
+
described_class.should be_ignore_exceptions
|
75
|
+
end
|
76
|
+
|
77
|
+
it "false if Rails.action_dispatch.show_exceptions is set to false for older Rails" do
|
78
|
+
described_class.stub(legacy_rails?: true)
|
79
|
+
described_class.ignore_exceptions = nil
|
80
|
+
::Rails.stub_chain(:configuration, :action_dispatch, :show_exceptions).and_return(false)
|
81
|
+
|
82
|
+
described_class.should_not be_ignore_exceptions
|
83
|
+
end
|
84
|
+
|
85
|
+
it "true if Rails.action_dispatch.show_exceptions is set to false for Rails 3" do
|
86
|
+
described_class.stub(legacy_rails?: false)
|
87
|
+
described_class.ignore_exceptions = nil
|
88
|
+
::Rails.stub_chain(:application, :config, :action_dispatch, :show_exceptions).and_return(false)
|
89
|
+
|
90
|
+
described_class.should_not be_ignore_exceptions
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
context ".running?" do
|
95
|
+
it "false if server thread is running" do
|
96
|
+
fake_thread = double("thread", join: :still_running)
|
97
|
+
described_class.instance_variable_set(:@server_thread, fake_thread)
|
98
|
+
|
99
|
+
described_class.should_not be_running
|
100
|
+
end
|
101
|
+
|
102
|
+
it "false if server cannot be accessed" do
|
103
|
+
fake_thread = double("thread", join: nil)
|
104
|
+
described_class.instance_variable_set(:@server_thread, fake_thread)
|
105
|
+
|
106
|
+
Net::HTTP.should_receive(:start).and_raise Errno::ECONNREFUSED
|
107
|
+
described_class.should_not be_running
|
108
|
+
end
|
109
|
+
|
110
|
+
it "false if server response is not success" do
|
111
|
+
fake_thread = double("thread", join: nil)
|
112
|
+
described_class.instance_variable_set(:@server_thread, fake_thread)
|
113
|
+
app = double("app")
|
114
|
+
described_class.instance_variable_set(:@app, app)
|
115
|
+
|
116
|
+
response = double(Net::HTTPSuccess, is_a?: false)
|
117
|
+
Net::HTTP.should_receive(:start).and_return response
|
118
|
+
described_class.should_not be_running
|
119
|
+
end
|
120
|
+
|
121
|
+
it "true if server response is success" do
|
122
|
+
fake_thread = double("thread", join: nil)
|
123
|
+
described_class.instance_variable_set(:@server_thread, fake_thread)
|
124
|
+
app = double("app")
|
125
|
+
described_class.instance_variable_set(:@app, app)
|
126
|
+
|
127
|
+
response = double(Net::HTTPSuccess, is_a?: true, body: app.object_id.to_s)
|
128
|
+
Net::HTTP.should_receive(:start).and_return response
|
129
|
+
described_class.should be_running
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
metadata
CHANGED
@@ -1,111 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watir-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jarmo Pertman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '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: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
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
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: watir
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '5.0'
|
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
54
|
version: '5.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mime-types
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.16'
|
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
68
|
version: '1.16'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: yard
|
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
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: redcarpet
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '2.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '2.0'
|
111
111
|
description: Use Watir (http://github.com/watir/watir) in Rails.
|
@@ -115,14 +115,16 @@ executables: []
|
|
115
115
|
extensions: []
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
|
-
- .gitignore
|
119
|
-
- .travis.yml
|
120
|
-
- .yardopts
|
118
|
+
- ".gitignore"
|
119
|
+
- ".travis.yml"
|
120
|
+
- ".yardopts"
|
121
121
|
- CHANGES.md
|
122
122
|
- Gemfile
|
123
123
|
- LICENSE
|
124
124
|
- README.md
|
125
125
|
- Rakefile
|
126
|
+
- gemfiles/Gemfile.rails-2.x
|
127
|
+
- gemfiles/Gemfile.rails-3.x
|
126
128
|
- lib/watir/browser.rb
|
127
129
|
- lib/watir/rails.rb
|
128
130
|
- lib/watir/rails/middleware.rb
|
@@ -144,17 +146,17 @@ require_paths:
|
|
144
146
|
- lib
|
145
147
|
required_ruby_version: !ruby/object:Gem::Requirement
|
146
148
|
requirements:
|
147
|
-
- -
|
149
|
+
- - ">="
|
148
150
|
- !ruby/object:Gem::Version
|
149
151
|
version: '0'
|
150
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
153
|
requirements:
|
152
|
-
- -
|
154
|
+
- - ">="
|
153
155
|
- !ruby/object:Gem::Version
|
154
156
|
version: '0'
|
155
157
|
requirements: []
|
156
158
|
rubyforge_project:
|
157
|
-
rubygems_version: 2.
|
159
|
+
rubygems_version: 2.4.5
|
158
160
|
signing_key:
|
159
161
|
specification_version: 4
|
160
162
|
summary: Use Watir (http://github.com/watir/watir) in Rails.
|