Thinking on Rails views

Posted by yrashk on May 07, 2007

I’ve had some fun toying with Rails views techniques. Russian translation is available.

JRuby: Unicode out-of-box

Posted by yrashk on March 06, 2007

I’ve started playing with JRuby 0.9.8. I personally think that it has great potential for web development in Rails (they have 98% of rails tests passing already !).

What I was pleased to see is that (thanks to Java) unicode is working in JRuby just fine without any workarounds like String#chars :

That’s very, very good! Continuing to explore JRuby possibilities.

RSpec Generated Spec Name for "be"

Posted by yrashk on March 02, 2007

I was talking about generated spec names few hours ago. Although, I’ve found that they simply don’t work properly with “be” matchers. I’ve tried to produce a quick workaround for this. That’s what I’ve created:

 
gem 'activesupport'
require 'active_support'

class Spec::Matchers::Be
  def description
     "be #{@comparison}#{@expected} #{@args.to_sentence}" 
  end
end
 

Now I can run following code:

 
context "Random number in 0..100 range" do 

  setup do
    @random_number = rand(100)
  end

  specify do
    @random_number.should be < 100
  end

  specify do
    @random_number.should be >= 0
  end

  specify do
    @random_number.should_not be_nil
  end

  specify do
    @random_number.should be_between(0,100)
  end

  specify do
    @random_number.should_not be_between(100,200)
  end

end
 

and get this as output:

Random number in 0..100 range
- should be < 100 
- should be >= 0 
- should not be nil 
- should be between 0 and 100
- should not be between 100 and 200

Update: This improvement was included into rspec trunk

New (experimental) Caches.rb

Posted by yrashk on February 28, 2007

New (experimental) Caches.rb

Caches.rb

  • was refactored a bit
  • supports caching across rails models now