Skip to content

Instantly share code, notes, and snippets.

View mag's full-sized avatar

Mike Grafton mag

  • Citizen Code
  • Oakland
View GitHub Profile
require 'rubygems'
require 'jazz_money'
javascript_files = [
'public/javascripts/jquery-1.3.2.js',
'public/javascripts/my_js_codes.js',
'spec/javascript/spec_helper.js'
]
jasmine_spec_files = [
# src_files
#
# Return an array of filepaths relative to src_dir to include before jasmine specs.
# Default: []
#
# EXAMPLE:
#
# src_files:
# - lib/source1.js
# - lib/source2.js
require 'rubygems'
require 'jazz_money'
JazzMoney::Runner.from_jasmine_config.call
@post_bodies = []
stub.proxy(Net::HTTP).new do |new_net_http|
stub(new_net_http).request do |request|
if request.method.downcase.to_sym == :post
@post_bodies << request.body
end
end
end
@post_bodies = []
stub.proxy(Net::HTTP).new do |new_net_http|
stub(new_net_http).request do |request|
if request.method.downcase.to_sym == :post
@post_bodies << request.body
end
end
end
The problem with the above is that the two rspec "worlds" get mixed together. Despite passing a separate Options object to
my rpsec builder, it ends up using the same Reporter object as the spec itself! So at the end of the run rspec reports that
it ran 2 specs - the one run by RspecBuilder and the one run by the spec itself.
def add_define(name)
$defs.push("-D#{name}")
end
add_define 'BUILD_FOR_RUBY'
add_define 'HAVE_RBTRAP' if have_var('rb_trap_immediate', ['ruby.h', 'rubysig.h'])
add_define "HAVE_TBR" if have_func('rb_thread_blocking_region')# and have_macro('RUBY_UBF_IO', 'ruby.h')
GNU_CHAIN = true
OS_UNIX = true
add_define 'OS_UNIX'
def test_monthly_distribution
pv_module = sunpower_module
distribution = pv_module.generation_for_month(tmy3_stations(:fake_station), 5, 35, 225)
assert_equal 24, distribution.size
assert_equal 4755.38, distribution[13].precision(2)
assert_equal 36523.42, distribution.sum.precision(2)
end
@mag
mag / test.rb
Created November 24, 2008 04:41
pedroia:jrubytest mag$ jruby calculate_year.rb
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
STARTING 1
STARTING 2
after Foo, thread 1
/Users/mag/dev/jruby-1.1.5/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:428:in `load_missing_constant': Expected /Users/mag/dev/jrubytest/app/models/foo.rb to define Foo (LoadError)
from /Users/mag/dev/jruby-1.1.5/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:77:in `const_missing_with_dependencies'
from /Users/mag/dev/jruby-1.1.5/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:89:in `const_missing'
from calculate_year.rb:11