Sha256: ada4df4f9b580020027b81796abe3b07fa2f772734165ab1d626cd6e2c36123a

Contents?: true

Size: 836 Bytes

Versions: 2

Compression:

Stored size: 836 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Praxis::Controller do
  subject do
    Class.new do
      include Praxis::Controller

      implements PeopleResource

      before :validate, actions: [:index] do
        'before'
      end

      before actions: [:show] do
      end

      after :response, actions: [:show] do
        'after'
      end

      def index; end

      def show; end
    end
  end

  context '.implements' do
    it 'set the resource definition controller' do
      expect(subject).to eq(PeopleResource.controller)
    end
  end

  describe '#inspect' do
    it 'includes name, object ID and request' do
      SomeController = subject # de-anonymize class name
      expect(subject.new('eioio').inspect).to match(
        /#<SomeController#[0-9]+ @request="eioio">/
      )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
praxis-2.0.pre.33 spec/praxis/controller_spec.rb
praxis-2.0.pre.32 spec/praxis/controller_spec.rb