Skip to content

Instantly share code, notes, and snippets.

@gmas
Created November 8, 2012 22:41
Show Gist options
  • Save gmas/4042324 to your computer and use it in GitHub Desktop.
Save gmas/4042324 to your computer and use it in GitHub Desktop.
spec_helper.rb
# Defines our constantsPADRINO_ENV = ENV['PADRINO_ENV'] ||= ENV['RACK_ENV'] ||= 'development' unless defined?(PADRINO_ENV)
PADRINO_ROOT = File.expand_path('../..', __FILE__) unless defined?(PADRINO_ROOT)
# Load our dependencies
require 'rubygems' unless defined?(Gem)
require 'bundler/setup'
Bundler.require(:default, PADRINO_ENV)
require_relative '../lib/database'
##
# Enable devel logging
#
Padrino::Logger::Config[:development] = { :log_level => :devel, :stream => :to_file}
# Padrino::Logger::Config[:development][:log_static] = true
#
##
# Add your before load hooks here
#
Padrino.before_load do
end
##
# Add your after load hooks here
#
Padrino.after_load do
end
Padrino.load!
Gm1981:mew-cms $ bundle exec padrino rake spec
=> Executing Rake spec ...
tasks/o_and_o.rake:2:in `<top (required)>': iconv will be deprecated in the future, use String#encode instead.
/Users/george.m/.rvm/rubies/ruby-1.9.3-p286/bin/ruby -S rspec ./spec/models/sqs_queue_processor_spec.rb -fs --color
/Users/george.m/.rvm/gems/ruby-1.9.3-p286@mew_cms/gems/padrino-core-0.10.6/lib/padrino-core/reloader.rb:106:in `block in lock!': undefined method `split' for name(.):XPath::Expression::Name (NoMethodError)
from /Users/george.m/.rvm/gems/ruby-1.9.3-p286@mew_cms/gems/padrino-core-0.10.6/lib/padrino-core/reloader.rb:106:in `map'
from /Users/george.m/.rvm/gems/ruby-1.9.3-p286@mew_cms/gems/padrino-core-0.10.6/lib/padrino-core/reloader.rb:106:in `lock!'
from /Users/george.m/.rvm/gems/ruby-1.9.3-p286@mew_cms/gems/padrino-core-0.10.6/lib/padrino-core/loader.rb:68:in `load!'
from /Users/george.m/Documents/work/mew-cms/config/boot.rb:66:in `<top (required)>'
from /Users/george.m/Documents/work/mew-cms/spec/spec_helper.rb:2:in `require'
from /Users/george.m/Documents/work/mew-cms/spec/spec_helper.rb:2:in `<top (required)>'
from /Users/george.m/Documents/work/mew-cms/spec/models/sqs_queue_processor_spec.rb:1:in `require'
from /Users/george.m/Documents/work/mew-cms/spec/models/sqs_queue_processor_spec.rb:1:in `<top (required)>'
from /Users/george.m/.rvm/gems/ruby-1.9.3-p286@mew_cms/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load' from /Users/george.m/.rvm/gems/ruby-1.9.3-p286@mew_cms/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `block in load_spec_files'
from /Users/george.m/.rvm/gems/ruby-1.9.3-p286@mew_cms/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
from /Users/george.m/.rvm/gems/ruby-1.9.3-p286@mew_cms/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
from /Users/george.m/.rvm/gems/ruby-1.9.3-p286@mew_cms/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
from /Users/george.m/.rvm/gems/ruby-1.9.3-p286@mew_cms/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in `run'
from /Users/george.m/.rvm/gems/ruby-1.9.3-p286@mew_cms/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `block in autorun'
rake aborted!
/Users/george.m/.rvm/rubies/ruby-1.9.3-p286/bin/ruby -S rspec ./spec/models/sqs_queue_processor_spec.rb -fs --color failed
Tasks: TOP => spec => spec:models
(See full trace by running task with --trace)
PADRINO_ENV = 'test' unless defined?(PADRINO_ENV)
require File.expand_path(File.dirname(__FILE__) + "/../config/boot")
RSpec.configure do |conf|
conf.include Rack::Test::Methods
conf.include RSpec::Padrino
conf.around(:each) do |example|
Sequel::Model.db.transaction do
example.call
raise Sequel::Error::Rollback
end
end
end
def app
##
# You can handle all padrino applications using instead:
# Padrino.application
Padrino.application
#SampleActionupdater.tap { |app| }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment