Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
getfitter-core / spec / core / calories_spec.rb
Size: Mime:
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