prayer_times 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e89b6c2230b659b3b2fd707ba5a3c194d65033b
4
- data.tar.gz: faa3a09be325715ae026b46db68843e541621e28
3
+ metadata.gz: 23668ebb639089cdf8451c9c5ffa42702358680a
4
+ data.tar.gz: cc3dbd842147e4913521cd9ca5f569137bde6075
5
5
  SHA512:
6
- metadata.gz: 8e9e13fe01d692a5cd75b7ee19f3a88073828a2a434c3968bb3db95412dac5b043e8f972cee7090440ce93f5dd2c4e981f8050b766376ff654bb615d2e978c6d
7
- data.tar.gz: c8a69236937c91491578b4f27d54e7807c106c6ac1603dfa7512a959407e09d5100a0ec9f029a4082ebe1e162494757f22580624f3173273f133bb59db7c22ce
6
+ metadata.gz: 7374364717287c1dc0edd83b2f96325c57d50496b3dc59e8c9b8f98c67a2fd4e74a67dccdde8e2d435e6782e28dfd5cd96ed9c399dfef821415e8255f1f2feb3
7
+ data.tar.gz: 76e797a4aa71a5662ba2b8bdc0c1831a2627073abd7a51c7b2a223845c2c97a64f7624d7955d55140e592c361b341497a3cb0bcd068f3ec1b21aee36aa1e0685
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format Nc
3
+ --format=doc
@@ -1,7 +1,23 @@
1
+ bundler_args: --without development
1
2
  language: ruby
2
3
  rvm:
3
- - 1.9.3
4
4
  - 1.9.2
5
+ - 1.9.3
6
+ - 2.0.0
7
+ - 2.1
8
+ - rbx-2
5
9
  - jruby-19mode
6
10
  - ruby-head
7
11
  - jruby-head
12
+ matrix:
13
+ include:
14
+ - rvm: jruby-19mode
15
+ env: JRUBY_OPTS="$JRUBY_OPTS --debug"
16
+ - rvm: jruby-head
17
+ env: JRUBY_OPTS="$JRUBY_OPTS --debug"
18
+ allow_failures:
19
+ - rvm: jruby-19mode
20
+ - rvm: jruby-head
21
+ - rvm: rbx-2
22
+ - rvm: ruby-head
23
+ fast_finish: true
@@ -0,0 +1,5 @@
1
+ --no-private
2
+ --markup markdown
3
+ -
4
+ README.md
5
+ LICENSE.md
data/Gemfile CHANGED
@@ -1,4 +1,30 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in prayer_times.gemspec
3
+ gem 'jruby-openssl', :platforms => :jruby
4
+ gem 'rake'
5
+ gem 'yard'
6
+
7
+ group :development do
8
+ gem 'pry'
9
+ gem 'pry-remote'
10
+ gem 'pry-nav'
11
+ platforms :ruby_19, :ruby_20, :ruby_21 do
12
+ gem 'redcarpet'
13
+ end
14
+ end
15
+
16
+ group :test do
17
+ gem 'coveralls', '~> 0.7', :require => false
18
+ gem 'rspec', '>= 2.14'
19
+ gem 'rspec-nc'
20
+ gem 'rubocop', '>= 0.2', :platforms => [:ruby_19, :ruby_20, :ruby_21]
21
+ gem 'simplecov', '~> 0.9', :require => false
22
+ if RUBY_VERSION >= "1.9.3"
23
+ gem 'guard', '~> 2.6'
24
+ gem 'guard-rspec', '~> 4.2'
25
+ end
26
+ end
27
+
28
+
29
+ # Specify your gem's dependencies in feedlr.gemspec
4
30
  gemspec
@@ -0,0 +1,5 @@
1
+ guard 'rspec' do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/prayer_times/#{m[1]}_spec.rb" }
4
+ watch('spec/helper.rb') { "spec" }
5
+ end
File without changes
data/README.md CHANGED
@@ -45,7 +45,7 @@ There are [several methods](https://github.com/Startappz/prayer_times/wiki/Calcu
45
45
  ```ruby
46
46
  PrayerTimes.calculation_methods
47
47
  PrayerTimes.calculation_methods.names
48
- PrayerTimes.calculation_methods.add("Test", "Testing method", fajr: 16.5, asr: 'Hanafi', isha: '80 min')
48
+ PrayerTimes.calculation_methods.add("Test", "Testing method", fajr: 16.5, asr: 'Hanafi', isha: '80 min')
49
49
  new_method = PrayerTimes.calculation_methods["Test"]
50
50
  new_method.description = "new description"
51
51
  new_method.settings = {fajr: 19.5, isha: '33 min'}
@@ -70,7 +70,7 @@ pt = PrayerTimes.new("Makkah", options)
70
70
 
71
71
  ## Help
72
72
 
73
- Your help is appreciated, specially in adjusting the calculation methods and making them more accurate.
73
+ Your help is appreciated, specially in adjusting the calculation methods and making them more accurate.
74
74
  Your contribution is welcome.
75
75
 
76
76
  ## Contributing
data/Rakefile CHANGED
@@ -1,11 +1,10 @@
1
- require "bundler/gem_tasks"
2
- require 'rake/testtask'
3
-
4
- Rake::TestTask.new do |t|
5
- t.libs << 'lib/prayer_times'
6
- t.test_files = FileList['test/lib/prayer_times/*_test.rb']
7
- t.verbose = true
1
+ require 'rspec/core/rake_task'
2
+ require 'bundler/gem_tasks'
3
+
4
+ # Default directory to look in is `/specs`
5
+ # Run with `rake spec`
6
+ RSpec::Core::RakeTask.new(:spec) do |task|
7
+ task.rspec_opts = ['--color', '--format', 'doc']
8
8
  end
9
-
10
- task :default => :test
11
9
 
10
+ task :default => :spec
@@ -1,24 +1,25 @@
1
1
  # encoding: UTF-8
2
2
  require 'date'
3
3
  require 'forwardable'
4
- require_relative "prayer_times/version"
5
- require_relative "prayer_times/constants"
6
- require_relative "prayer_times/math_helpers"
7
- require_relative "prayer_times/calculation_method"
8
- require_relative "prayer_times/calculation_methods"
9
- require_relative "prayer_times/setters"
10
- require_relative "prayer_times/calculator"
11
- require_relative "prayer_times/calculation"
4
+ require_relative 'prayer_times/version'
5
+ require_relative 'prayer_times/constants'
6
+ require_relative 'prayer_times/math_helpers'
7
+ require_relative 'prayer_times/calculation_method'
8
+ require_relative 'prayer_times/calculation_methods'
9
+ require_relative 'prayer_times/setters'
10
+ require_relative 'prayer_times/calculator'
11
+ require_relative 'prayer_times/calculation'
12
12
 
13
13
  module PrayerTimes #:nodoc:
14
14
  class << self
15
15
  include Setters
16
16
 
17
17
  attr_reader :iterations_count, :times_names, :calculation_methods,
18
- :calculation_method,:time_format, :time_suffixes,:times_offsets,
18
+ :calculation_method, :time_format, :time_suffixes, :times_offsets,
19
19
  :invalid_time
20
+
20
21
  # @see Calculator initializer
21
- def new(calc_method=@calucation_method,opts={})
22
+ def new(calc_method = @calucation_method, opts = {})
22
23
  PrayerTimes::Calculator.new(calc_method, opts)
23
24
  end
24
25
 
@@ -28,8 +29,8 @@ module PrayerTimes #:nodoc:
28
29
 
29
30
  def set_attributes
30
31
  attrs = [:iterations_count, :times_names, :time_format,
31
- :time_suffixes,:times_offsets, :invalid_time]
32
- attrs.each {|attr| self.send "#{attr}=", nil}
32
+ :time_suffixes, :times_offsets, :invalid_time]
33
+ attrs.each { |attr| send "#{attr}=", nil }
33
34
 
34
35
  @calculation_methods = CalculationMethods.new
35
36
 
@@ -38,5 +39,4 @@ module PrayerTimes #:nodoc:
38
39
  end
39
40
 
40
41
  set_attributes
41
-
42
42
  end
@@ -44,8 +44,8 @@ module PrayerTimes
44
44
  Calculation.new(self,
45
45
  date,
46
46
  coords,
47
- time_zone + (dst.nil? ? 0 : 1)).
48
- compute
47
+ time_zone + (dst.nil? ? 0 : 1))
48
+ .compute
49
49
  end
50
50
 
51
51
  private
@@ -32,16 +32,16 @@ module PrayerTimes
32
32
  @time_format = '24h'
33
33
 
34
34
  # Determines the accepted time format values
35
- @accepted_time_formats = ['12h','24h','12hNS','Float']
35
+ @accepted_time_formats = %w(12h 24h 12hNS Float)
36
36
 
37
37
  # Times suffixes names to be displayed
38
- @time_suffixes= {:am => 'AM', :pm => 'PM'}
38
+ @time_suffixes = { am: 'AM', pm: 'PM' }
39
39
 
40
40
  # What to display when the time is invalid
41
- @invalid_time= '-----'
41
+ @invalid_time = '-----'
42
42
 
43
43
  # Time offsets
44
- @times_offsets = @times_names.keys.inject({}){ |h,k| h.merge!(k => 0)}
44
+ @times_offsets = @times_names.keys.reduce({}) { |a, e| a.merge!(e => 0) }
45
45
 
46
46
  class << self
47
47
  attr_reader :iterations_count, :times_names,
@@ -7,7 +7,8 @@ module PrayerTimes
7
7
  # @param [Integer] num
8
8
  # 0 < num < 6
9
9
  def iterations_count=(num)
10
- @iterations_count = if (Constants.accepted_iterations_count_range).include?(num)
10
+ @iterations_count =
11
+ if (Constants.accepted_iterations_count_range).include?(num)
11
12
  num
12
13
  else
13
14
  const_class.iterations_count
@@ -21,7 +22,8 @@ module PrayerTimes
21
22
  # '12hNS': 12-hour format with no suffix,
22
23
  # 'Float': floating point number
23
24
  def time_format=(format)
24
- @time_format = if Constants.accepted_time_formats.include?(format)
25
+ @time_format =
26
+ if Constants.accepted_time_formats.include?(format)
25
27
  format
26
28
  else
27
29
  const_class.time_format
@@ -37,28 +39,29 @@ module PrayerTimes
37
39
  # Sets times suffixes
38
40
  # @param [Hash] suffixes
39
41
  def time_suffixes=(suffixes)
40
- s = suffixes.reject{|k,v| !(const_class.time_suffixes.key?(k) and v.is_a?(String))} rescue {}
42
+ s = suffixes.reject { |k, v| !(const_class.time_suffixes.key?(k) && v.is_a?(String)) } rescue {}
41
43
  @time_suffixes = const_class.time_suffixes.merge(s)
42
44
  end
43
45
 
44
46
  # Sets times names
45
47
  # @param [Hash] names
46
48
  def times_names=(names)
47
- s = names.reject{|k,v| !(const_class.times_names.key?(k) and v.is_a?(String))} rescue {}
49
+ s = names.reject { |k, v| !(const_class.times_names.key?(k) && v.is_a?(String)) } rescue {}
48
50
  @times_names = const_class.times_names.merge(s)
49
51
  end
50
52
 
51
53
  # Sets times offsets
52
54
  # @param [Hash] offsets
53
55
  def times_offsets=(offsets)
54
- s = offsets.reject{|k,v| !(const_class.times_offsets.key?(k) and v.is_a?(Numeric))} rescue {}
56
+ s = offsets.reject { |k, v| !(const_class.times_offsets.key?(k) && v.is_a?(Numeric)) } rescue {}
55
57
  @times_offsets = const_class.times_offsets.merge(s)
56
58
  end
57
59
 
58
- # Sets calculation method and the corresponding settings
60
+ # Sets calculation method && the corresponding settings
59
61
  # @param [String] calc_method the method name
60
62
  def calculation_method=(calc_method)
61
- @calculation_method = if PrayerTimes.calculation_methods.key?(calc_method)
63
+ @calculation_method =
64
+ if PrayerTimes.calculation_methods.key?(calc_method)
62
65
  const_class.calculation_methods[calc_method]
63
66
  else
64
67
  PrayerTimes.calculation_method
@@ -1,5 +1,6 @@
1
1
  # encoding: UTF-8
2
+ # PrayerTimes namespace module
2
3
  module PrayerTimes
3
4
  # Determines the version of this gem
4
- VERSION = "0.1.2"
5
- end
5
+ VERSION = '0.1.3'
6
+ end
@@ -4,23 +4,17 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'prayer_times/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "prayer_times"
7
+ spec.name = 'prayer_times'
8
8
  spec.version = PrayerTimes::VERSION
9
- spec.authors = ["Khaled alHabache"]
10
- spec.email = ["khellls@gmail.com"]
9
+ spec.authors = ['Khaled alHabache']
10
+ spec.email = ['khellls@gmail.com']
11
11
  spec.description = %q{Calculates Muslim prayers times in given settings}
12
12
  spec.summary = %q{Muslim prayers times calculator}
13
- spec.homepage = "https://github.com/Startappz/prayer_times/"
14
- spec.license = "GNU LGPL v3.0"
15
-
13
+ spec.homepage = 'https://github.com/Startappz/prayer_times/'
14
+ spec.license = 'GNU LGPL v3.0'
15
+ spec.required_ruby_version = '>= 1.9.2'
16
16
  spec.files = `git ls-files`.split($/)
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
-
21
- spec.add_development_dependency "bundler", "~> 1.3"
22
- spec.add_development_dependency "rake"
23
- spec.add_development_dependency "minitest"
24
- spec.add_development_dependency "coveralls"
25
-
18
+ spec.test_files = Dir.glob('spec/**/*')
19
+ spec.require_paths = ['lib']
26
20
  end
@@ -0,0 +1,29 @@
1
+ require 'rspec'
2
+ require 'simplecov'
3
+ require 'coveralls'
4
+
5
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
6
+ SimpleCov::Formatter::HTMLFormatter,
7
+ Coveralls::SimpleCov::Formatter
8
+ ]
9
+
10
+ SimpleCov.start do
11
+ add_filter '/spec/'
12
+ minimum_coverage(95.0)
13
+ end
14
+
15
+ require_relative '../lib/prayer_times.rb'
16
+
17
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
18
+ RSpec.configure do |config|
19
+ config.run_all_when_everything_filtered = true
20
+
21
+ # Run specs in random order to surface order dependencies. If you find an
22
+ # order dependency and want to debug it, you can fix the order by providing
23
+ # the seed, which is printed after each run.
24
+ # --seed 1234
25
+ config.order = 'random'
26
+ config.expect_with :rspec do |c|
27
+ c.syntax = :expect
28
+ end
29
+ end
@@ -0,0 +1,58 @@
1
+ # encoding: UTF-8
2
+ require 'helper'
3
+
4
+ describe PrayerTimes::CalculationMethod do
5
+
6
+ let(:method_name) { 'Medina' }
7
+ let(:description) { 'Medina testing methods' }
8
+
9
+ describe 'Object' do
10
+ subject { PrayerTimes::CalculationMethod.new(method_name, description, {}) }
11
+ it { expect(subject).to respond_to(:description) }
12
+ it { expect(subject).to respond_to(:description=) }
13
+ it { expect(subject).to respond_to(:settings) }
14
+ it { expect(subject).to respond_to(:settings=) }
15
+ it { expect(subject).to respond_to(:offsets) }
16
+ it { expect(subject).to respond_to(:offsets=) }
17
+ end
18
+
19
+ describe '#initialize' do
20
+ context 'when method_name and description are provided' do
21
+ subject { PrayerTimes::CalculationMethod.new(method_name, description) }
22
+ it { expect(subject.name).to eq(method_name) }
23
+ it { expect(subject.description).to eq(description) }
24
+ end
25
+
26
+ context 'when settings are not provided' do
27
+ subject { PrayerTimes::CalculationMethod.new(method_name, description, {}) }
28
+ it { expect(subject.settings).to eq(PrayerTimes::CalculationMethod.default_settings) }
29
+ end
30
+
31
+ context 'when settings are provided' do
32
+ let(:opts){{
33
+ fajr: 18,
34
+ asr: 'Hanafi',
35
+ isha: 18
36
+ }}
37
+ subject { PrayerTimes::CalculationMethod.new(method_name, description,opts) }
38
+ it { expect(subject.settings).to eq(PrayerTimes::CalculationMethod.default_settings.merge opts) }
39
+ end
40
+
41
+ context 'when offsets are not provided' do
42
+ subject { PrayerTimes::CalculationMethod.new(method_name, description, {}, {}) }
43
+ it { expect(subject.offsets).to eq(PrayerTimes::Constants.times_offsets) }
44
+ end
45
+
46
+ context 'when offsets are provided' do
47
+ let(:opts){{
48
+ fajr: 3,
49
+ asr: -1,
50
+ isha: 6
51
+ }}
52
+ subject { PrayerTimes::CalculationMethod.new(method_name, description,{},opts) }
53
+ it { expect(subject.offsets).to eq(PrayerTimes::Constants.times_offsets.merge opts) }
54
+ end
55
+
56
+ end
57
+
58
+ end
@@ -0,0 +1,38 @@
1
+ # encoding: UTF-8
2
+ require 'helper'
3
+
4
+ describe PrayerTimes::CalculationMethods do
5
+ describe '#initialize' do
6
+ subject { PrayerTimes::CalculationMethods.new }
7
+ it { expect(subject).to respond_to(:add) }
8
+ it { expect(subject.keys).to eq(subject.class.default_methods.keys) }
9
+ it { expect(subject).to respond_to(:[]) }
10
+ it { expect(subject).to respond_to(:each) }
11
+ it { expect(subject).to respond_to(:keys) }
12
+ it { expect(subject).to respond_to(:key?) }
13
+ it { expect(subject).to respond_to(:delete) }
14
+ end
15
+
16
+ describe '#add' do
17
+ before do
18
+ @subject = PrayerTimes::CalculationMethods.new
19
+ @settings = { fajr: 16.5, asr: 'Hanafi', isha: '80 min' }
20
+ @offsets = { dhuhr: 2, asr: -1, isha: 3 }
21
+
22
+ @new = @subject.add('Test', 'Testing method', @settings, @offsets)
23
+ end
24
+ it { expect(@new).to be_a(PrayerTimes::CalculationMethod) }
25
+ it { expect(@subject['Test']).to eq(@new) }
26
+ it { expect(@subject['Test'].settings[:fajr]).to eq(16.5) }
27
+ it { expect(@subject['Test'].settings[:asr]).to eq('Hanafi') }
28
+ it { expect(@subject['Test'].settings[:isha]).to eq('80 min') }
29
+ it { expect(@subject['Test'].offsets[:dhuhr]).to eq(2) }
30
+ it { expect(@subject['Test'].offsets[:asr]).to eq(-1) }
31
+ it { expect(@subject['Test'].offsets[:isha]).to eq(3) }
32
+ end
33
+
34
+ describe '#names' do
35
+ subject { PrayerTimes::CalculationMethods.new }
36
+ it { expect(subject.names).to eq(subject.keys) }
37
+ end
38
+ end
@@ -0,0 +1,159 @@
1
+ # encoding: UTF-8
2
+ require 'helper'
3
+
4
+ # Those results are tested against numbers from the js code
5
+ # http://praytimes.org/code/v2/js/PrayTimes.js
6
+ describe PrayerTimes::Calculation do
7
+ describe '#compute' do
8
+ context 'when method is MWL' do
9
+ context 'when date is 2011/2/9, location is Waterloo/Canada and timezone -5' do
10
+ let(:pt) { PrayerTimes.new}
11
+ subject{pt.get_times([2011,2,9], [43, -80], -5) }
12
+ let(:expected) { {
13
+ 'Imsak' => '05:40',
14
+ 'Fajr' => '05:50',
15
+ 'Sunrise' => '07:26',
16
+ 'Dhuhr' => '12:34',
17
+ 'Asr' => '15:18' ,
18
+ 'Sunset' => '17:43' ,
19
+ 'Maghrib' => '17:43' ,
20
+ 'Isha' => '19:14' ,
21
+ 'Midnight' => '00:35' } }
22
+ it {expect(subject).to eq(expected) }
23
+ end
24
+ end
25
+
26
+ context 'when method is Makkah' do
27
+ let(:method_name) { 'Makkah'}
28
+
29
+ context 'time format is 24h and other settings are default' do
30
+ context 'when date is 2013/12/16, location is Amman/Jordan and timezone 3' do
31
+ let(:pt) { PrayerTimes.new method_name}
32
+ subject{pt.get_times([2013,12,16], [31,36], 3) }
33
+ let(:expected) { {
34
+ 'Imsak' => '05:48',
35
+ 'Fajr' => '05:58',
36
+ 'Sunrise' => '07:27',
37
+ 'Dhuhr' => '12:32',
38
+ 'Asr' => '15:18' ,
39
+ 'Sunset' => '17:36' ,
40
+ 'Maghrib' => '17:36' ,
41
+ 'Isha' => '19:06' ,
42
+ 'Midnight' => '00:32' } }
43
+ it {expect(subject).to eq(expected) }
44
+ end
45
+ end
46
+
47
+ context 'time format is 24h, offsets are custom and other settings are default' do
48
+ context 'when date is 2013/12/16, location is Amman/Jordan and timezone 3' do
49
+ let(:pt) { PrayerTimes.new method_name, times_offsets: {fajr: 4, dhuhr: 2, midnight: 1}}
50
+ subject{pt.get_times([2013,12,16], [31,36], 3) }
51
+ let(:expected) { {
52
+ 'Imsak' => '05:48',
53
+ 'Fajr' => '06:02',
54
+ 'Sunrise' => '07:27',
55
+ 'Dhuhr' => '12:34',
56
+ 'Asr' => '15:18' ,
57
+ 'Sunset' => '17:36' ,
58
+ 'Maghrib' => '17:36' ,
59
+ 'Isha' => '19:06' ,
60
+ 'Midnight' => '00:33' } }
61
+ it {expect(subject).to eq(expected) }
62
+ end
63
+ end
64
+
65
+
66
+
67
+ context 'time format is 24h, times names are custom and settings are default' do
68
+ context 'when date is 2013/12/16, location is Amman/Jordan and timezone 3' do
69
+ let(:pt) { PrayerTimes.new method_name, times_names: {asr: 'Aser', isha: 'Ishaa'}}
70
+ subject{pt.get_times([2013,12,16], [31,36], 3) }
71
+ let(:expected) { {
72
+ 'Imsak' => '05:48',
73
+ 'Fajr' => '05:58',
74
+ 'Sunrise' => '07:27',
75
+ 'Dhuhr' => '12:32',
76
+ 'Aser' => '15:18' ,
77
+ 'Sunset' => '17:36' ,
78
+ 'Maghrib' => '17:36' ,
79
+ 'Ishaa' => '19:06' ,
80
+ 'Midnight' => '00:32' } }
81
+ it {expect(subject).to eq(expected) }
82
+ end
83
+ end
84
+
85
+ context 'time format is 12h, suffixes are custom and other settings are default' do
86
+ context 'when date is 2013/12/16, location is Amman/Jordan and timezone 3' do
87
+ let(:pt) { PrayerTimes.new method_name, time_format: '12h', time_suffixes: {:am => ' صباحا', :pm => ' مساءا'}}
88
+ subject{pt.get_times([2013,12,16], [31,36], 3) }
89
+ let(:expected) { {
90
+ 'Imsak' => '5:48 صباحا',
91
+ 'Fajr' => '5:58 صباحا',
92
+ 'Sunrise' => '7:27 صباحا',
93
+ 'Dhuhr' => '12:32 مساءا',
94
+ 'Asr' => '3:18 مساءا' ,
95
+ 'Sunset' => '5:36 مساءا' ,
96
+ 'Maghrib' => '5:36 مساءا' ,
97
+ 'Isha' => '7:06 مساءا' ,
98
+ 'Midnight' => '12:32 صباحا' }}
99
+ it {expect(subject).to eq(expected) }
100
+ end
101
+ end
102
+ end
103
+
104
+ context 'when method is Turkey' do
105
+ context 'when date is 2013/12/17, location is Fatih/Istanbul/Turkey and timezone +2' do
106
+ let(:pt) { PrayerTimes.new 'Turkey', time_format: '12h'}
107
+ subject{pt.get_times([2013,12,17], [41.02,28.94], 2) }
108
+ let(:expected) { {
109
+ 'Imsak' => '5:34AM',
110
+ 'Fajr' => '5:42AM',
111
+ 'Sunrise' => '7:16AM',
112
+ 'Dhuhr' => '12:06PM',
113
+ 'Asr' => '2:24PM' ,
114
+ 'Sunset' => '4:37PM' ,
115
+ 'Maghrib' => '4:46PM' ,
116
+ 'Isha' => '6:13PM' ,
117
+ 'Midnight' => '12:00AM' }}
118
+ it {expect(subject).to eq(expected) }
119
+ end
120
+ end
121
+
122
+ context 'when method is Karachi' do
123
+ context 'when date is 2013/12/17, location is Islamabad, timezone +5 and format is 12h' do
124
+ let(:pt) { PrayerTimes.new 'Karachi', time_format: '12h'}
125
+ subject{pt.get_times([2014,1,23], [33.73,73.06], 5) }
126
+ let(:expected) { {
127
+ 'Imsak' => '5:33AM',
128
+ 'Fajr' => '5:43AM',
129
+ 'Sunrise' => '7:10AM',
130
+ 'Dhuhr' => '12:20PM',
131
+ 'Asr' => '3:52PM' ,
132
+ 'Sunset' => '5:30PM' ,
133
+ 'Maghrib' => '5:30PM' ,
134
+ 'Isha' => '6:56PM' ,
135
+ 'Midnight' => '12:20AM' } }
136
+ it {expect(subject).to eq(expected) }
137
+ end
138
+ end
139
+
140
+ context 'when method is Kula Malaysia' do
141
+ context 'when date is 2013/12/17, location is Kula Lumpur, timezone +8 and format is 12h' do
142
+ let(:pt) { PrayerTimes.new 'Malaysia', time_format: '12h'}
143
+ subject{pt.get_times([2014,1,23], [3.15,101.69], 8) }
144
+ let(:expected) { {
145
+ 'Imsak' => '5:54AM',
146
+ 'Fajr' => '6:07AM',
147
+ 'Sunrise' => '7:28AM',
148
+ 'Dhuhr' => '1:26PM',
149
+ 'Asr' => '4:50PM' ,
150
+ 'Sunset' => '7:25PM' ,
151
+ 'Maghrib' => '7:25PM' ,
152
+ 'Isha' => '8:36PM' ,
153
+ 'Midnight' => '1:25AM' } }
154
+ it { expect(subject).to eq(expected) }
155
+ end
156
+ end
157
+
158
+ end
159
+ end