Sha256: c21e1e8366233d79efc9527707dae6762358ed6f77f81fd6cf91607464e1f30a

Contents?: true

Size: 1.32 KB

Versions: 4

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'
require 'action_dispatch/routing'
require 'rails'

require_relative '../../../lib/passages/engine'
require_relative '../../../app/controllers/passages/routes_controller'

module Passages
  describe RoutesController do
    describe '#routes' do
      before do
        allow(subject).to receive(:application_routes) { anything }
        allow(subject).to receive(:engine_routes) { anything }
        allow(subject).to receive(:mount_routes) { anything }
        subject.routes
      end

      it 'sets @routes' do
        expect(subject.instance_variable_get(:@routes)).to_not be_nil
      end

      it 'sets @engine_routes' do
        expect(subject.instance_variable_get(:@engine_routes)).to_not be_nil
      end

      it 'sets @mount_routes' do
        expect(subject.instance_variable_get(:@mount_routes)).to_not be_nil
      end
    end

    describe '!#engine_routes' do
      it 'calls mounted_engine_routes' do
        expect(subject).to receive(:mounted_engine_routes) { [] }
        subject.send(:engine_routes)
      end
    end

    describe '!#passages_rails_routes' do
      it 'calls deep into the Rails routes' do
        expect(Rails)
          .to receive_message_chain(:application, :routes, :routes) do
            []
          end
        subject.send(:passages_rails_routes)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
passages-2.0.0 spec/controllers/passages/routes_controller_spec.rb
passages-1.5.2 spec/controllers/passages/routes_controller_spec.rb
passages-1.5.0 spec/controllers/passages/routes_controller_spec.rb
passages-1.4.1 spec/controllers/passages/routes_controller_spec.rb