2014-02-15 05:07:44 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# All examples are using namespaces
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
feature 'executing Paloma controller', :js => true do
|
|
|
|
|
|
|
|
|
|
|
|
context 'default behavior' do
|
2016-03-03 10:11:24 -05:00
|
|
|
it 'executes the same namespace/controller#action' do
|
2014-02-15 05:07:44 -05:00
|
|
|
visit admin_foos_path
|
|
|
|
|
2015-03-24 10:01:18 -04:00
|
|
|
expect(
|
|
|
|
request['controller'] == 'Admin/Foos' &&
|
|
|
|
request['action'] == 'index' &&
|
|
|
|
request['params'] == {}
|
|
|
|
).to be_truthy
|
2014-02-15 05:07:44 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
context 'override default controller' do
|
|
|
|
it 'executes the specified controller' do
|
|
|
|
visit admin_foo_path(1)
|
|
|
|
|
2015-03-24 10:01:18 -04:00
|
|
|
expect(
|
|
|
|
request['controller'] == 'NotAdmin/Foos' &&
|
|
|
|
request['action'] == 'show' &&
|
|
|
|
request['params'] == {'x' => 99}
|
|
|
|
).to be_truthy
|
2014-02-15 05:07:44 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
context 'override default action' do
|
|
|
|
it 'executes the specified action' do
|
|
|
|
visit new_admin_foo_path
|
|
|
|
|
2015-03-24 10:01:18 -04:00
|
|
|
expect(
|
|
|
|
request['controller'] == 'Admin/Foos' &&
|
|
|
|
request['action'] == 'otherAction' &&
|
|
|
|
request['params'] == {'x' => 99}
|
|
|
|
).to be_truthy
|
2014-02-15 05:07:44 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
context 'override default controller/action' do
|
|
|
|
it 'executes the specified controller/action' do
|
|
|
|
visit edit_admin_foo_path(1)
|
|
|
|
|
2015-03-24 10:01:18 -04:00
|
|
|
expect(
|
|
|
|
request['controller'] == 'NotAdmin/Foos' &&
|
|
|
|
request['action'] == 'otherAction' &&
|
|
|
|
request['params'] == {'x' => 99}
|
|
|
|
).to be_truthy
|
2014-02-15 05:07:44 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-02-15 05:51:02 -05:00
|
|
|
|
2015-03-24 10:01:18 -04:00
|
|
|
end
|