Skip to content

Instantly share code, notes, and snippets.

@beliar91
Created January 30, 2016 20:34
Show Gist options
  • Save beliar91/d96bb4652d8f50726c74 to your computer and use it in GitHub Desktop.
Save beliar91/d96bb4652d8f50726c74 to your computer and use it in GitHub Desktop.
spec/models/task_spec.rb
it "Counting average execution time should return proper results" do
task_1 = Task.create(name: "ABCD", status: "Created", completion_time:30)
task_2 = Task.create(name: "ABCDE", status: "Created", completion_time: 70)
sum_of_completion_time = task_1.completion_time + task_2.completion_time
number_of_tasks = Task.all.count
average_execution_time = sum_of_completion_time / number_of_tasks
expect(average_execution_time).to eq(task_2.count_average_execution_time)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment