Sha256: 002c307241b4729722521b93056bd3e0cc5345892962eee5ee29f8e122bc611d

Contents?: true

Size: 1.44 KB

Versions: 5

Compression:

Stored size: 1.44 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 do
          Vedeu::Runtime::Router.expects(:add_controller).
            with(:some_controller, 'Vedeu::ControllerTestKlass')
          subject
        end

        it { subject.must_be_instance_of(Hash) }
      end

      describe '.action' do
        subject { described_model.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 # ClassMethods

  end # Controller

end # Vedeu

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vedeu-0.7.4 test/lib/vedeu/application/controller_test.rb
vedeu-0.7.3 test/lib/vedeu/application/controller_test.rb
vedeu-0.7.2 test/lib/vedeu/application/controller_test.rb
vedeu-0.7.1 test/lib/vedeu/application/controller_test.rb
vedeu-0.7.0 test/lib/vedeu/application/controller_test.rb