Writing helpers with Haml and rSpec

I started using NetBeans recently. And find it’s ruby support superb! (as far as an IDE can go). But there was an error installing gems with their gui manager, medicine and I was wondering how to debug that.

A quick peek into ruby/bin/gem revealed much of what I needed to know.

Lets demonstrate :

Welcome to the JRuby IRB Console

irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> Gem.manage_gems
=> true
irb(main):003:0> gem = Gem::GemRunner.new
=> #
irb(main):004:0> gem.run(['help', health 'commands'])
GEM commands are:

build            Build a gem from a gemspec
cert             Adjust RubyGems certificate settings
check            Check installed gems
=> nil

update: The bug that prevented me from installing gems, turned out to be a _gemrc file that had http_proxy configured. A proxy no longer in use, but since I didn’t use gems all that much on this workstation before – I forgot all about it.

Recently Wolfman posted a description about Rails helpers written with Haml::Helpers#open and rSpec.

I want it to be more DRY than it is, try
since the whole application is using rSpec and Haml, cialis all helpers should have the same before(:each)

So basically – what I did was :

Spec::Runner.configure do |config|
config.with_options :behaviour_type => :helpers do |config|
config.include Haml::Helpers
config.include ActionView::Helpers
config.prepend_before :all do
@haml_is_haml = true
@haml_stack = [Haml::Buffer.new]

Except it will not work, for various reasons.

Hope to solve all the quirks sometime soon. I know this will cost me some sleep.

One thought on “Writing helpers with Haml and rSpec

  1. Did you ever solve the problems with writing helpers and rspec?
    BTW, where do you work? Can you e-mail me?

Leave a Reply

Your email address will not be published. Required fields are marked *