Sha256: dc2248a2a2e5cc6a241134edbd70aab47b816921ad0ff4ed087ac6de99f31ee9

Contents?: true

Size: 1.14 KB

Versions: 7

Compression:

Stored size: 1.14 KB

Contents

require_relative 'support/spec_helper'

require 'time_distribution/task'
require 'time_distribution/smart_duration'

include TimeDistribution

describe Task do
  describe '#new' do
    it 'works for three arguments' do
      x_subject = 'subject'
      x_time_taken = '10 min'
      x_description = 'interesting description'

      patient = Task.new(x_subject, x_time_taken, x_description)

      patient.subject.must_equal x_subject
      patient.time_taken.must_equal SmartDuration.parse(x_time_taken)
      patient.desc.must_equal x_description
    end
  end
  describe 'to_s' do
    it 'works' do
      x_subject = 'subject'
      x_time_taken = '10 min'
      x_description = 'interesting description'

      patient = Task.new(x_subject, x_time_taken, x_description)

      patient.to_s.must_equal "#{format('%0.2f', (10/60.0))} hours of #{x_subject}: #{x_description}"
    end
  end
  describe 'to_hours' do
    it 'works' do
      x_subject = 'subject'
      x_time_taken = '10 min'
      x_description = 'interesting description'

      patient = Task.new(x_subject, x_time_taken, x_description)

      patient.to_hours.must_equal (10/60.0)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
time_distribution-2.1.3 spec/task_spec.rb
time_distribution-2.1.2 spec/task_spec.rb
time_distribution-2.1.1 spec/task_spec.rb
time_distribution-2.1.0 spec/task_spec.rb
time_distribution-2.0.2 spec/task_spec.rb
time_distribution-2.0.1 spec/task_spec.rb
time_distribution-2.0.0 spec/task_spec.rb