Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Default weather_forecaster for fishing_forecaster

  • Loading branch information...
commit a518813be4f51b1bc7a9877fbaa386132e11e91f 1 parent 8414d6f
Greg authored
Showing with 9 additions and 2 deletions.
  1. +3 −2 fishing_forecaster.rb
  2. +6 −0 test/unit/fishing_forecaster_test.rb
View
5 fishing_forecaster.rb
@@ -1,9 +1,10 @@
class FishingForecaster
- @@weather_forecaster = ""
+ @@default_weather_forecaster = ""
+ @@weather_forecaster = @@default_weather_forecaster
def self.weather_forecaster
- @@weather_forecaster
+ @@weather_forecaster ||= @@default_weather_forecaster
end
def self.weather_forecaster=(forecaster)
View
6 test/unit/fishing_forecaster_test.rb
@@ -6,6 +6,12 @@ def setup
end
def teardown
+ FishingForecaster.weather_forecaster = nil
+ assert_not_nil FishingForecaster.weather_forecaster
+ end
+
+ def test_fishing_forecaster_default
+ assert_not_nil FishingForecaster.weather_forecaster
end
def test_weather_forecaster_getter_setter
Please sign in to comment.
Something went wrong with that request. Please try again.