Web development blog

Tag: rspec

Ultimate rspec matcher to test named_scope or scoped

Jul.11, 2010

After having a good practice on using Ultimate rspec matcher to test validation I think it’s time to implement one for testing named scopes - custom finders. Testing these finders is daily task. Here is how it can be done with minimum amount of code and maximum readability. (continue reading…)
1 Comment :, , , , more...

Ultimate rspec matcher to test validation

Jun.30, 2010

After a first thousand of tests using Rspec I fount it very annoying to repeat my self testing the standard code as spec code is usually twice longer than code it test. I’ve started to look for a way to simplify the patterns and make it reusable. Among other nice rspec tricks there is possibility to write custom Rspec matchers. Spec the validation is just two lines of code for each attribute now. (continue reading…)
3 Comments :, , , , more...

Objects behaviour inheritance with RSpec

Oct.27, 2009

About half of a year ago I was writing about object interface and Liskov Substitution Princeple. In short: Any class instance that extends the base class should pass all unit tests behaviour tests written for base class instance. It was a surprise for me that this concept has already been implemented in RSpec.

(continue reading…)
3 Comments :, , , , more...

The Content of this blog can be published anywhere with the link to original source.