spec/lib/simple_navigation/adapters/padrino_spec.rb in simple-navigation-3.11.0 vs spec/lib/simple_navigation/adapters/padrino_spec.rb in simple-navigation-3.12.0

- old
+ new

@@ -1,31 +1,29 @@ require 'spec_helper' -describe SimpleNavigation::Adapters::Padrino do +module SimpleNavigation + module Adapters + describe Padrino do + let(:adapter) { SimpleNavigation::Adapters::Padrino.new(context) } + let(:content) { double(:content) } + let(:context) { double(:context, request: request) } + let(:request) { double(:request) } - def create_adapter - SimpleNavigation::Adapters::Padrino.new(@context) - end - - before(:each) do - @request = stub(:request) - @content = stub(:content) - @context = stub(:context, :request => @request) - @adapter = create_adapter - end - - describe 'link_to' do - it "should delegate to context" do - @context.should_receive(:link_to).with('name', 'url', :my_option => true) - @adapter.link_to('name', 'url', :my_option => true) + describe '#link_to' do + it 'delegates to context' do + expect(context).to receive(:link_to) + .with('name', 'url', :my_option => true) + adapter.link_to('name', 'url', :my_option => true) + end + end + + describe '#content_tag' do + it 'delegates to context' do + expect(content).to receive(:html_safe).and_return('content') + expect(context).to receive(:content_tag) + .with('type', 'content', my_option: true) + adapter.content_tag('type', content, my_option: true) + end + end end end - - describe 'content_tag' do - it "should delegate to context" do - @content.should_receive(:html_safe).and_return('content') - @context.should_receive(:content_tag).with('type', 'content', :my_option => true) - @adapter.content_tag('type', @content, :my_option => true) - end - end - end