Sha256: 8b81e2cebf763637adca1435fc0f228982d242376b19278c486b730caa5429a4
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 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 let(:config_file_path) { 'spec/fixtures/thunderer.yml' } let(:environment) { 'production' } before { Thunderer.load_config(config_file_path, environment) } 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
thunderer-1.0.0 | spec/thunderer/controller_aditions_spec.rb |