transactional_capybara 0.1.0.pre.1 → 0.1.0.pre.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -10,9 +10,12 @@ module TransactionalCapybara
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def finished_all_ajax_requests?
|
13
|
-
capybara_sessions.all? do |session|
|
14
|
-
|
15
|
-
|
13
|
+
capybara_sessions.all? do |name, session|
|
14
|
+
if is_session_touched?(session)
|
15
|
+
PageWaiting.new(session).finished_ajax_requests?
|
16
|
+
else
|
17
|
+
true
|
18
|
+
end
|
16
19
|
end
|
17
20
|
end
|
18
21
|
|
@@ -31,11 +34,18 @@ module TransactionalCapybara
|
|
31
34
|
end
|
32
35
|
end
|
33
36
|
|
37
|
+
private
|
38
|
+
|
39
|
+
# Hack into Capybara's private interface to get access to all sessions
|
34
40
|
def capybara_sessions
|
35
41
|
Capybara.send :session_pool
|
36
42
|
end
|
37
43
|
|
38
|
-
|
44
|
+
# Another hack, to see if Capybara sessions have been used
|
45
|
+
def is_session_touched?(session)
|
46
|
+
session.instance_variable_get(:@touched)
|
47
|
+
end
|
48
|
+
|
39
49
|
def run_js(expr)
|
40
50
|
@page.execute_script(expr)
|
41
51
|
end
|