hyper-spec 0.1.0 → 0.1.1

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.
@@ -1,30 +0,0 @@
1
- module HyperSpec
2
- module WaitForAjax
3
- def wait_for_ajax
4
- Timeout.timeout(Capybara.default_max_wait_time) do
5
- loop do
6
- sleep 0.25
7
- break if finished_all_ajax_requests?
8
- end
9
- end
10
- end
11
-
12
- def running?
13
- result = page.evaluate_script('(function(active) { return active; })(jQuery.active)')
14
- result && !result.zero?
15
- rescue Exception => e
16
- puts "wait_for_ajax failed while testing state of jQuery.active: #{e}"
17
- end
18
-
19
- def finished_all_ajax_requests?
20
- unless running?
21
- sleep 0.25 # this was 1 second, not sure if its necessary to be so long...
22
- !running?
23
- end
24
- rescue Capybara::NotSupportedByDriverError
25
- true
26
- rescue Exception => e
27
- e.message == 'jQuery is not defined'
28
- end
29
- end
30
- end
@@ -1,7 +0,0 @@
1
- module React
2
- module IsomorphicHelpers
3
- def self.load_context(ctx, controller, name = nil)
4
- @context = Context.new("#{controller.object_id}-#{Time.now.to_i}", ctx, controller, name)
5
- end
6
- end
7
- end
@@ -1,104 +0,0 @@
1
- module React
2
- class TopLevelRailsComponent
3
- class << self
4
- attr_accessor :event_history
5
-
6
- def callback_history_for(proc_name)
7
- event_history[proc_name]
8
- end
9
-
10
- def last_callback_for(proc_name)
11
- event_history[proc_name].last
12
- end
13
-
14
- def clear_callback_history_for(proc_name)
15
- event_history[proc_name] = []
16
- end
17
-
18
- def event_history_for(event_name)
19
- event_history["_on#{event_name.event_camelize}"]
20
- end
21
-
22
- def last_event_for(event_name)
23
- event_history["_on#{event_name.event_camelize}"].last
24
- end
25
-
26
- def clear_event_history_for(event_name)
27
- event_history["_on#{event_name.event_camelize}"] = []
28
- end
29
- end
30
-
31
- def component
32
- return @component if @component
33
- paths_searched = []
34
-
35
- if params.component_name.start_with?('::')
36
- paths_searched << params.component_name.gsub(/^\:\:/, '')
37
-
38
- @component =
39
- begin
40
- params.component_name.gsub(/^\:\:/, '').split('::')
41
- .inject(Module) { |scope, next_const| scope.const_get(next_const, false) }
42
- rescue
43
- nil
44
- end
45
-
46
- return @component if @component && @component.method_defined?(:render)
47
- else
48
- self.class.search_path.each do |path|
49
- # try each path + params.controller + params.component_name
50
- paths_searched << "#{path.name + '::' unless path == Module}"\
51
- "#{params.controller}::#{params.component_name}"
52
-
53
- @component =
54
- begin
55
- [params.controller, params.component_name]
56
- .join('::').split('::')
57
- .inject(path) { |scope, next_const| scope.const_get(next_const, false) }
58
- rescue
59
- nil
60
- end
61
-
62
- return @component if @component && @component.method_defined?(:render)
63
- end
64
-
65
- self.class.search_path.each do |path|
66
- # then try each path + params.component_name
67
- paths_searched << "#{path.name + '::' unless path == Module}#{params.component_name}"
68
- @component =
69
- begin
70
- params.component_name.to_s.split('::')
71
- .inject(path) { |scope, next_const| scope.const_get(next_const, false) }
72
- rescue
73
- nil
74
- end
75
-
76
- return @component if @component && @component.method_defined?(:render)
77
- end
78
- end
79
-
80
- @component = nil
81
-
82
- raise "Could not find component class '#{params.component_name}' "\
83
- "for params.controller '#{params.controller}' in any component directory. "\
84
- "Tried [#{paths_searched.join(', ')}]"
85
- end
86
-
87
- before_mount do
88
- TopLevelRailsComponent.event_history = Hash.new { |h, k| h[k] = [] }
89
- @render_params = params.render_params
90
- component.validator.rules.each do |name, rules|
91
- next unless rules[:type] == Proc
92
-
93
- TopLevelRailsComponent.event_history[name] = []
94
- @render_params[name] = lambda do |*args|
95
- TopLevelRailsComponent.event_history[name] << args.collect { |arg| Native(arg).to_n }
96
- end
97
- end
98
- end
99
-
100
- def render
101
- present component, @render_params
102
- end
103
- end
104
- end
@@ -1,55 +0,0 @@
1
- module Selenium
2
- module WebDriver
3
- module Firefox
4
- class Profile
5
- class << self
6
- attr_accessor :firebug_version
7
-
8
- def firebug_version
9
- @firebug_version ||= '2.0.13-fx'
10
- end
11
- end
12
-
13
- def frame_position
14
- @frame_position ||= 'detached'
15
- end
16
-
17
- def frame_position=(position)
18
- @frame_position = %w(left right top detached).detect do |side|
19
- position && position[0].downcase == side[0]
20
- end || 'detached'
21
- end
22
-
23
- def enable_firebug(version = nil)
24
- version ||= Selenium::WebDriver::Firefox::Profile.firebug_version
25
- add_extension(File.expand_path("../../../../bin/firebug-#{version}.xpi", __FILE__))
26
-
27
- # For some reason, Firebug seems to trigger the Firefox plugin check
28
- # (navigating to https://www.mozilla.org/en-US/plugincheck/ at startup).
29
- # This prevents it. See http://code.google.com/p/selenium/issues/detail?id=4619.
30
- self['extensions.blocklist.enabled'] = false
31
-
32
- # Prevent "Welcome!" tab
33
- self['extensions.firebug.showFirstRunPage'] = false
34
-
35
- # Enable for all sites.
36
- self['extensions.firebug.allPagesActivation'] = 'on'
37
-
38
- # Enable all features.
39
- %w(console net script).each do |feature|
40
- self["extensions.firebug.#{feature}.enableSites"] = true
41
- end
42
-
43
- # Closed by default, will open detached.
44
- self['extensions.firebug.framePosition'] = frame_position
45
- self['extensions.firebug.previousPlacement'] = 3
46
- self['extensions.firebug.defaultPanelName'] = 'console'
47
-
48
- # Disable native "Inspect Element" menu item.
49
- self['devtools.inspector.enabled'] = false
50
- self['extensions.firebug.hideDefaultInspector'] = true
51
- end
52
- end
53
- end
54
- end
55
- end