Я пытаюсь использовать test :: unit для тестирования, а среда, которую я пытаюсь протестировать, требует определенного гема (rhodes)
Может кто-нибудь подсказать, как я могу загрузить драгоценный камень при запуске моих тестов
Обновление :: Сообщение об ошибке
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- rho (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from ../../app/Settings/controller.rb:1
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from ../test_helper.rb:4
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from test_settings.rb:4
Для использования моего модульного теста требуется включить test_helper.rb, который содержит следующее
$: << "../../app"
require 'rubygems'
require 'rhodes'
require 'test/unit'
require 'Settings/controller'
Настройки / контроллер живет в приложении и содержит
require 'rho'
require 'rho/rhocontroller'
require 'rho/rhoerror'
require 'helpers/browser_helper'
class SettingsController < Rho::RhoController
include BrowserHelper
def index
@msg = @params['msg']
render
end
def login
@msg = @params['msg']
render :action => :login, :back => '/app'
end
def login_callback
errCode = @params['error_code'].to_i
if errCode == 0
# run sync if we were successful
WebView.navigate Rho::RhoConfig.options_path
SyncEngine.dosync
else
if errCode == Rho::RhoError::ERR_CUSTOMSYNCSERVER
@msg = @params['error_message']
end
if !@msg || @msg.length == 0
@msg = Rho::RhoError.new(errCode).message
end
WebView.navigate ( url_for :action => :login, :query => {:msg => @msg} )
end
end
def do_login
if @params['login'] and @params['password']
begin
SyncEngine.login(@params['login'], @params['password'], (url_for :action => :login_callback) )
render :action => :wait
rescue Rho::RhoError => e
@msg = e.message
render :action => :login
end
else
@msg = Rho::RhoError.err_message(Rho::RhoError::ERR_UNATHORIZED) unless @msg && @msg.length > 0
render :action => :login
end
end
def logout
SyncEngine.logout
@msg = "You have been logged out."
render :action => :login
end
def reset
render :action => :reset
end
def do_reset
Rhom::Rhom.database_full_reset
SyncEngine.dosync
@msg = "Database has been reset."
redirect :action => :index, :query => {:msg => @msg}
end
def do_sync
SyncEngine.dosync
@msg = "Sync has been triggered."
redirect :action => :index, :query => {:msg => @msg}
end
end