View test_timestamp.rb
require 'rubygems' | |
require 'sequel' | |
if defined? JRUBY_VERSION | |
DB = Sequel.connect( 'jdbc:sqlite::memory:' ) | |
else | |
DB = Sequel.sqlite | |
end | |
DB.create_table :things do |
View gist:330794
# comment for blog post: | |
# http://lucidcode.co.nz/blog/archives/2010/03/02/testing-email-delivery-in-rails-with-gmail-httparty/ | |
it "sends a notification email after the model is created" do | |
subject = "email notification test #{Time.now}" | |
flexmock( Model ).new_instances.should_receive( :subject => subject ) | |
create_model_successfully | |
notify = nil | |
10.times do |
View build_configuration.rb
configuration do |c| | |
c.project_name = "HelloRawr" | |
c.output_dir = 'package' | |
c.main_ruby_file = 'hello' | |
c.source_dirs = ['lib'] | |
c.source_exclude_filter = [] | |
c.compile_ruby_files = true | |
c.target_jvm_version = 1.5 |
View 0001-Added-missing-Digest.hexencode-spec.patch
require File.expand_path('../../../spec_helper', __FILE__) | |
require 'digest' | |
describe "Digest.hexencode" do | |
before(:each) do | |
@string = 'sample string' | |
@encoded = "73616d706c6520737472696e67" | |
end | |
it "returns a hex-encoded version of a string" do |
View file_spec.rb
require File.expand_path('../../../../spec_helper', __FILE__) | |
require File.expand_path('../shared/constants', __FILE__) | |
describe "Digest::MD5.file" do | |
describe "when passed a path to a file that exists" do | |
before :each do | |
@file = tmp("md5_temp") | |
touch(@file) {|f| f.write MD5Constants::Contents } | |
end |
View test_get.rb
require 'net/http' | |
require 'uri' | |
puts 'before' ; gets | |
Net::HTTP.get_response( URI("http://google.com") ) | |
puts 'after' ; gets | |
GC.start |
View test_com_error2.rb
require 'win32ole' | |
# Also possible using Daniel Berger's excellent windows-pr gem. | |
require 'Win32API' | |
CoInitialize = Win32API.new('ole32', 'CoInitialize', 'P', 'L') | |
threads = [] | |
3.times do | |
threads << Thread.new do | |
begin |
View httparty spec failure with jruby
phiggins@lihnucks ~/work/httparty/head $ rvm ruby-1.8.7,jruby-1.5.0,jruby-head rake spec | |
ruby-1.8.7-p249: ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux] | |
(in /home/phiggins/work/httparty/head) | |
/home/phiggins/.rvm/gems/ruby-1.8.7-p249/gems/jeweler-1.4.0/lib/jeweler/commands/check_dependencies.rb:13:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement | |
All dependencies seem to be installed. | |
warning: HTTParty depends on version 0.1.7 of crack, not 0.1.6. | |
Example disabled: should allow hashes to be accessed with dot notation | |
Example disabled: should allow nested hashes to be accessed with dot notation |
View persistent_party.rb
require 'httparty' | |
require 'net/http/persistent' | |
module HTTParty | |
module ClassMethods | |
def persistent(value = true) | |
if value | |
default_options[:persistent] ||= Net::HTTP::Persistent.new 'httparty' | |
else | |
default_options[:persistent] = nil |
OlderNewer