Sha256: 3dcc15fa76fb0409eb4189e256c59a47a447620798687fc5f6cd995764e04f24

Contents?: true

Size: 1014 Bytes

Versions: 1

Compression:

Stored size: 1014 Bytes

Contents

#encoding: utf-8
require 'spec_helper'

describe Pousse do


  describe 'Mailer' do

    let :mailer do
      Class.new(Pousse::Mailer) do
        def send_alert
          mail(
            to: 'everybody',
            body: 'alert("Générale !");'
          )
        end
      end 
    end

    let :redis_instance do
      redis_instance = stub()
      Redis.stub(new: redis_instance)
      redis_instance
    end

    it 'provide Pousse::Mailer' do
      expect{
        Class.new Pousse::Mailer
      }.to_not raise_error
    end

    it 'sends the message to redis' do
      redis_instance
        .should_receive(:publish)
        .with('everybody',  'alert("Générale !");')
      mailer.send_alert.deliver
    end

  end


  describe '#configure' do
    it 'accept redis_configuration' do
      Pousse::configure do |config|
        config.redis = {}
      end
    end
  end

  describe '#send' do
    it 'render and send a js message' do
      #Pousse::pousse('test', 'mytemplate')
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pousse-0.0.2 spec/pousse/pousse_spec.rb