Sha256: 710eb8e56cb41a507faa1330032e998f6990f797e3ee37e97b1880408d926dd3

Contents?: true

Size: 1.51 KB

Versions: 2

Compression:

Stored size: 1.51 KB

Contents

require 'rubygems'
require 'rspec'
require 'serverspec/version'
require 'serverspec/matchers'
require 'serverspec/backend'
require 'serverspec/helper'
require 'serverspec/setup'
require 'serverspec/filter'
require 'serverspec/subject'
require 'serverspec/commands/base'
require 'serverspec/commands/linux'
require 'serverspec/commands/redhat'
require 'serverspec/commands/debian'
require 'serverspec/commands/gentoo'
require 'serverspec/commands/solaris'

RSpec.configure do |c|
  c.include(Serverspec::Helper::RedHat,  :os => :redhat)
  c.include(Serverspec::Helper::Debian,  :os => :debian)
  c.include(Serverspec::Helper::Gentoo,  :os => :gentoo)
  c.include(Serverspec::Helper::Solaris, :os => :solaris)
  c.add_setting :os,            :default => nil
  c.add_setting :host,          :default => nil
  c.add_setting :ssh,           :default => nil
  c.add_setting :sudo_password, :default => nil
  c.before :each do
    if subject == 'value'
      def subject
        Serverspec::Filter.filter_subject example
      end
    end
  end
end

module RSpec
  module Matchers
    module DSL
      class Matcher
        def failure_message_for_should(&block)
          if block.to_s =~ /serverspec\/matchers\/.+\.rb/
            @custom = true
          end
          if @custom
            cache_or_call_cached(:failure_message_for_should, &block)
          else
            message =  "#{example.metadata[:command]}\n"
            message += "#{example.metadata[:stdout]}"
            message
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
serverspec-0.2.24 lib/serverspec.rb
serverspec-0.2.23 lib/serverspec.rb