Module: Scarpe::ShoesSpecTest
Overview
When running ShoesSpec tests, we create a parent class for all of them
with the appropriate convenience methods and accessors.
Instance Method Summary
collapse
#assert_contains_html, #assert_html
Instance Method Details
#catscradle_dsl(&block) ⇒ Object
127
128
129
|
# File 'lib/scarpe/shoes_spec.rb', line 127
def catscradle_dsl(&block)
Scarpe::CCInstance.instance.instance_eval(&block)
end
|
#dom_html ⇒ Object
131
132
133
134
135
136
|
# File 'lib/scarpe/shoes_spec.rb', line 131
def dom_html
catscradle_dsl do
wait fully_updated
dom_html
end
end
|
#drawable(*specs) ⇒ Object
119
120
121
122
123
124
125
|
# File 'lib/scarpe/shoes_spec.rb', line 119
def drawable(*specs)
drawables = app.find_drawables_by(*specs)
raise Scarpe::MultipleDrawablesFoundError, "Found more than one #{finder_name} matching #{args.inspect}!" if drawables.size > 1
raise Scarpe::NoDrawablesFoundError, "Found no #{finder_name} matching #{args.inspect}!" if drawables.empty?
Scarpe::ShoesSpecProxy.new(drawables[0])
end
|
#exit_on_first_heartbeat ⇒ Object
152
153
154
155
156
157
158
159
|
# File 'lib/scarpe/shoes_spec.rb', line 152
def exit_on_first_heartbeat
catscradle_dsl do
on_event(:next_heartbeat) do
@log.info "Exiting on first heartbeat (exit code #{exit_code})"
exit 0
end
end
end
|
#timeout(t_timeout = 5.0) ⇒ Object
A timeout won't cause an error by itself. If you want an error, make sure
to check for a minimum number of assertions or otherwise look for progress.
140
141
142
143
144
145
146
147
148
149
150
|
# File 'lib/scarpe/shoes_spec.rb', line 140
def timeout(t_timeout = 5.0)
catscradle_dsl do
t0 = Time.now
on_event(:every_heartbeat) do
if Time.now - t0 >= t_timeout
@log.info "Timed out after #{t_timeout} seconds!"
shut_down_shoes_code
end
end
end
end
|