Sha256: de6deb4006badf93133d34c6949014722f876f8895954e1a7a5c0774fa20f794

Contents?: true

Size: 1.44 KB

Versions: 61

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 {
          Vedeu::Runtime::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::Runtime::Router.expects(:add_action).
            with(:some_controller, :some_action)
          Vedeu::Runtime::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

61 entries across 61 versions & 1 rubygems

Version Path
vedeu-0.6.71 test/lib/vedeu/application/controller_test.rb
vedeu-0.6.70 test/lib/vedeu/application/controller_test.rb
vedeu-0.6.69 test/lib/vedeu/application/controller_test.rb
vedeu-0.6.68 test/lib/vedeu/application/controller_test.rb
vedeu-0.6.67 test/lib/vedeu/application/controller_test.rb
vedeu-0.6.66 test/lib/vedeu/application/controller_test.rb
vedeu-0.6.65 test/lib/vedeu/application/controller_test.rb
vedeu-0.6.64 test/lib/vedeu/application/controller_test.rb
vedeu-0.6.63 test/lib/vedeu/application/controller_test.rb
vedeu-0.6.62 test/lib/vedeu/application/controller_test.rb
vedeu-0.6.61 test/lib/vedeu/application/controller_test.rb
vedeu-0.6.60 test/lib/vedeu/application/controller_test.rb
vedeu-0.6.59 test/lib/vedeu/application/controller_test.rb
vedeu-0.6.58 test/lib/vedeu/application/controller_test.rb
vedeu-0.6.57 test/lib/vedeu/application/controller_test.rb
vedeu-0.6.56 test/lib/vedeu/application/controller_test.rb
vedeu-0.6.54 test/lib/vedeu/application/controller_test.rb
vedeu-0.6.53 test/lib/vedeu/application/controller_test.rb
vedeu-0.6.52 test/lib/vedeu/application/controller_test.rb
vedeu-0.6.51 test/lib/vedeu/application/controller_test.rb