Sha256: 206206402cb910396bd6d571b7121b6910ebe180b662300709909fda75c2cd34

Contents?: true

Size: 1.3 KB

Versions: 5

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

require 'test_helper'

module Vedeu

  class ControllerTestClass

    include Vedeu::Controller

    controller :some_controller
    action :some_action

  end # ControllerTestClass

  describe Controller do

    let(:described)          { Vedeu::Controller }
    let(:included_described) { Vedeu::ControllerTestClass }

    it { included_described.must_respond_to(:controller_name) }
    it { included_described.must_respond_to(:action_name) }
    it { included_described.must_respond_to(:controller) }
    it { included_described.must_respond_to(:action) }

    describe '.controller' do
      subject { included_described.controller(:some_controller) }

      it do
        Vedeu::Runtime::Router.expects(:add_controller).
          with(:some_controller, 'Vedeu::ControllerTestClass')
        subject
      end

      it { subject.must_be_instance_of(Hash) }
    end

    describe '.action' do
      subject { included_described.action(:some_action, :other_action) }

      it do
        Vedeu::Runtime::Router.expects(:add_action).
          with(:some_controller, :some_action)
        Vedeu::Runtime::Router.expects(:add_action).
          with(:some_controller, :other_action)
        subject
      end

      it { subject.must_be_instance_of(Array) }
    end

  end # Controller

end # Vedeu

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vedeu-0.8.15 test/lib/vedeu/application/controller_test.rb
vedeu-0.8.14 test/lib/vedeu/application/controller_test.rb
vedeu-0.8.13 test/lib/vedeu/application/controller_test.rb
vedeu-0.8.12 test/lib/vedeu/application/controller_test.rb
vedeu-0.8.10 test/lib/vedeu/application/controller_test.rb