Module: Remarkable::Controller::Macros
Overview
Instance Method Summary
collapse
Methods included from Matchers
#assign_to, #filter_params, #render_with_layout, #render_without_layout, #respond_with, #respond_with_content_type, #return_from_session, #route, #set_session, #set_the_flash_to
Instance Method Details
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/remarkable/controller/macros.rb', line 52
def (method_id, *args, &block)
if method_id.to_s =~ /^should_not_(.*)/
should_not_method_missing($1, *args, &block)
elsif method_id.to_s =~ /^should_(.*)/
should_method_missing($1, *args, &block)
elsif method_id.to_s =~ /^xshould_(not_)?(.*)/
pending_method_missing($2, $1, *args, &block)
else
(method_id, *args, &block)
end
end
|
#should_not_redirect_to(url = nil, &block) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/remarkable/controller/macros.rb', line 33
def should_not_redirect_to(url=nil, &block)
it "should not redirect to #{url.inspect}" do
redirect_url = if block_given?
self.instance_eval &block
elsif url.is_a?(Proc)
self.instance_eval &url
else
warn "[DEPRECATION] Strings given to should_not_redirect_to won't be evaluated anymore. Give a proc or a block instead." if url.is_a?(String)
self.instance_eval(url) rescue url
end
response.should_not redirect_to(redirect_url)
end
end
|
#should_not_render_template(template) ⇒ Object
12
13
14
15
16
|
# File 'lib/remarkable/controller/macros.rb', line 12
def should_not_render_template(template)
it "should render template #{template.inspect}" do
response.should_not render_template(template.to_s)
end
end
|
#should_not_set_the_flash ⇒ Object
48
49
50
|
# File 'lib/remarkable/controller/macros.rb', line 48
def should_not_set_the_flash
should_method_missing :set_the_flash_to, nil
end
|
#should_redirect_to(url = nil, &block) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/remarkable/controller/macros.rb', line 18
def should_redirect_to(url=nil, &block)
it "should redirect to #{url.inspect}" do
redirect_url = if block_given?
self.instance_eval &block
elsif url.is_a?(Proc)
self.instance_eval &url
else
warn "[DEPRECATION] Strings given to should_redirect_to won't be evaluated anymore. Give a proc or a block instead." if url.is_a?(String)
self.instance_eval(url) rescue url
end
response.should redirect_to(redirect_url)
end
end
|
#should_render_template(template) ⇒ Object
6
7
8
9
10
|
# File 'lib/remarkable/controller/macros.rb', line 6
def should_render_template(template)
it "should render template #{template.inspect}" do
response.should render_template(template.to_s)
end
end
|