Skip to content

Instantly share code, notes, and snippets.

View dchelimsky's full-sized avatar

David Chelimsky dchelimsky

  • Retired
  • Chicago, IL, USA
View GitHub Profile
script/spec spec
./script/../config/environments/test.rb:7: undefined local variable or method `config' for main:Object (NameError)
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.1/lib/active_support/dependencies.rb:156:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.1/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.1/lib/active_support/dependencies.rb:156:in `require'
from script/spec:4
...
config.gem 'rspec-rails', :lib => false, :version => '1.2.0'
config.gem 'rspec', :lib => false, :version => '1.2.0'
end
#!/usr/bin/env ruby
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
ENV['RAILS_ENV'] ||= 'test'
require File.join(File.dirname(__FILE__), "/../config/environment")
require 'spec/autorun'
exit ::Spec::Runner::CommandLine.run
def site_with_recursive_search
site_without_recursive_search || parent.site
end
alias_method_chain :site, :recursive_search
OR
alias_method :site_without_recursive_search, :site
def site_with_recursive_search
class Example
def foo; puts "foo"; end
def bar; puts "bar"; end
def foo_with_bar
foo_without_bar
bar
end
end
commit 5f38b3bccf4d85c48dc965937d76ad4f2a7e67ca
Author: David Chelimsky <[email protected]>
Date: Sun Mar 15 18:05:19 2009 -0500
add failing examples that should controller_name seems to have stopped working
diff --git a/spec/spec/rails/example/controller_example_group_spec.rb b/spec/spec/rails/example/controller_example_group_spec.rb
index 53bc737..364c2ea 100644
--- a/spec/spec/rails/example/controller_example_group_spec.rb
+++ b/spec/spec/rails/example/controller_example_group_spec.rb
t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
1) Failure:
test_assert_emails_too_few_sent(TestHelperMailerTest)
[./test/test_helper_test.rb:87:in `test_assert_emails_too_few_sent'
/Users/david/projects/ruby/rails/actionmailer/test/../../activesupport/lib/active_support/testing/setup_and_teardown.rb:62:in `__send__'
/Users/david/projects/ruby/rails/actionmailer/test/../../activesupport/lib/active_support/testing/setup_and_teardown.rb:62:in `run']:
<MiniTest::Assertion> exception expected but was
Class: <Test::Unit::AssertionFailedError>
Message: <"2 emails expected, but 1 were sent.\n<2> expected but was\n<1>.">
---Backtrace---
/Users/david/projects/ruby/rails/actionmailer/test/../lib/action_mailer/test_helper.rb:30:in `assert_emails'
# doesn't work for everything - just a proof of concept
module Expect
def expect(actual, matcher)
unless matcher.matches?(actual)
raise Spec::Expectations::ExpectationNotMetError.new(matcher.failure_message_for_should)
end
end
end
require 'rubygems'
require 'spec'
class MyExampleGroup < Spec::ExampleGroup
before(:each) do
puts "in before(:each)"
my_custom_method
end
class << self