Sha256: e2c2dd27cc78fdf5eb409b68f07804e3afea5841a9c9adc6faf0d1134747afb2

Contents?: true

Size: 988 Bytes

Versions: 2

Compression:

Stored size: 988 Bytes

Contents

require 'spec_helper'

describe SettingsJs do

  describe '.configuration' do
    it 'calls block with configuration object in parameter' do
      expect { |config| SettingsJs.configuration(&config) }.to yield_with_args(SettingsJs::Config.instance)
    end
  end

  describe 'Engine' do
    context 'when Rails constant does not exist' do
      it 'does not make the gem an engine' do
        reload_gem
        defined?(::SettingsJS::Engine).should be_false
      end
    end

    context 'when Rails constant exists' do
      before(:each) { stub_const('Rails', Class.new) }

      it 'does not make the gem an engine' do
        reload_gem
        defined?(::SettingsJS::Engine).should be_false
      end

      context 'when Rails::Engine constant exists' do
        before(:each) { stub_const('Rails::Engine', Class.new) }

        it 'makes the gem an engine' do
          reload_gem
          defined?(::SettingsJS::Engine).should be_true
        end
      end

    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
settings_js-0.3.0 spec/settings_js_spec.rb
settings_js-0.2.0 spec/settings_js_spec.rb