[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: help with running tests for rails using gems



On 06/04/2013 11:07 AM, Praveen A wrote:
2013/6/4 Praveen A <praveen@debian.org>:
Sam,

You can just substitute the package name in the git clone url to get other
packages. So change ruby-shoulda-matchers to ruby-i18n to checkout i18n
debian package repo. Follow the same process for building it.

Praveen

Hi Sam,

Anyway these are already uploaded by Antonio. In any case just to be
clear (I was on a mobile so posting links were difficult)

You already knew repo url of ruby-shoulda-matchers as

git://anonscm.debian.org/pkg-ruby-extras/ruby-shoulda-matchers.git and
if you wanted to get repos of other packages, like the ones Christian
mention he has updated, you can just change the package name in url.
Like if you wanted to checkout i18n you could checkout,

git://anonscm.debian.org/pkg-ruby-extras/ruby-i18n.git

And there is also another tool to make it easier called mr. See
http://wiki.debian.org/Teams/Ruby/Packaging#Obtaining_the_master_repository

And with the changes Christian made, I was able to run rails new
testapp, successfully. Also I had to add rubygems-integration to build
deps, so it could find rails. I also added some more build deps so it
has all the libraries it need to run tests (try git pull and
git-buildpackage again). Now we are back to my original bug where it
is looking to find config/database.yml from the root of the library
rather than the testapp root.

Indeed!

Current status:

1) I can't check out pkg-ruby-extras.git, perhaps still waiting approval?

$ git clone rubys-guest@git.debian.org:/git/pkg-ruby-extras/pkg-ruby-extras.git
Cloning into 'pkg-ruby-extras'...
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

2) I've reproduced the error with a minimal test case that doesn't involve shoulda-matchers:

require 'fileutils'

# build a new application
TESTAPP_ROOT = File.expand_path('testapp')
FileUtils.rm_rf(TESTAPP_ROOT) if File.exists?(TESTAPP_ROOT)
`rails new #{TESTAPP_ROOT}`

# the first line causes the failure, the second line works
require "#{TESTAPP_ROOT}/config/environment"
# Dir.chdir(TESTAPP_ROOT) { require "./config/environment" }

# The following statement requires a properly set up environment
require 'rspec/rails'

3) I've got a potential patch:

diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index ae12d95..eed43b9 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -6,7 +6,7 @@ FileUtils.rm_rf(TESTAPP_ROOT) if File.exists?(TESTAPP_ROOT)
 ENV['RAILS_ENV'] = 'test'
 ENV['BUNDLE_GEMFILE'] ||= TESTAPP_ROOT + '/Gemfile'

-require "#{TESTAPP_ROOT}/config/environment"
+Dir.chdir(TESTAPP_ROOT) { require "./config/environment" }
 require 'bourne'
 require 'shoulda-matchers'
 require 'rspec/rails'

4) I haven't yet figured out how to run this. I keep getting errors about local changes. I'm now off to learn quilt.

http://wiki.debian.org/Diaspora/Packaging/quilt

- Sam Ruby


Reply to: