Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shoulda vs Remarkable for rspec and rails

I'm using rspec and cucumber for BBD. Now I'm migrating to rails 3 and rspec 2 and as I could see both of frameworks (shoulda and remarkable) support rails 3 and rspec 2.

I have never used shoulda or remarkable.

What should I prefer to use with rspec: shoulda or remarkable? And why?

like image 816
petRUShka Avatar asked Jun 11 '10 14:06

petRUShka


People also ask

Is there an either-or-relation between Shoulda and RSpec?

I don't see Shoulda and RSpec in an either-or-relation. I use Shoulda as a substitute for RSpec when it comes to single-assertion testing. I really like the Shoulda one-liners, but writing matchers is much easier in RSpec.

How do I choose between test::unit and RSpec?

Here you can choose between Test::Unit, RSpec, Shoulda and so on. The choice is whether you want to do traditional TDD (Test::Unit) or whether you prefer the alternative ways of thinking about specifiying behaviour advocated by developers like David Chemlinsky(RSpec and to some extent Shoulda).

What is Shoulda matchers in Ruby?

Shoulda Matchers is a Ruby testing gem, that provides RSpec- and Minitest-compatible one-liners that test common Rails functionality. These tests would otherwise be much longer, more complex, and error-prone. COACH: Talk about testing and Behavior-Driven Development. 1. Add Shoulda Matchers gem

How do I use Shoulda matchers in rails?

Shoulda Matchers is a great tool to use to create one line tests for common functionality in Rails apps. I use them to test associations and validations within my Rails apps. We can use Shoulda Matchers to write this: These one liners are less error prone and easier to write. So onto the setup!


2 Answers

I think i would go for remarkable, since it is created especially for Rspec. Also it is extremely complete. Whereas Shoulda was created to get the rspec-style matchers inside Test::Unit.

Just my quick 2 cents.

[UPDATE] almost two years later, I am sorry to notice that remarkable is in a dreadful state. For rails 3.x you still have to use beta gems. I hope this will change or improve soon (unlikely), but for the moment I can only advise to use Shoulda.

like image 181
nathanvda Avatar answered Oct 23 '22 20:10

nathanvda


Just an update, since the Rails world moves so fast: Shoulda seems to have garnered three times as many watchers, two times as many forks, and one and half as many contributors. Remarkable's last commit was over a year ago, and shoulda's was within this month. That said the last 5 contributions were basically small bugs or minor touch ups.

like image 23
krainboltgreene Avatar answered Oct 23 '22 20:10

krainboltgreene