Sha256: b0951cbeea64c45964340d3bfa09ca444e004a8258aef6f67841e3dd35162b81

Contents?: true

Size: 980 Bytes

Versions: 2

Compression:

Stored size: 980 Bytes

Contents

require 'spec_helper'

describe Tarquinn::Controller do
  let(:controller) { Tarquinn::DummyController.new }
  let(:subject) { described_class.new(controller) }

  describe '#call' do
    it 'redirects a method call to the controller' do
      expect(controller).to receive(:redirect_to)
      subject.call(:redirect_to)
    end
  end

  describe '#params' do
    it 'returns the instance params call' do
      expect(subject.params).to eq(action: 'show')
    end
  end

  describe '#has_method?' do
    context 'when calling for a public method that exists' do
      it do
        expect(subject.has_method?(:parse_request)).to be_truthy
      end
    end

    context 'when calling for a private method that exists' do
      it do
        expect(subject.has_method?(:redirection_path)).to be_truthy
      end
    end

    context 'when calling for a non existing method' do
      it do
        expect(subject.has_method?(:non_existing)).to be_falsey
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tarquinn-0.2.0 spec/lib/tarquinn/controller_spec.rb
tarquinn-0.1.0 spec/lib/tarquinn/controller_spec.rb