Skip to content

Instantly share code, notes, and snippets.

@stevedev
Created February 14, 2014 18:25
Show Gist options
  • Save stevedev/9006256 to your computer and use it in GitHub Desktop.
Save stevedev/9006256 to your computer and use it in GitHub Desktop.
describe "testing mah scopes" do
before do
People.destroy_all
end
let!(:senior) { create(:person, age: 77) }
let!(:teen) { create(:person, age: 16) }
describe ".seniors" do
it "should return all seniors" do
people = Person.seniors.all
people.should include senior
people.should_not include teen
end
end
describe ".teens" do
it "should return seniors again" do
people = Person.teens.all
people.should include teen
people.should_not include senior
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment