11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/chris_lib/test_access.rb', line 11
def it_should_route_to(path,actions,flash_message=nil)
actions.each do |a|
it "should deny access to #{a}" do
if Rails::VERSION::MAJOR >= 5
get a.to_sym, params: { id: 1}
else
get a.to_sym, id: 1
end
expect(response).to redirect_to send(path)
end
if flash_message.present?
it "should have correct flash message for #{a}" do
if Rails::VERSION::MAJOR >= 5
get a.to_sym, params: { id: 1}
else
get a.to_sym, id: 1
end
expect(flash[:error]).to include flash_message
end
end
end
end
|