Sha256: e4f114ce874d1410fb4d29c3225d8f749d7ddae4355624df6c2f7401fb9a42a6

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

# encoding: UTF-8
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.2 test/lib/prayer_times/calculation_methods_test.rb