test(fix): Fix failing tests and watch script
This commit is contained in:
parent
0e5e36e063
commit
d844281e39
@ -6,7 +6,7 @@ guard :rspec, cmd: 'bundle exec rspec --color --format progress' do
|
||||
watch(%r{^lib/(.+)\.rb$}) do |match|
|
||||
"spec/#{match[1]}_spec.rb"
|
||||
end
|
||||
watch(%r{^lib/jekyll/algolia/overwrites/(.+)\.rb$}) do
|
||||
watch(%r{^lib/jekyll/algolia/overwrites/jekyll-algolia-site\.rb$}) do
|
||||
'spec/jekyll-algolia_spec.rb'
|
||||
end
|
||||
watch('spec/spec_helper.rb') { 'spec' }
|
||||
|
||||
@ -13,5 +13,5 @@ W:algolia:
|
||||
W: settings:
|
||||
{settings}
|
||||
I:
|
||||
I:If you'd like to revert to the default settings, the easiest way delete the indices and run `jekyll algolia` again.
|
||||
I:If you'd like to revert to the default settings, the easiest way is to delete the {index_name} index from your dashboard and run `jekyll algolia` again.
|
||||
I:
|
||||
|
||||
@ -360,7 +360,8 @@ module Jekyll
|
||||
end
|
||||
Logger.known_message(
|
||||
'settings_manually_edited',
|
||||
settings: yaml_lines.join("\n")
|
||||
settings: yaml_lines.join("\n"),
|
||||
index_name: Configurator.index_name
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
@ -132,8 +132,8 @@ module Jekyll
|
||||
|
||||
# Shrinking records to make them fit under 10Kb
|
||||
# We take into account the objectID that will be added in the form of:
|
||||
# "objectID": "i16cd998991cc40d92402b0b4e6c55e8a"
|
||||
object_id_attribute_length = 47
|
||||
# "objectID": "16cd998991cc40d92402b0b4e6c55e8a"
|
||||
object_id_attribute_length = 46
|
||||
max_file_size = 10_000 - object_id_attribute_length
|
||||
records.map! do |record|
|
||||
Shrinker.fit_to_size(record, max_file_size)
|
||||
|
||||
@ -6,5 +6,5 @@ if ! git status --short | grep -q '\.rb$'; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Match style guide
|
||||
rake test
|
||||
rake lint
|
||||
|
||||
@ -414,7 +414,7 @@ describe(Jekyll::Algolia) do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'shrink records to fit under 10Kb' do
|
||||
describe 'shrink records to fit under 10Kb, including room for objectID' do
|
||||
before do
|
||||
site.push
|
||||
end
|
||||
@ -422,16 +422,16 @@ describe(Jekyll::Algolia) do
|
||||
it do
|
||||
expect(shrinker)
|
||||
.to have_received(:fit_to_size)
|
||||
.with({ name: 'foo1' }, 10_000)
|
||||
.with({ name: 'foo1' }, 9954)
|
||||
expect(shrinker)
|
||||
.to have_received(:fit_to_size)
|
||||
.with({ name: 'foo2' }, 10_000)
|
||||
.with({ name: 'foo2' }, 9954)
|
||||
expect(shrinker)
|
||||
.to have_received(:fit_to_size)
|
||||
.with({ name: 'bar1' }, 10_000)
|
||||
.with({ name: 'bar1' }, 9954)
|
||||
expect(shrinker)
|
||||
.to have_received(:fit_to_size)
|
||||
.with({ name: 'bar2' }, 10_000)
|
||||
.with({ name: 'bar2' }, 9954)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -845,6 +845,7 @@ describe(Jekyll::Algolia::Indexer) do
|
||||
|
||||
before do
|
||||
allow(logger).to receive(:known_message)
|
||||
allow(configurator).to receive(:index_name).and_return('my_index')
|
||||
current.warn_of_manual_dashboard_editing(changed_keys)
|
||||
end
|
||||
|
||||
@ -858,7 +859,8 @@ describe(Jekyll::Algolia::Indexer) do
|
||||
"W: customRanking:\n"\
|
||||
"W: - foo\n"\
|
||||
"W: - bar\n"\
|
||||
'W: - baz'\
|
||||
'W: - baz',
|
||||
index_name: 'my_index'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user