Sha256: 94c324d9e19dc7e6d167983bcc0555a4405befc82b7145e7dd7bed9a591e5a71

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

require_relative '../../test_helper'

describe PrayerTimes::CalculationMethods do
  describe "#initialize" do
    subject{PrayerTimes::CalculationMethods.new}
    it {subject.must_respond_to :add}
    it {subject.keys.must_equal subject.class.default_methods.keys}
    it {subject.must_respond_to :[]}
    it {subject.must_respond_to :each}
    it {subject.must_respond_to :keys}
    it {subject.must_respond_to :key?}
    it {subject.must_respond_to :delete}
  end
  

  
  describe  "#add" do
    before do
      @subject = PrayerTimes::CalculationMethods.new
      @settings = {fajr: 16.5, asr: 'Hanafi', isha: '80 min'}
      @offsets = {dhuhr: 2, asr: -1, isha: 3}

      @new = @subject.add("Test", "Testing method", @settings, @offsets)
    end
    it {@new.must_be_instance_of PrayerTimes::CalculationMethod}
    it {@subject["Test"].must_be_same_as @new}
    it {@subject["Test"].settings[:fajr].must_equal 16.5}
    it {@subject["Test"].settings[:asr].must_equal 'Hanafi'}
    it {@subject["Test"].settings[:isha].must_equal '80 min'}
    it {@subject["Test"].offsets[:dhuhr].must_equal 2}
    it {@subject["Test"].offsets[:asr].must_equal -1}
    it {@subject["Test"].offsets[:isha].must_equal 3}
  end
  
  describe "#names" do
    subject{PrayerTimes::CalculationMethods.new}
    it{subject.names.must_equal subject.keys}
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
prayer_times-0.1.0 test/lib/prayer_times/calculation_methods_test.rb