Repository URL to install this package:
|
Version:
4.0.0.pre.3 ▾
|
require 'rails_helper'
RSpec.describe Core::Calories do
let(:test_class) do
Struct.new(:activity_types, :start_time, :end_time) do
include Core::Calories # rubocop:disable RSpec/DescribedClass
end
end
it 'has a calorie count for one activity_type' do
obj = test_class.new(%w(yoga), 1.hour.from_now, 2.hours.from_now)
expect(obj.calories).to eq 360
end
it 'has a calorie count for multiple activity_types' do
obj = test_class.new(%w(yoga elite), 1.hour.from_now, 2.hours.from_now)
expect(obj.calories).to eq 840
end
it 'gracefully handles having no activity_types' do
obj = test_class.new([], 1.hour.from_now, 2.hours.from_now)
expect(obj.calories).to eq 0
end
it 'gracefully handles having unknown activity_types' do
obj = test_class.new(%w(sitting), 1.hour.from_now, 2.hours.from_now)
expect(obj.calories).to eq 0
end
end