Skip to content

Instantly share code, notes, and snippets.

@skwp
Created October 30, 2013 03:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skwp/7226954 to your computer and use it in GitHub Desktop.
Save skwp/7226954 to your computer and use it in GitHub Desktop.
A matcher for ActiveRelation scopes.
RSpec::Matchers.define :be_scoped_by do |scope_hash|
match do |scope|
scope.where_values_hash.should == scope_hash
end
end
it "finds orders for local pickup" do
orders.local_pickups.should be_scoped_by({ "shipping_method" => "local", "status" => "paid" })
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment