Sha256: fddc1cd6e90b57654eaed81a258157de7b019da7e729ce6725491a0d7f5a894e

Contents?: true

Size: 866 Bytes

Versions: 5

Compression:

Stored size: 866 Bytes

Contents

require 'rails_helper'

class TestEngine < ::Rails::Engine
  include ::Dradis::Plugins::Base
  addon_settings :test_engine do
  end
end

describe Dradis::Plugins::Base do
  before(:each) do
    TestEngine::settings.reset_defaults!
  end

  describe '#enabled?' do
    it 'returns default value' do
      expect(TestEngine.enabled?).to eq(true)
    end
  end
  describe '#enable!' do
    it 'sets enabled to true' do
      TestEngine.settings.enabled = false
      TestEngine.settings.save

      expect { TestEngine.enable! }.to change {
        TestEngine.enabled?
      }.from(false).to(true)
    end
  end
  describe '#disable!' do
    it 'sets enabled to false' do
      TestEngine.settings.enabled = true
      TestEngine.settings.save

      expect { TestEngine.disable! }.to change {
        TestEngine.enabled?
      }.from(true).to(false)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dradis-plugins-4.14.0 spec/engine_spec.rb
dradis-plugins-4.13.0 spec/engine_spec.rb
dradis-plugins-4.11.0 spec/engine_spec.rb
dradis-plugins-4.10.0 spec/engine_spec.rb
dradis-plugins-4.9.0 spec/engine_spec.rb