Skip to content

Instantly share code, notes, and snippets.

@rockwood
Last active August 29, 2015 13:57
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 rockwood/9419760 to your computer and use it in GitHub Desktop.
Save rockwood/9419760 to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe Assignment do
describe "#percentage" do
specify do
assignment = Assignment.new(score: 5, total: 10)
expect(assignment.percentage).to eq(50)
end
end
describe ".average" do
specify do
assignment1 = Assignment.create(score: 8, total: 10)
assignment2 = Assignment.create(score: 4, total: 10)
expect(Assignment.average_percentage).to eq(60)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment