Sha256: f0a3c0b95cb1788b5c21f71d4e0093ed0f864b1d877b68de44d316eba3044f58

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'
require 'action_controller'
require 'thunderer/controller_additions'


describe Thunderer::ControllerAdditions do
  class MyController < ActionController::Base
    include Thunderer::ControllerAdditions

    def index
      # render text: 'ok'
    end

    def params; end
  end

  let(:controller_class) { MyController }

  describe '#thunderer_channels' do

      it 'should affect channels class variable' do
        controller_class.thunderer_channels('hello')
        expect(controller_class.channels).to include('hello')
      end

      it 'should affect interpolation_object of class' do
        controller_class.thunderer_channels(object: 'hello')
        expect(controller_class.interpolation_object).to include('hello')
      end

      it 'should setup before filter for setting headers' do
        expect(controller_class).to have_filters(:before, :add_channels_header)
      end

      context 'for instance of controller' do
        subject(:controller) { controller_class.new }

        # it 'should add special header for index response' do
        #   controller_class.thunderer_channels('hello')
        #   allow(controller).to receive(:headers)
        #   controller.send(:add_channels_header)
        # end

      end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thunderer-0.9.1 spec/thunderer/controller_aditions_spec.rb
thunderer-0.9.0 spec/thunderer/controller_aditions_spec.rb