Permalink
Browse files

WIP: Rails 3.0.7 just freeze in the middle of the test, and keep requ…

…esting to http://localhost:3002/api/v2/projects/abc123/draft_blurbs ... This is taking too long, I should spend some time on something else first.
  • Loading branch information...
1 parent b1fbe52 commit 6bd26a3530b350601e1428e2b7c53cb7eb52ba5f @sikachu sikachu committed Jun 28, 2011
View
@@ -8,7 +8,7 @@ end
appraise "3.1" do
gem "rails", "~> 3.1.0.beta1"
- gem 'sass'
+ gem 'sass-rails'
gem 'coffee-script'
gem 'uglifier'
gem 'jquery-rails'
View
@@ -16,4 +16,5 @@ gem "json"
gem "thin"
gem "i18n", "~> 0.6.0.beta1"
gem "appraisal", "~> 0.3.5", :require => false
+gem "rdoc"
View
@@ -93,6 +93,7 @@ GEM
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.9.2)
+ rdoc (3.6.1)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
@@ -148,6 +149,7 @@ DEPENDENCIES
json
rails (~> 3.0.3)
rake
+ rdoc
rspec (~> 2.3)
ruby-debug
ruby-debug19
View
@@ -3,17 +3,23 @@ require 'bundler/setup'
require 'appraisal'
require 'rake'
require 'rake/testtask'
-require 'rake/rdoctask'
-require 'rake/gempackagetask'
+require 'rdoc/task'
+require 'rubygems/package_task'
require 'cucumber/rake/task'
require 'rspec/core/rake_task'
require 'yard'
desc 'Default: run the specs and features.'
-task :default do
+task :default => [:cleanup, 'appraisal:install'] do
system("rake -s appraisal spec cucumber;")
end
+desc 'cleanup temporary files in tmp/ directory'
+task :cleanup do
+ FileUtils.rm_rf('tmp')
+ FileUtils.mkdir('tmp')
+end
+
desc 'Test the copycopter_client plugin.'
RSpec::Core::RakeTask.new do |t|
t.rspec_opts = ['--color', "--format progress"]
@@ -31,7 +37,7 @@ YARD::Rake::YardocTask.new do |t|
end
eval("$specification = begin; #{IO.read('copycopter_client.gemspec')}; end")
-Rake::GemPackageTask.new($specification) do |package|
+Gem::PackageTask.new($specification) do |package|
package.need_zip = true
package.need_tar = true
end
@@ -17,7 +17,8 @@
GEMS
end
- When "I reset Bundler environment variable"
+ reset_bundler_variables
+ run_simple("bundle install --local") if Rails::VERSION::MAJOR == 3
end
When /^I configure the copycopter client with api key "([^"]*)"$/ do |api_key|
@@ -1,18 +1,34 @@
-BUNDLE_ENV_VARS = %w(RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE)
-ORIGINAL_BUNDLE_VARS = Hash[ENV.select{ |key,value| BUNDLE_ENV_VARS.include?(key) }]
+module AppraisalHelper
+ BUNDLE_ENV_VARS = %w(RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE)
+ ORIGINAL_BUNDLE_VARS = Hash[ENV.select{ |key,value| BUNDLE_ENV_VARS.include?(key) }]
+
+ def setup_appriasal_gemfile
+ ENV['BUNDLE_GEMFILE'] = File.join(Dir.pwd, ENV['BUNDLE_GEMFILE'])
+ end
+
+ def reset_original_bundler_variables
+ ORIGINAL_BUNDLE_VARS.each_pair do |key, value|
+ ENV[key] = value
+ end
+ end
+
+ def reset_bundler_variables
+ BUNDLE_ENV_VARS.each do |key|
+ ENV[key] = nil
+ end
+ end
+end
+
+World(AppraisalHelper)
Before do
- ENV['BUNDLE_GEMFILE'] = File.join(Dir.pwd, ENV['BUNDLE_GEMFILE'])
+ setup_appriasal_gemfile
end
After do
- ORIGINAL_BUNDLE_VARS.each_pair do |key, value|
- ENV[key] = value
- end
+ reset_original_bundler_variables
end
When /^I reset Bundler environment variable$/ do
- BUNDLE_ENV_VARS.each do |key|
- ENV[key] = nil
- end
+ reset_bundler_variables
end
@@ -85,13 +85,14 @@ def post(path, data)
end
def wait_until_responsive
- 60.times do
+ 20.times do
if responsive?
return true
else
sleep(0.5)
end
end
+ stop
raise "Couldn't connect to Rails application server at #{HOST}:#{@port}"
end
@@ -0,0 +1,3 @@
+Before do
+ File.open("tmp/projects.json", "w"){ |f| f.write('{}') }
+end
View
@@ -2,20 +2,21 @@
source "http://rubygems.org"
+gem "ruby-debug", :platforms=>:mri_18
gem "rails", "~> 2.3"
+gem "ruby-debug19", :platforms=>:mri_19
gem "sqlite3-ruby", :require=>false
-gem "rspec", "~> 2.3"
-gem "bourne"
-gem "webmock"
gem "rake"
+gem "bourne"
gem "sham_rack"
-gem "cucumber", "~> 0.10.0"
-gem "sinatra", :require=>false
+gem "rspec", "~> 2.3"
gem "yard", :require=>false
-gem "ruby-debug", :platforms=>:mri_18
-gem "ruby-debug19", :platforms=>:mri_19
-gem "json"
gem "thin"
+gem "sinatra", :require=>false
+gem "json"
+gem "cucumber", "~> 0.10.0"
gem "i18n", "~> 0.6.0.beta1"
gem "appraisal", "~> 0.3.5", :require=>false
+gem "webmock"
+gem "rdoc"
@@ -58,6 +58,7 @@ GEM
rake (>= 0.8.3)
rake (0.9.2)
rbx-require-relative (0.0.5)
+ rdoc (3.6.1)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
@@ -111,6 +112,7 @@ DEPENDENCIES
json
rails (~> 2.3)
rake
+ rdoc
rspec (~> 2.3)
ruby-debug
ruby-debug19
View
@@ -2,20 +2,21 @@
source "http://rubygems.org"
+gem "ruby-debug", :platforms=>:mri_18
gem "rails", "~> 3.0.3"
+gem "ruby-debug19", :platforms=>:mri_19
gem "sqlite3-ruby", :require=>false
-gem "rspec", "~> 2.3"
-gem "bourne"
-gem "webmock"
gem "rake"
+gem "bourne"
gem "sham_rack"
-gem "cucumber", "~> 0.10.0"
-gem "sinatra", :require=>false
+gem "rspec", "~> 2.3"
gem "yard", :require=>false
-gem "ruby-debug", :platforms=>:mri_18
-gem "ruby-debug19", :platforms=>:mri_19
-gem "json"
gem "thin"
+gem "sinatra", :require=>false
+gem "json"
+gem "cucumber", "~> 0.10.0"
gem "i18n", "~> 0.6.0.beta1"
gem "appraisal", "~> 0.3.5", :require=>false
+gem "webmock"
+gem "rdoc"
@@ -95,6 +95,7 @@ GEM
thor (~> 0.14.4)
rake (0.9.2)
rbx-require-relative (0.0.5)
+ rdoc (3.6.1)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
@@ -152,6 +153,7 @@ DEPENDENCIES
json
rails (~> 3.0.3)
rake
+ rdoc
rspec (~> 2.3)
ruby-debug
ruby-debug19
View
@@ -2,24 +2,25 @@
source "http://rubygems.org"
+gem "jquery-rails"
+gem "uglifier"
+gem "ruby-debug", :platforms=>:mri_18
gem "rails", "~> 3.1.0.beta1"
+gem "ruby-debug19", :platforms=>:mri_19
+gem "sass-rails"
gem "sqlite3-ruby", :require=>false
-gem "rspec", "~> 2.3"
-gem "bourne"
-gem "webmock"
gem "rake"
+gem "coffee-script"
+gem "bourne"
gem "sham_rack"
-gem "cucumber", "~> 0.10.0"
-gem "sinatra", :require=>false
+gem "rspec", "~> 2.3"
gem "yard", :require=>false
-gem "ruby-debug", :platforms=>:mri_18
-gem "ruby-debug19", :platforms=>:mri_19
-gem "json"
gem "thin"
+gem "sinatra", :require=>false
+gem "json"
+gem "cucumber", "~> 0.10.0"
gem "i18n", "~> 0.6.0.beta1"
gem "appraisal", "~> 0.3.5", :require=>false
-gem "sass"
-gem "coffee-script"
-gem "uglifier"
-gem "jquery-rails"
+gem "webmock"
+gem "rdoc"
@@ -139,6 +139,11 @@ GEM
ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2)
sass (3.1.3)
+ sass-rails (3.1.0.rc.3)
+ actionpack (~> 3.1.0.rc1)
+ railties (~> 3.1.0.rc1)
+ sass (>= 3.1.3)
+ sprockets (>= 2.0.0.beta.9)
sham_rack (1.3.3)
rack
sinatra (1.2.6)
@@ -182,10 +187,11 @@ DEPENDENCIES
json
rails (~> 3.1.0.beta1)
rake
+ rdoc
rspec (~> 2.3)
ruby-debug
ruby-debug19
- sass
+ sass-rails
sham_rack
sinatra
sqlite3-ruby
@@ -61,7 +61,7 @@ def download
# @raise [ConnectionError] if the connection fails
def upload(data)
connect do |http|
- response = http.post(uri("draft_blurbs"), data.to_json)
+ response = http.post(uri("draft_blurbs"), data.to_json, "Content-Type" => "application/json")
check(response)
log("Uploaded missing translations")
end
@@ -44,7 +44,7 @@ def build_client_with_project(config = {})
project = add_project
client = build_client(:api_key => project.api_key, :secure => true)
client.download { |ignore| }
- http.use_ssl.should == true
+ http.should be_use_ssl
http.verify_mode.should == OpenSSL::SSL::VERIFY_PEER
http.ca_file.should == CopycopterClient::Configuration::CA_FILE
end
@@ -53,7 +53,7 @@ def build_client_with_project(config = {})
project = add_project
client = build_client(:api_key => project.api_key, :secure => false)
client.download { |ignore| }
- http.use_ssl.should == false
+ http.should_not be_use_ssl
end
it "wraps HTTP errors with ConnectionError" do
@@ -3,9 +3,12 @@
require 'thin'
class FakeCopycopterApp < Sinatra::Base
+ set :show_exceptions, false
+
def self.start
fake_copycopter_pid = fork do
- Thin::Logging.silent = true
+ Thin::Logging.trace = true
+ Thin::Logging.debug = true
Rack::Handler::Thin.run(self, :Port => port)
end

0 comments on commit 6bd26a3

Please sign in to comment.