Skip to content

Instantly share code, notes, and snippets.

@beliar91
Created January 28, 2016 11:30
Show Gist options
  • Save beliar91/b930bfbd6aa29f94d3f9 to your computer and use it in GitHub Desktop.
Save beliar91/b930bfbd6aa29f94d3f9 to your computer and use it in GitHub Desktop.
spec/models/task.rb
require 'rails_helper'
RSpec.describe Task, type: :model do
let(:task) {FactoryGirl.create(:task)}
let(:task_created_1) {FactoryGirl.create(:task_created_1)}
let(:task_created_2) {FactoryGirl.create(:task_created_2)}
let(:task_in_progress_1) {FactoryGirl.create(:task_in_progress_1)}
let(:task_in_progress_2) {FactoryGirl.create(:task_in_progress_2)}
it "Counting average execution time should return proper results" do
expect(task_created_2.count_average_execution_time).to eq(40)
expect(task_in_progress_1.count_average_execution_time).to eq(45)
end
it "A valid Task should be saved" do
task.save
expect(task.save).to eq(true)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment