Closed jeremylynch closed 6 months ago
Can I see the test where this is occurring?
Any set up such as the creation of the database table and model class would also be appreciated.
Occurring in tests like this:
test 'page_url' do
@page = create(:page) # factorybot
assert @page.page_url == "https://www.testing.com"
end
Confirming downgrading to version 0.10.2 fixes the issue
I created a new rails app, with a Page
model that has a `page_url' attribute:
ActiveRecord::Schema[7.1].define(version: 2024_02_17_123956) do
create_table "pages", force: :cascade do |t|
t.string "page_url"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
end
class Page < ApplicationRecord
include MeiliSearch::Rails
meilisearch
end
Migrated, defined this factory in test/test_helper.rb
:
FactoryBot.define do
factory :page do
page_url { 'https://www.testing.com' }
end
end
And then added the test you provided:
require "test_helper"
class PageTest < ActiveSupport::TestCase
test 'page_url' do
@page = FactoryBot.create(:page) # factorybot
assert @page.page_url == "https://www.testing.com"
end
end
And I get no error:
» bin/rails test
Running 1 tests in a single process (parallelization threshold is 50)
Run options: --seed 39564
# Running:
.
Finished in 0.051185s, 19.5371 runs/s, 19.5371 assertions/s.
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
Relevant lines in the Gemfile
& Gemfile.lock
:
gem "factory_bot", "~> 6.4"
gem "meilisearch-rails", "~> 0.11.0"
meilisearch (0.26.0)
httparty (>= 0.17.1, < 0.22.0)
meilisearch-rails (0.11.0)
meilisearch (~> 0.26.0)
I am still not sure exactly where this is being caused, but it is possible that #330 fixes it. Please try it and let me know whenever you can.
Reopening this until it's confirmed that #330 fixes it.
@ellnix we need to do a release for this, feel free to start the process on the CONTRIBUTING when you think we are ready for a release. I'm available for any review you need
I can confirm that we are no longer seeing this issue since upgrading to 0.12.0 👍
Ever since upgrading from Meilisearch 0.10.2 to 0.11.0 we are getting multiple errors in our test suite:
We are using Minitest/FactoryBot for testing.
Is there anything we need to do to ensure these indexes are created?