Sha256: 836a57e5cfc85bf0d7b1958c3049b68c9e2d0fed81133c730d2c96a6f4a9bec8

Contents?: true

Size: 1.41 KB

Versions: 23

Compression:

Stored size: 1.41 KB

Contents

require 'test_helper'

module Vedeu

  class ControllerTestKlass

    include Vedeu::Controller

    controller :some_controller
    action :some_action

  end # ControllerTestClass

  describe Controller do

    let(:described) { Vedeu::Controller }

    let(:described_model) { Vedeu::ControllerTestKlass }
    let(:instance_model)  { described.new }

    describe 'ClassMethods' do
      let(:described) { Vedeu::Controller::ClassMethods }

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

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

        it {
          Vedeu::Router.expects(:add_controller).
            with(:some_controller, 'Vedeu::ControllerTestKlass')
          subject
        }

        it { subject.must_be_instance_of(Hash) }
      end

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

        it {
          Vedeu::Router.expects(:add_action).
            with(:some_controller, :some_action)
          Vedeu::Router.expects(:add_action).
            with(:some_controller, :other_action)
          subject
        }

        it { subject.must_be_instance_of(Array) }
      end

    end # ClassMethods

  end # Controller

end # Vedeu

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
vedeu-0.5.3 test/lib/vedeu/application/controller_test.rb
vedeu-0.5.2 test/lib/vedeu/application/controller_test.rb
vedeu-0.5.1 test/lib/vedeu/application/controller_test.rb