Sha256: 99f25c0229d5ec17e6104644ee23d8e0ad83a220af2191794fa182f23cc6194d

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

# encoding: UTF-8
require 'helper'

describe PrayerTimes::CalculationMethods do
  describe '#initialize' do
    subject { PrayerTimes::CalculationMethods.new }
    it { expect(subject).to respond_to(:add) }
    it { expect(subject.keys).to eq(subject.class.default_methods.keys) }
    it { expect(subject).to respond_to(:[]) }
    it { expect(subject).to respond_to(:each) }
    it { expect(subject).to respond_to(:keys) }
    it { expect(subject).to respond_to(:key?) }
    it { expect(subject).to 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 { expect(@new).to be_a(PrayerTimes::CalculationMethod) }
    it { expect(@subject['Test']).to eq(@new) }
    it { expect(@subject['Test'].settings[:fajr]).to eq(16.5) }
    it { expect(@subject['Test'].settings[:asr]).to eq('Hanafi') }
    it { expect(@subject['Test'].settings[:isha]).to eq('80 min') }
    it { expect(@subject['Test'].offsets[:dhuhr]).to eq(2) }
    it { expect(@subject['Test'].offsets[:asr]).to eq(-1) }
    it { expect(@subject['Test'].offsets[:isha]).to eq(3) }
  end

  describe '#names' do
    subject { PrayerTimes::CalculationMethods.new }
    it { expect(subject.names).to eq(subject.keys) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
prayer_times-0.1.3 spec/prayer_times/calculation_methods_spec.rb