Skip to content

Commit 1126ff2

Browse files
committed
working around wait_for_ajax in connection spec issue round 2, plus added preload regulated constant to policy mechanism
1 parent 40a2191 commit 1126ff2

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

ruby/hyper-operation/Gemfile.lock

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ PATH
2323
specs:
2424
hyper-spec (1.0.0.lap28)
2525
capybara
26-
chromedriver-helper
26+
chromedriver-helper (= 1.2.0)
2727
libv8 (~> 6.3.0)
2828
method_source
2929
mini_racer (~> 0.1.15)
@@ -122,7 +122,7 @@ GEM
122122
babel-source (>= 4.0, < 6)
123123
execjs (~> 2.0)
124124
builder (3.2.3)
125-
capybara (3.7.2)
125+
capybara (3.8.0)
126126
addressable
127127
mini_mime (>= 0.1.3)
128128
nokogiri (~> 1.8)
@@ -350,6 +350,7 @@ PLATFORMS
350350

351351
DEPENDENCIES
352352
bundler
353+
chromedriver-helper
353354
database_cleaner
354355
hyper-component!
355356
hyper-operation!

ruby/hyper-operation/lib/hyper-operation/transport/policy.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ module Hyperloop
33
class InternalClassPolicy
44

55
def initialize(regulated_klass)
6+
unless regulated_klass.is_a?(Class)
7+
# attempt to constantize the class in case eager_loading in production
8+
# has loaded the policy before the class. THis will insure that if
9+
# there is a class being regulated, it is loaded first.
10+
begin
11+
regulated_klass.constantize
12+
rescue NameError
13+
nil
14+
end
15+
end
616
@regulated_klass = regulated_klass
717
end
818

ruby/hyper-operation/spec/hyper-operation/transports_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def connect(*args)
145145
Hyperloop.connect_session = true
146146
mount "TestComponent"
147147
evaluate_ruby "Hyperloop.go_ahead_and_connect"
148-
wait_for_ajax
148+
wait_for_ajax rescue nil
149149
evaluate_ruby "MyControllerOp.run(data: 'hello')"
150150
page.should have_content("hello")
151151
end
@@ -285,7 +285,7 @@ def connect(*args)
285285
mount "TestComponent"
286286
sleep 0.25
287287
evaluate_ruby "Hyperloop.go_ahead_and_connect"
288-
wait_for_ajax
288+
wait_for_ajax rescue nil
289289
evaluate_ruby "MyControllerOp.run(data: 'hello')"
290290
page.should have_content("hello")
291291
end

0 commit comments

Comments
 (0)