Sha256: 4a05831ed08ad414a88d7dc9c0c7943fc494d36dffd573c4e73de3379083f7c0

Contents?: true

Size: 1.49 KB

Versions: 2

Compression:

Stored size: 1.49 KB

Contents

require "spec_helper"

describe Praegustator::Dsl do
  before :each do
    Praegustator::Wrappers::Chef.stub(:search)
  end

  describe "#parse_file" do
  let(:dsl){Praegustator::Dsl.new}
    it "should parse and load objects from file with environment defined" do
      suits = dsl.parse_file File.dirname(__FILE__)+"/resources/sample/suits/staging.rb"
      suits.count.should == 3
      first_suite = suits.first
      first_suite.instance_variable_get(:@query).should == "role:web AND chef_environment:staging"
    end

    it "should parse and load objects from file without environment" do
      suits = dsl.parse_file File.dirname(__FILE__)+"/resources/sample/suits/default.rb"
      suits.count.should == 3
      first_suite = suits.first
      first_suite.instance_variable_get(:@query).should == "role:web"
    end

    it "should create testsuits objects with checks" do
      suits = dsl.parse_file File.dirname(__FILE__)+"/resources/sample/suits/staging.rb"
      suits.count.should == 3
      first_suite = suits.first
      checks = first_suite.instance_variable_get(:@checks)
      checks.count.should == 3
    end

    it "should create testsuits objects with options provided" do
      suits = dsl.parse_file File.dirname(__FILE__)+"/resources/sample/suits/staging.rb"
      suits.count.should == 3
      first_suite = suits.first
      checks = first_suite.instance_variable_get(:@checks)
      checks["nginx"].should_not nil
      first_suite.params[:target].should == "10.210.10.1"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
praegustator-0.3.0 spec/praegustator/dsl_spec.rb
praegustator-0.2.0 spec/praegustator/dsl_spec.rb