Sha256: 0db870bbba215d9589c743c8773c56c8c98559af7f30c5d6f2482ed22482aa53

Contents?: true

Size: 1.31 KB

Versions: 9

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

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 }

    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 # Controller

end # Vedeu

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
vedeu-0.8.9 test/lib/vedeu/application/controller_test.rb
vedeu-0.8.8 test/lib/vedeu/application/controller_test.rb
vedeu-0.8.7 test/lib/vedeu/application/controller_test.rb
vedeu-0.8.6 test/lib/vedeu/application/controller_test.rb
vedeu-0.8.5 test/lib/vedeu/application/controller_test.rb
vedeu-0.8.4 test/lib/vedeu/application/controller_test.rb
vedeu-0.8.3 test/lib/vedeu/application/controller_test.rb
vedeu-0.8.2 test/lib/vedeu/application/controller_test.rb
vedeu-0.8.1 test/lib/vedeu/application/controller_test.rb