jump to navigation

Find missing RSpec view tests March 16, 2009

Posted by John Dewey in Code, Rake, RSpec.
2 comments

I created a quick little rake task which finds missing RSpec view tests. It assumes the extension is .haml, however, this can be overridden with the EXTENSION environment variable.

rake spec:missing_view_templates
or
EXTENSION=erb rake spec:missing_view_templates 
Advertisements

icanhasrspec – lolspek sneak peek February 17, 2009

Posted by John Dewey in Example, RSpec.
2 comments

mah frend reid addd lolspeak 2 rspec. i am bloggin dis as wai 2 persuade him 2 post hims gist. 🙂

updat0rz: teh gist addded – kthxbye

Am I rspec-tarded? December 29, 2008

Posted by John Dewey in Code, Example, RSpec, Ruby.
1 comment so far

So I want to test the xml declaration and xhtml doctype of my application layout.

I ended up with this pastie.
Does anyone know of a way to accomplish this using rspec‘s have_tag/with_tag? I’m not too fond of the regexp solution in the pastie.

Coverage Nagging October 10, 2008

Posted by John Dewey in Code, Command Line, Example, Rails, RSpec.
add a comment

I like to keep an eye on my coverage every so often. I run the following in my applications root, for occasional coverage reminders.

while : ; do rake spec:rcov ; open coverage/index.html; sleep 3600 ; done

Reloading classes in RSpec August 11, 2008

Posted by John Dewey in Code, Example, RSpec, Ruby.
1 comment so far

I had a class where methods could change a class variable’s structure on load. However, RSpec doesn’t reload a class, so testing
these methods is difficult.

One can reload a class inside RSpec by adding a before task:

describe SimplyTabby, "remove_system_information class method" do
  before(:each) do
    Object.send(:remove_const, 'Clazz')
    load 'clazz.rb'
  end

  it "should ..."
	...
  end
end