Sha256: 85ac6fd47380fc12e12f6f92215934e2ae1e4728e02a3edb774a238c25e65d7c

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 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
        }
      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
        }
      end

    end # ClassMethods

  end # Controller

end # Vedeu

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vedeu-0.5.0 test/lib/vedeu/application/controller_test.rb
vedeu-0.4.65 test/lib/vedeu/application/controller_test.rb
vedeu-0.4.64 test/lib/vedeu/application/controller_test.rb