Sha256: 83057d7f76554a31732fd62c5742e5277105707d359081db0a0050615f519aba

Contents?: true

Size: 691 Bytes

Versions: 2

Compression:

Stored size: 691 Bytes

Contents

require 'spec_helper'
require 'danthes/view_helpers'

module Danthes
  describe ViewHelpers do

    let(:klass) do
      Class.new do
        include ActionView::Helpers::TagHelper
        include ActionView::Context
        include ViewHelpers
      end
    end

    describe '#subscribe_to' do
      it "generates javascript tag by default" do
        expect(klass.new.subscribe_to('hello')).to match /\A<script.*<\/script>\z/
      end

      it "removes javascript tag when *include_js_tag* is set to false" do
        expect(klass.new.subscribe_to('hello', include_js_tag: false)).to match /\Aif \(typeof Danthes \!= 'undefined'\) { Danthes.sign\(.*\) }\z/
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
edmond-danthes-2.1.1 spec/danthes/view_helpers_spec.rb
edmond-danthes-2.1.0 spec/danthes/view_helpers_spec.rb