spec/spec_helper.rb in pidgin2adium-3.3.0 vs spec/spec_helper.rb in pidgin2adium-4.0.0.beta1
- old
+ new
@@ -1,71 +1,29 @@
-require 'fileutils'
+require 'simplecov'
-# Pidgin2Adium.oops and Pidgin2Adium.warn both use warn() to output errors.
-# Setting $-w (the warning level) to nil suppresses them, which makes for
-# much prettier test output.
-$-w=nil # OMGHAX
+$LOAD_PATH.unshift(File.expand_path('..', __FILE__))
+$LOAD_PATH.unshift(File.expand_path('../lib', __FILE__))
-# Wrap it in a lambda so that we can pass it to Spork.prefork, if spork is installed.
-prefork_block = lambda do
- # Loading more in this block will cause your tests to run faster. However,
- # if you change any configuration or code from libraries loaded here, you'll
- # need to restart spork for it take effect.
+require 'pidgin2adium'
+require "fakefs/spec_helpers"
- $LOAD_PATH.unshift(File.dirname(__FILE__))
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'ext', 'balance_tags_c'))
+Dir['spec/support/**/*.rb'].each { |f| require File.expand_path(f) }
- require 'pidgin2adium'
- require 'time' # for Time.zone_offset
+SPEC_ROOT = File.dirname(__FILE__)
- rspec_configure_block = lambda do |config|
- config.before(:all) do
- @current_dir = File.dirname(__FILE__)
- @aliases = %w{gabebw gabeb-w gbw me}.join(',')
- # -7 => "-0700"
- @current_tz_offset = sprintf("%+03d00", Time.zone_offset(Time.new.zone) / 3600)
+RSpec.configure do |config|
+ config.expect_with :rspec do |c|
+ c.syntax = :expect
+ end
- @logfile_path = File.join(@current_dir, "logfiles/")
- @text_logfile_path = "#{@logfile_path}/2006-12-21.223606.txt"
- @htm_logfile_path = "#{@logfile_path}/2008-01-15.071445-0500PST.htm"
- @html_logfile_path = "#{@logfile_path}/2008-01-15.071445-0500PST.html"
-
- @nonexistent_output_dir = File.join(@current_dir, "nonexistent_output_dir/")
- @output_dir = File.join(@current_dir, "output-dir/")
- FileUtils.rm_r(@nonexistent_output_dir, :force => true)
- end
-
- config.after(:all) do
- # Clean up.
- FileUtils.rm_r(@nonexistent_output_dir, :force => true)
- FileUtils.rm_r(@output_dir, :force => true)
- end
+ def path_to_file
+ File.join(path_to_directory, "gabebw", "in.html")
end
- begin
- # RSpec 2
- gem 'rspec', '>= 2.0.0.beta.18'
- require 'rspec'
- RSpec.configure(&rspec_configure_block)
- rescue Gem::LoadError
- # RSpec 1
- gem 'rspec', '~> 1.3'
- require 'spec'
- require 'spec/autorun'
- Spec::Runner.configure(&rspec_configure_block)
+ def path_to_directory
+ File.expand_path("./in-logs/")
end
-end
-begin
- require 'rubygems'
- require 'spork'
- Spork.prefork(&prefork_block)
- Spork.each_run do
- # This code will be run each time you run your specs.
+ def on_travis_ci?
+ ENV['TRAVIS']
end
-rescue LoadError
- puts 'To make the tests run faster, run "sudo gem install spork" then run "spork"'
- puts 'from the base pidgin2adium directory.'
- # Spork isn't installed.
- prefork_block.call
end