Permalink
Browse files

Refactor tests for clarity

  • Loading branch information...
Greg
Greg committed Aug 10, 2009
1 parent 5ce5f74 commit e1eb6dbe7f56d5c46d661fdf54f1354dffbf9e8b
Showing with 7 additions and 25 deletions.
  1. +4 −12 test/integration/go_fish_test.rb
  2. +3 −13 test/unit/go_fish_test.rb
@@ -10,36 +10,28 @@ def teardown
def test_fish_today_pop_eq_0
install_weather_service_uri_mocks(0)
- assert_positive_response GoFish.fish_today?
+ assert_equal GoFish.positive_response, GoFish.fish_today?
end
def test_fish_today_pop_eq_100
install_weather_service_uri_mocks(100)
- assert_negative_response GoFish.fish_today?
+ assert_equal GoFish.negative_response, GoFish.fish_today?
end
def test_fish_today_pop_eq_25
pop = 25
install_weather_service_uri_mocks(pop)
- assert_positive_response GoFish.fish_today?
+ assert_equal GoFish.positive_response, GoFish.fish_today?
end
def test_fish_today_pop_eq_26
pop = 26
install_weather_service_uri_mocks(pop)
- assert_negative_response GoFish.fish_today?
+ assert_equal GoFish.negative_response, GoFish.fish_today?
end
private
- def assert_positive_response(response)
- assert_equal GoFish.positive_response, response
- end
-
- def assert_negative_response(response)
- assert_equal GoFish.negative_response, response
- end
-
def install_weather_service_uri_mocks(pop)
uri = mock()
xml = weather_forecast_xml(pop)
View
@@ -25,19 +25,19 @@ def test_positive_and_negative_response_differ
def test_fish_today_lt_50_percent_likelihood_of_catch
likelihood_of_catch = 0.49
GoFish.fishing_forecaster = stub(:likelihood_of_catch => likelihood_of_catch)
- assert_negative_response GoFish.fish_today?
+ assert_equal GoFish.negative_response, GoFish.fish_today?
end
def test_fish_today_eq_50_percent_likelihood_of_catch
likelihood_of_catch = 0.50
GoFish.fishing_forecaster = stub(:likelihood_of_catch => likelihood_of_catch)
- assert_positive_response GoFish.fish_today?
+ assert_equal GoFish.positive_response, GoFish.fish_today?
end
def test_fish_today_gt_50_percent_likelihood_of_catch
likelihood_of_catch = 0.51
GoFish.fishing_forecaster = stub(:likelihood_of_catch => likelihood_of_catch)
- assert_positive_response GoFish.fish_today?
+ assert_equal GoFish.positive_response, GoFish.fish_today?
end
def test_fishing_forecaster_default
@@ -51,14 +51,4 @@ def test_fishing_forecaster_getter_setter
assert_equal fishing_forecaster, GoFish.fishing_forecaster
end
-private
-
- def assert_positive_response(response)
- assert_equal GoFish.positive_response, response
- end
-
- def assert_negative_response(response)
- assert_equal GoFish.negative_response, response
- end
-
end

0 comments on commit e1eb6db

Please sign in to comment.