Sha256: 794f367f1b38322469ab8af21b5a24d349e65d2035353c0695a8456938b7290c

Contents?: true

Size: 1.28 KB

Versions: 9

Compression:

Stored size: 1.28 KB

Contents

# Copyright (C) 2011  Miho SUZUKI
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
require 'logaling'

require "fileutils"
require 'tmpdir'
require 'stringio'

RSpec.configure do |config|
  def capture(stream)
    begin
      stream = stream.to_s
      eval "$#{stream} = StringIO.new"
      yield
      result = eval("$#{stream}").string
    ensure
      eval("$#{stream} = #{stream.upcase}")
    end

    result
  end

  config.before(:suite) do
    LOGALING_HOME = Dir.mktmpdir
  end

  config.before(:all) do
    @logaling_home = LOGALING_HOME
  end

  config.after(:suite) do
    FileUtils.rm_rf(LOGALING_HOME, :secure => true)
  end

  alias :silence :capture
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
logaling-command-0.2.5 spec/spec_helper.rb
logaling-command-0.2.4 spec/spec_helper.rb
logaling-command-0.2.3 spec/spec_helper.rb
logaling-command-0.2.2 spec/spec_helper.rb
logaling-command-0.2.1 spec/spec_helper.rb
logaling-command-0.2.0 spec/spec_helper.rb
logaling-command-0.1.9 spec/spec_helper.rb
logaling-command-0.1.8 spec/spec_helper.rb
logaling-command-0.1.7 spec/spec_helper.rb