Sha256: 9249c2e5c33c1c9aa8deaeed639740dd353bf1faf1fe98a120f00a39c7b34366

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'

describe 'Settings' do
  describe 'instances' do
    before :each do
      @settings = Mina::Settings.new
    end

    it 'setting/getting should work' do
      @settings.host = '192.168.1.1'
      @settings.host.should == '192.168.1.1'
    end

    it 'question mark should work' do
      @settings.deploy_to = '/var/www/there'
      @settings.deploy_to?.should be_true
      @settings.foobar?.should be_false
    end

    it 'question mark should work with nils' do
      @settings.deploy_to = nil
      @settings.deploy_to?.should be_true
      @settings.foobar?.should be_false
    end

    it '||= should work (1)' do
      @settings.x = 2
      @settings.x ||= 3
      @settings.x.should == 2
    end

    it '||= should work (2)' do
      @settings.x ||= 3
      @settings.x.should == 3
    end

    it 'lambdas should work' do
      @settings.path = lambda { "/var/www/#{@settings.version}" }
      @settings.version = '3'

      @settings.path?.should be_true
      @settings.path.should == "/var/www/3"
    end

    it 'bangs should check for settings' do
      begin
        @settings.non_existent_setting!
        1.should == 2
      rescue Mina::Error => e
        e.message.should include "non_existent_setting"
      end
    end

    it 'bangs should return settings' do
      @settings.version = 4
      @settings.version!.should == 4
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mina-0.1.0 spec/dsl/settings_spec.rb