weather_jp 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module WeatherJp
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/weather_jp.rb CHANGED
@@ -43,6 +43,8 @@ module WeatherJp
43
43
  day = 0
44
44
  when :tomorrow
45
45
  day = 1
46
+ when :day_after_tomorrow
47
+ day = 2
46
48
  end
47
49
  raise ArgumentError if @day_weathers[day] == nil
48
50
  @day_weathers[day]
@@ -52,6 +54,12 @@ module WeatherJp
52
54
  end
53
55
  end
54
56
 
57
+ %w(today tomorrow day_after_tomorrow).each do |s|
58
+ define_method(s.to_sym) do
59
+ get_weather(s)
60
+ end
61
+ end
62
+
55
63
  private
56
64
  def set_weathers
57
65
  begin
data/spec/weather_spec.rb CHANGED
@@ -129,10 +129,24 @@ describe "Weather" do
129
129
  end
130
130
 
131
131
  it "should return DayWeather object" do
132
- @weather.get_weather(0).class.should == WeatherJp::Weather::DayWeather
132
+ @weather.get_weather(0).class.
133
+ should == WeatherJp::Weather::DayWeather
133
134
  end
134
135
  end
135
- end
136
-
137
-
136
+
137
+ describe "#today, #tomorrow, #day_after_tomorrow" do
138
+ it "should not error when call #today or something" do
139
+ %w(today tomorrow day_after_tomorrow).each do |s|
140
+ ->(){ @weather.send(s.to_sym) }.
141
+ should_not raise_error(NoMethodError)
142
+ end
143
+ end
138
144
 
145
+ it "should return DayWeather object" do
146
+ %w(today tomorrow day_after_tomorrow).each do |s|
147
+ @weather.send(s.to_sym).class.
148
+ should == WeatherJp::Weather::DayWeather
149
+ end
150
+ end
151
+ end
152
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weather_jp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -109,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  segments:
111
111
  - 0
112
- hash: -197537754625782512
112
+ hash: -2207758919953171903
113
113
  required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  none: false
115
115
  requirements:
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  segments:
120
120
  - 0
121
- hash: -197537754625782512
121
+ hash: -2207758919953171903
122
122
  requirements: []
123
123
  rubyforge_project:
124
124
  rubygems_version: 1.8.23