spec/spec_helper.rb in wordless-0.4.0 vs spec/spec_helper.rb in wordless-0.4.1

- old
+ new

@@ -8,37 +8,35 @@ def info(message); end def success(message); end end end -RSpec.configure do |config| +module Wordless + class WordlessCLI + def error(message) + puts message + end + end +end +require 'support/capture' + +WP_API_RESPONSE = <<-EOF + upgrade + http://wordpress.org/download/ + http://wordpress.org/wordpress-3.6.zip + 3.6 + en_US + 5.2.4 + 5.0 +EOF + +RSpec.configure do |config| config.before(:all) do FileUtils.mkdir('tmp') unless File.directory? 'tmp' FakeWeb.allow_net_connect = false - WP_API_RESPONSE = <<-eof - upgrade - http://wordpress.org/download/ - http://wordpress.org/wordpress-3.6.zip - 3.6 - en_US - 5.2.4 - 5.0 - eof + FakeWeb.register_uri(:get, %r|http://api.wordpress.org/core/version-check/1.5/.*|, :body => WP_API_RESPONSE) FakeWeb.register_uri(:get, "http://wordpress.org/wordpress-3.6.zip", :body => File.expand_path('spec/fixtures/wordpress_stub.zip')) end - - # utility to log commands output or errors - 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 end +