spec/controllers/application_controller_spec.rb in breadcrumble-3.0.0 vs spec/controllers/application_controller_spec.rb in breadcrumble-3.0.1

- old
+ new

@@ -2,13 +2,15 @@ describe ApplicationController do controller do add_breadcrumb 'root', '/' add_breadcrumb 'nil', nil + add_breadcrumb -> c { c.examples_url }, -> c { c.examples_path } def index add_breadcrumb 'examples', controller: 'examples', action: 'index', only_path: true + add_breadcrumb 'example', example_path(123) render text: 'test' end end describe '#index' do @@ -26,16 +28,28 @@ it 'url has nil value' do should be_success assigns(:breadcrumbs)[1][:name].should eq('nil') assigns(:breadcrumbs)[1][:url].should be_nil end + + it 'execute lambda in controller instance context' do + should be_success + assigns(:breadcrumbs)[2][:name].should eq('http://test.host/examples') + assigns(:breadcrumbs)[2][:url].should eq('/examples') + end end context '#add_breadcrumb' do it 'url options' do should be_success - assigns(:breadcrumbs)[2][:name].should eq('examples') - assigns(:breadcrumbs)[2][:url].should eq('/examples') + assigns(:breadcrumbs)[3][:name].should eq('examples') + assigns(:breadcrumbs)[3][:url].should eq('/examples') + end + + it 'example_path' do + should be_success + assigns(:breadcrumbs)[4][:name].should eq('example') + assigns(:breadcrumbs)[4][:url].should eq('/examples/123') end end end end