Merge branch 'main' into glitch-soc/merge-upstream
This commit is contained in:
@@ -3,17 +3,18 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe SearchQueryTransformer do
|
||||
subject { described_class.new.apply(parser, current_account: nil) }
|
||||
subject { described_class.new.apply(parser, current_account: account) }
|
||||
|
||||
let(:account) { Fabricate(:account) }
|
||||
let(:parser) { SearchQueryParser.new.parse(query) }
|
||||
|
||||
context 'with "hello world"' do
|
||||
let(:query) { 'hello world' }
|
||||
|
||||
it 'transforms clauses' do
|
||||
expect(subject.must_clauses.map(&:term)).to match_array %w(hello world)
|
||||
expect(subject.must_not_clauses).to be_empty
|
||||
expect(subject.filter_clauses).to be_empty
|
||||
expect(subject.send(:must_clauses).map(&:term)).to match_array %w(hello world)
|
||||
expect(subject.send(:must_not_clauses)).to be_empty
|
||||
expect(subject.send(:filter_clauses)).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,9 +22,9 @@ describe SearchQueryTransformer do
|
||||
let(:query) { 'hello -world' }
|
||||
|
||||
it 'transforms clauses' do
|
||||
expect(subject.must_clauses.map(&:term)).to match_array %w(hello)
|
||||
expect(subject.must_not_clauses.map(&:term)).to match_array %w(world)
|
||||
expect(subject.filter_clauses).to be_empty
|
||||
expect(subject.send(:must_clauses).map(&:term)).to match_array %w(hello)
|
||||
expect(subject.send(:must_not_clauses).map(&:term)).to match_array %w(world)
|
||||
expect(subject.send(:filter_clauses)).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
@@ -31,9 +32,9 @@ describe SearchQueryTransformer do
|
||||
let(:query) { 'hello is:reply' }
|
||||
|
||||
it 'transforms clauses' do
|
||||
expect(subject.must_clauses.map(&:term)).to match_array %w(hello)
|
||||
expect(subject.must_not_clauses).to be_empty
|
||||
expect(subject.filter_clauses.map(&:term)).to match_array %w(reply)
|
||||
expect(subject.send(:must_clauses).map(&:term)).to match_array %w(hello)
|
||||
expect(subject.send(:must_not_clauses)).to be_empty
|
||||
expect(subject.send(:filter_clauses).map(&:term)).to match_array %w(reply)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -41,9 +42,9 @@ describe SearchQueryTransformer do
|
||||
let(:query) { 'foo: bar' }
|
||||
|
||||
it 'transforms clauses' do
|
||||
expect(subject.must_clauses.map(&:term)).to match_array %w(foo bar)
|
||||
expect(subject.must_not_clauses).to be_empty
|
||||
expect(subject.filter_clauses).to be_empty
|
||||
expect(subject.send(:must_clauses).map(&:term)).to match_array %w(foo bar)
|
||||
expect(subject.send(:must_not_clauses)).to be_empty
|
||||
expect(subject.send(:filter_clauses)).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
@@ -51,9 +52,9 @@ describe SearchQueryTransformer do
|
||||
let(:query) { 'foo:bar' }
|
||||
|
||||
it 'transforms clauses' do
|
||||
expect(subject.must_clauses.map(&:term)).to contain_exactly('foo bar')
|
||||
expect(subject.must_not_clauses).to be_empty
|
||||
expect(subject.filter_clauses).to be_empty
|
||||
expect(subject.send(:must_clauses).map(&:term)).to contain_exactly('foo bar')
|
||||
expect(subject.send(:must_not_clauses)).to be_empty
|
||||
expect(subject.send(:filter_clauses)).to be_empty
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -105,6 +105,9 @@ RSpec.describe MediaAttachment, paperclip_processing: true do
|
||||
|
||||
# sets file extension
|
||||
expect(media.file_file_name).to end_with extension
|
||||
|
||||
# Rack::Mime (used by PublicFileServerMiddleware) recognizes file extension
|
||||
expect(Rack::Mime.mime_type(extension, nil)).to eq content_type
|
||||
end
|
||||
|
||||
it 'saves media attachment with correct size metadata' do
|
||||
|
||||
Reference in New Issue
Block a user