fix tests

This commit is contained in:
r888888888
2017-02-21 14:37:40 -08:00
parent e699684c61
commit 6bd03ee4db
3 changed files with 10 additions and 6 deletions

View File

@@ -26,12 +26,10 @@ if defined?(MEMCACHE)
end
class ActiveSupport::TestCase
include UploadTestMethods
include PostArchiveTestHelper
end
class ActionController::TestCase
include UploadTestMethods
include PostArchiveTestHelper
def assert_authentication_passes(action, http_method, role, params, session)

View File

@@ -10,7 +10,9 @@ class PostTest < ActiveSupport::TestCase
assert_equal(posts.map(&:id), Post.tag_match(query).pluck(:id))
end
setup do
def setup
super
Timecop.travel(2.weeks.ago) do
@user = FactoryGirl.create(:user)
end
@@ -20,7 +22,9 @@ class PostTest < ActiveSupport::TestCase
mock_saved_search_service!
end
teardown do
def teardown
super
CurrentUser.user = nil
CurrentUser.ip_addr = nil
end
@@ -2290,8 +2294,8 @@ class PostTest < ActiveSupport::TestCase
context "a post that has been updated" do
setup do
@post = FactoryGirl.create(:post, :rating => "q", :tag_string => "aaa")
PostArchive.sqs_service.stubs(:merge?).returns(false)
@post = FactoryGirl.create(:post, :rating => "q", :tag_string => "aaa", :source => nil)
@post.update_attributes(:tag_string => "aaa bbb ccc ddd")
@post.update_attributes(:tag_string => "bbb xxx yyy", :source => "xyz")
@post.update_attributes(:tag_string => "bbb mmm yyy", :source => "abc")

View File

@@ -1,7 +1,9 @@
require 'test_helper'
class PostVoteTest < ActiveSupport::TestCase
setup do
def setup
super
user = FactoryGirl.create(:user)
CurrentUser.user = user
CurrentUser.ip_addr = "127.0.0.1"