From 44e6e0fe18e9abc0be03ecbe4172e4f0364d8ddc Mon Sep 17 00:00:00 2001
From: Thu Trang Pham <thuutrangpham@gmail.com>
Date: Wed, 11 Mar 2015 17:59:22 -0400
Subject: [PATCH] Use omit instead of an if block

---
 test/unit/near_test.rb | 72 +++++++++++++++++++++++-------------------
 1 file changed, 40 insertions(+), 32 deletions(-)

diff --git a/test/unit/near_test.rb b/test/unit/near_test.rb
index 520459fc..5166fc2b 100644
--- a/test/unit/near_test.rb
+++ b/test/unit/near_test.rb
@@ -4,38 +4,46 @@ require 'test_helper'
 
 class NearTest < GeocoderTestCase
 
-  if ENV['DB'] != 'sqlite'
-    def test_near_scope_options_without_sqlite_includes_bounding_box_condition
-      result = PlaceWithCustomResultsHandling.send(:near_scope_options, 1.0, 2.0, 5)
-      table_name = PlaceWithCustomResultsHandling.table_name
-      assert_match(/#{table_name}.latitude BETWEEN 0.9276\d* AND 1.0723\d* AND #{table_name}.longitude BETWEEN 1.9276\d* AND 2.0723\d* AND /, result[:conditions][0])
-    end
-
-    def test_near_scope_options_without_sqlite_includes_radius_condition
-      result = Place.send(:near_scope_options, 1.0, 2.0, 5)
-      assert_match(/BETWEEN \? AND \?$/, result[:conditions][0])
-    end
-
-    def test_near_scope_options_without_sqlite_includes_radius_default_min_radius
-      result = Place.send(:near_scope_options, 1.0, 2.0, 5)
-
-      assert_equal(0, result[:conditions][1])
-      assert_equal(5, result[:conditions][2])
-    end
-
-    def test_near_scope_options_without_sqlite_includes_radius_custom_min_radius
-      result = Place.send(:near_scope_options, 1.0, 2.0, 5, :min_radius => 3)
-
-      assert_equal(3, result[:conditions][1])
-      assert_equal(5, result[:conditions][2])
-    end
-
-    def test_near_scope_options_without_sqlite_includes_radius_bogus_min_radius
-      result = Place.send(:near_scope_options, 1.0, 2.0, 5, :min_radius => 'bogus')
-
-      assert_equal(0, result[:conditions][1])
-      assert_equal(5, result[:conditions][2])
-    end
+  def test_near_scope_options_without_sqlite_includes_bounding_box_condition
+    omit("Not applicable to SQLite") if ENV['DB'] == 'sqlite'
+
+    result = PlaceWithCustomResultsHandling.send(:near_scope_options, 1.0, 2.0, 5)
+    table_name = PlaceWithCustomResultsHandling.table_name
+    assert_match(/#{table_name}.latitude BETWEEN 0.9276\d* AND 1.0723\d* AND #{table_name}.longitude BETWEEN 1.9276\d* AND 2.0723\d* AND /, result[:conditions][0])
+  end
+
+  def test_near_scope_options_without_sqlite_includes_radius_condition
+    omit("Not applicable to SQLite") if ENV['DB'] == 'sqlite'
+
+    result = Place.send(:near_scope_options, 1.0, 2.0, 5)
+    assert_match(/BETWEEN \? AND \?$/, result[:conditions][0])
+  end
+
+  def test_near_scope_options_without_sqlite_includes_radius_default_min_radius
+    omit("Not applicable to SQLite") if ENV['DB'] == 'sqlite'
+
+    result = Place.send(:near_scope_options, 1.0, 2.0, 5)
+
+    assert_equal(0, result[:conditions][1])
+    assert_equal(5, result[:conditions][2])
+  end
+
+  def test_near_scope_options_without_sqlite_includes_radius_custom_min_radius
+    omit("Not applicable to SQLite") if ENV['DB'] == 'sqlite'
+
+    result = Place.send(:near_scope_options, 1.0, 2.0, 5, :min_radius => 3)
+
+    assert_equal(3, result[:conditions][1])
+    assert_equal(5, result[:conditions][2])
+  end
+
+  def test_near_scope_options_without_sqlite_includes_radius_bogus_min_radius
+    omit("Not applicable to SQLite") if ENV['DB'] == 'sqlite'
+    
+    result = Place.send(:near_scope_options, 1.0, 2.0, 5, :min_radius => 'bogus')
+
+    assert_equal(0, result[:conditions][1])
+    assert_equal(5, result[:conditions][2])
   end
 
   def test_near_scope_options_with_defaults
-- 
GitLab