Wolfmans Howlings

A programmers Blog about Programming solutions and a few other issues

RSpec testing all actions of a controller

Posted by Jim Morris on Sat Jul 28 14:23:07 -0700 2007

A pattern I find very helpful is to find all the actions in a controller and apply a test to all those actions.

For instance this is useful for automatically testing all actions are protected from unauthorized access when using a login system.

... Show more ...

Posted in Rails,RSpec  |  Tags rails,rspec,controllers  |  14 comments

Using RSpec to test HAML helpers

Posted by Jim Morris on Sat Jul 14 16:44:33 -0700 2007

UPDATED for HAML 2.0 and RSpec 1.1.5 - Changed open to haml_tag, prefix helper. to all rspec calls...

The most recent release of HAML introduced a neat feature that allows you to use HAML-like syntax in your helpers to generate HTML HAML#haml_tag.

... Show more ...

Posted in HAML,Rails,RSpec  |  Tags test,haml,rspec,helpers  |  9 comments

RSpec testing views for escaped HTML

Posted by Jim Morris on Fri Jul 06 18:22:57 -0700 2007

For my social networking site snowdogsr.us I decided to escape all user input that gets displayed. I know people like to trick out their profiles with HTML but I want to avoid the various hacks that it allows.

So thinking I had done a good job of using h everywhere I output user input fields, I decided to see if I could actually test this with RSpec view tests.

... Show more ...

Posted in Rails,RSpec  |  Tags rails,rspec,escapinghtml  |  4 comments

REST scaffold_resource security warning

Posted by Jim Morris on Tue Jun 26 15:14:04 -0700 2007

This one is so blatantly obvious it bit me in the Butt at 4am this morning when I had to get up and fix it! I am so embarrassed, luckily no private data got out, as no-one has entered any private data yet.

I used the script/generate scaffold_resource to get started, and I left in those nice format.xml things in, thinking I may use them in the future. For the most part this is not a problem, but one of my controllers is a profile table. Much of the data in there is public anyway so no big deal, but a few columns are private data like email, date of birth, phone numbers etc. These are specifically private and not viewable publicly. This is enforced but not having a view that shows any of that stuff to the general public.

... Show more ...

Posted in Rails  |  Tags rails,scaffold_resource  |  4 comments

Developing a social networking site part 3 - tag cloud

Posted by Jim Morris on Sat Jun 23 14:02:49 -0700 2007

This is a simple one.

I use the excellent acts_as_taggable plugin, and I wanted to have a tag cloud like everyone does.

... Show more ...

Posted in Rails  |  Tags rails,tagcloud,acts_as_taggable  |  no comments

Developing a social networking site part 2 - rating stars

Posted by Jim Morris on Sat Jun 23 13:49:25 -0700 2007

In part 1 I outlined my project to implement snowdogsr.us a social networking site for snow dogs.

I am pleased to announce that version 1 of this site is up, however I had to make some trade-offs to get it up this far. I needed to prioritize my goals and just get the essentials implemented.

... Show more ...

Posted in Rails  |  Tags rails,acts_as_rated,stars,rating  |  11 comments

More JEdit macros for rails

Posted by Jim Morris on Thu May 31 13:27:46 -0700 2007

I have been using JEdit more and more for my rails development, I have gone back and forth between it and Epsilon, however JEdit is starting to win out. I have upgraded to the latest pre version (4.3pre9).

I have modified a number of macros to do my bidding, and I dumped the Ruby Plugin because I kept running into things it did that I disliked, and it still seems a little buggy.

... Show more ...

Posted in JEdit,Rails  |  Tags rails,editor,jedit,macros  |  4 comments

Snow Dogs R Us a rails based social networking site

Posted by Jim Morris on Thu May 31 12:59:01 -0700 2007

I have started a new project for myself and a few friends, Snow Dogs R Us. This site just went live! (on 6/20/2007). It is a full blown Web2.0 (insert other buzz words here), social networking site for Snow Dogs and their (human) parents.

It is certainly a challenging project and taking much longer than I anticipated.

... Show more ...

Posted in Rails  |  Tags rails,social,networking,web2.0  |  9 comments

Updated Capistrano local subversion and perforce

Posted by Jim Morris on Sun Feb 18 15:32:14 -0800 2007

I have updated the Capistrano local subversion module and added a perforce one.

The original article is here.

... Show more ...

Posted in Rails  |  Tags capistrano  |  1 comments

Getting beagle compiled on KUbuntu 6.10 edgy

Posted by Jim Morris on Sat Feb 03 22:32:35 -0800 2007

The version of beagle available as a standard package with Ubuntu Edgy 6.10, is horribly buggy and uses a lot of memory (2Gbytes on my machine).

I wanted to build the latest version of Beagle (0.2.15.1) on my system which is actually KUbuntu, and this required a lot of effort! I had to install a bunch of added support libraries for gtk which do not appear to be installed by default on KUbuntu. I downloaded the latest source from here.

... Show more ...

Posted in Linux  |  Tags kubuntu,edgy,beagle  |  1 comments