rpsec

Stubbing Chained Methods with Rspec

I want to call a named_scope that will only return one record, but the named_scope returns an array, that's not a big deal as I can just chain it with .first: Model.named_scope(param).first and this works, what I am struggling with is how to stub the chained call. Does anyone have a reference or an answer on how I would go about achie...

Using "should" with class methods?

I'm used to making calls such as: new_count.should eql(10) on variables, but how can I do something similar with a class method such as File.directory?(my_path)? Every combination of File.should be_directory(my_path) that I've tried leads to a method missing, as Ruby tries to find "be_directory" on my current object, rather than matc...

Testing an Rspec Controller with assocations

I've got two models: class Solution < ActiveRecord::Base belongs_to :user validates_attachment_presence :software validates_presence_of :price, :language, :title validates_uniqueness_of :software_file_name, :scope => :user_id has_attached_file :software end class User < ActiveRecord::Base acts_as_authentic validates_pr...

Getting spree cart to play nicely with rspec & cucumber

Just setting up spree and wondering how best to setup the project so I can use cucumber and rspec. Thanks evolve ...

Translating Rspec tests to Shoulda

Hello, I have a pre-written Rails app for handling subscription based payments that is currently covered with an Rspec test suite. I'm trying to merge it into a Rails app that is covered using the Shoulda test suite. I'd really hate to have to rewrite all the tests into Shoulda compatible matchers manually, so I was wondering if there m...