LanguageDetector: Use StaticStubbedConfigMock.
This commit is contained in:
parent
35814de0df
commit
1e35ea785a
3 changed files with 10 additions and 10 deletions
|
|
@ -7,13 +7,13 @@ defmodule Pleroma.Language.LanguageDetectorTest do
|
|||
|
||||
alias Pleroma.Language.LanguageDetector
|
||||
alias Pleroma.Language.LanguageDetectorMock
|
||||
alias Pleroma.UnstubbedConfigMock
|
||||
alias Pleroma.StaticStubbedConfigMock
|
||||
|
||||
import Mox
|
||||
|
||||
setup do
|
||||
# Stub the UnstubbedConfigMock to return our mock for the provider
|
||||
UnstubbedConfigMock
|
||||
# Stub the StaticStubbedConfigMock to return our mock for the provider
|
||||
StaticStubbedConfigMock
|
||||
|> stub(:get, fn
|
||||
[Pleroma.Language.LanguageDetector, :provider] -> LanguageDetectorMock
|
||||
_other -> nil
|
||||
|
|
@ -46,7 +46,7 @@ defmodule Pleroma.Language.LanguageDetectorTest do
|
|||
|
||||
test "it returns nil if no provider specified" do
|
||||
# Override the stub to return nil for the provider
|
||||
UnstubbedConfigMock
|
||||
StaticStubbedConfigMock
|
||||
|> expect(:get, fn [Pleroma.Language.LanguageDetector, :provider] -> nil end)
|
||||
|
||||
detected_language = LanguageDetector.detect("this should also return nil")
|
||||
|
|
|
|||
|
|
@ -9,15 +9,15 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidatorTest
|
|||
alias Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidator
|
||||
alias Pleroma.Web.ActivityPub.Utils
|
||||
alias Pleroma.Language.LanguageDetectorMock
|
||||
alias Pleroma.UnstubbedConfigMock
|
||||
alias Pleroma.StaticStubbedConfigMock
|
||||
|
||||
import Mox
|
||||
import Pleroma.Factory
|
||||
|
||||
# Setup for all tests
|
||||
setup do
|
||||
# Stub the UnstubbedConfigMock to return our mock for the provider
|
||||
UnstubbedConfigMock
|
||||
# Stub the StaticStubbedConfigMock to return our mock for the provider
|
||||
StaticStubbedConfigMock
|
||||
|> stub(:get, fn
|
||||
[Pleroma.Language.LanguageDetector, :provider] -> LanguageDetectorMock
|
||||
_other -> nil
|
||||
|
|
@ -262,8 +262,8 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidatorTest
|
|||
|> stub(:missing_dependencies, fn -> [] end)
|
||||
|> stub(:configured?, fn -> true end)
|
||||
|
||||
# Stub the UnstubbedConfigMock to return our mock for the provider
|
||||
UnstubbedConfigMock
|
||||
# Stub the StaticStubbedConfigMock to return our mock for the provider
|
||||
StaticStubbedConfigMock
|
||||
|> stub(:get, fn
|
||||
[Pleroma.Language.LanguageDetector, :provider] -> LanguageDetectorMock
|
||||
_other -> nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue