Fix tests

This commit is contained in:
Evan Summers 2025-08-08 23:17:02 +02:00
parent 9474197b43
commit df53fb5bde
2 changed files with 9 additions and 4 deletions

View File

@ -235,11 +235,11 @@ RSpec.describe Settings::ImportsController do
let(:rows) do let(:rows) do
[ [
{ 'title' => 'Invalid Filter', 'context' => ['waffles'], 'keywords' => ['mean stuff'], 'action' => 'hide', 'expires_at' => nil }, { 'title' => 'Invalid Filter', 'context' => ['waffles'], 'keywords' => ['mean stuff'], 'whole_word' => [true], 'action' => 'hide', 'expires_at' => nil },
] ]
end end
it_behaves_like 'export failed rows', "Invalid Filter,\"[\"\"waffles\"\"]\",\"[\"\"mean stuff\"\"]\",hide,\n" it_behaves_like 'export failed rows', "Invalid Filter,\"[\"\"waffles\"\"]\",\"[\"\"mean stuff\"\"]\",[true],hide,\n"
end end
end end

View File

@ -105,7 +105,11 @@ RSpec.describe Export do
end end
describe '#to_filters_csv' do describe '#to_filters_csv' do
before { Fabricate.times(2, :custom_filter, account: account) } before do
Fabricate.times(2, :custom_filter, account: account) do
keywords { [Fabricate(:custom_filter_keyword)] }
end
end
let(:export) { CSV.parse(subject.to_filters_csv) } let(:export) { CSV.parse(subject.to_filters_csv) }
@ -113,7 +117,8 @@ RSpec.describe Export do
expect(export) expect(export)
.to contain_exactly( .to contain_exactly(
contain_exactly('Title', 'Context', 'Keywords', 'Whole Word', 'Action', 'Expire after'), contain_exactly('Title', 'Context', 'Keywords', 'Whole Word', 'Action', 'Expire after'),
include('discourse', '["home", "notifications"]', '["discourse"]', '[true]', 'warn', be_blank) include('discourse', '["home", "notifications"]', '["discourse"]', '[true]', 'warn', be_blank),
include(be_present)
) )
end end
end end