Testing for class methods in Ruby
How do you test for the existence of a class method? Test it using #respond_to?
class Foo def self.bar puts "Hello, World!" end end Foo.respond_to?(:bar) => true
And to make sure we are really just talking about class methods and not instance methods:
foo = Foo.new foo.respond_to?(:bar) => false
RubyMine and Rspec2 Bug Fixed!
We use the latest and greatest RubyMine version available at Pivotal, but sometimes technology choices such as Rails 3 and Rspec 2 are still ahead of it. The formatter that analyzes test output breaks on Rspec 2’s output before any tests run. The bug is further discussed http://youtrack.jetbrains.net/issue/RUBY-6485. Luckily this bug will be fixed in the next EAP release.
Excuting .rvmrc commands and cruisecontrol
We’ve had a difficult time getting .rvmrc files to work with cruisecontrol.rb builds. Specifically, ccrb seems to launch the rake task in the project working directory. This means that the .rvmrc file is ignored. A workaround is to have your CI script directly use RVM or to add “
cd .. && cd work” before your project cruise script or rake task.