Permalink
Browse files

Better support test-unit or minitest

  • Loading branch information...
Joseph Palermo
Joseph Palermo committed Jul 4, 2016
1 parent ca57de3 commit b8fecd8c6b14d4e517b2b1424b3cf00c8745f662
View
@@ -8,6 +8,7 @@ GEM
specs:
builder (3.2.2)
diff-lcs (1.2.5)
minitest (5.4.3)
pr_geohash (1.0.0)
rake (10.4.2)
rsolr (1.0.12)
@@ -34,6 +35,7 @@ PLATFORMS
DEPENDENCIES
bundler (>= 1.0.0)
minitest
rake
rspec
sunspot (~> 2.2.0)
@@ -24,6 +24,7 @@ def initialize(original_session)
# Support Sunspot random field in test -- Sunspot originally generate a random number for the field
# Only patch method if SunspotSessionSpy is initialized to prevent poisoning class simply by being included in Gemfile.
Sunspot::Query::Sort::RandomSort.class_eval do
remove_method :to_param
define_method :to_param do
"random #{direction_for_solr}"
end
@@ -1,10 +1,13 @@
require 'sunspot'
require 'minitest/autorun'
require File.expand_path('../matchers', __FILE__)
require File.expand_path('../sunspot_session_spy', __FILE__)
module SunspotMatchers
class HaveSearchParamsForSession
include MiniTest::Assertions
if defined?(MiniTest::Assertions)
include MiniTest::Assertions
else
include Test::Unit::Assertions
end
def initialize(session, method, *args, &block)
@session = session
View
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
s.add_development_dependency "rspec"
s.add_development_dependency "sunspot", "~> 2.2.0"
s.add_development_dependency "rake"
s.add_development_dependency "minitest"
s.files = `git ls-files`.split("\n")
s.require_path = 'lib'
@@ -1,5 +1,6 @@
require 'rubygems'
require 'bundler'
require 'minitest/autorun'
require 'sunspot_matchers/test_helper'
class Post; end
@@ -22,7 +23,7 @@ class Person; end
string :name
end
class SunspotMatchersTest < MiniTest::Unit::TestCase
class SunspotMatchersTest < MiniTest::Test
include SunspotMatchers::TestHelper
def setup

0 comments on commit b8fecd8

Please sign in to comment.