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
128
129
130
|
# File 'lib/scarpe/shoes_spec.rb', line 128
def catscradle_dsl(&block)
Scarpe::CCInstance.instance.instance_eval(&block)
end
|
#dom_html ⇒ Object
132
133
134
135
136
137
|
# File 'lib/scarpe/shoes_spec.rb', line 132
def dom_html
catscradle_dsl do
wait fully_updated
dom_html
end
end
|
#drawable(*specs) ⇒ Object
120
121
122
123
124
125
126
|
# File 'lib/scarpe/shoes_spec.rb', line 120
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
153
154
155
156
157
158
159
160
|
# File 'lib/scarpe/shoes_spec.rb', line 153
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.
141
142
143
144
145
146
147
148
149
150
151
|
# File 'lib/scarpe/shoes_spec.rb', line 141
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
|