Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant tests #345

Closed
wants to merge 7 commits into from
Closed

Conversation

ellnix
Copy link
Collaborator

@ellnix ellnix commented Feb 29, 2024

Continues after #342: Please only look at commits after "Remove redundant Ebook model"
More changes toward resolving #332

Please see commit messages for more information on why each test was removed.

create_table :mongo_documents do |t|
t.string :name
end
end

class NullableId < ActiveRecord::Base
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not find any place where this class was being used. Let me know if I should restore it or try to create new tests with records that return nil on their primary_key option.

Copy link

codecov bot commented Feb 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.22%. Comparing base (7459bde) to head (093bfbc).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #345   +/-   ##
=======================================
  Coverage   90.22%   90.22%           
=======================================
  Files          13       13           
  Lines         757      757           
=======================================
  Hits          683      683           
  Misses         74       74           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ellnix ellnix added skip-changelog The PR will not appear in the release changelogs maintenance Anything related to maintenance (CI, tests, refactoring...) labels Feb 29, 2024
This test seems to just use Marshal.dump on an object and then
Marshal.load it later, which would pass for any ruby object.
This test seems to test that an object that is cached can be fetched
back from the cache. As proof, the meilisearch method calls can be
removed and the test passes just fine:

```ruby
context 'with Rails caching' do
  let(:memory_store) { ActiveSupport::Cache.lookup_store(:memory_store) }
  let(:search_query) { '*' }
  let(:cache_key) { "book_search:#{search_query}" }

  before do
    allow(Rails).to receive(:cache).and_return(memory_store)
    Rails.cache.clear
  end

  fit 'caches the search results' do
    # Ensure the cache is empty before the test
    expect(Rails.cache.read(cache_key)).to be_nil

    # Perform the search and cache the results
    Rails.cache.fetch(cache_key) do
      search_query
    end

    # Check if the search result is cached
    expect(Rails.cache.read(cache_key)).to eq(search_query)
  end
end
```
It does not seem like Mongoid::Document has bang methods, so this is
spec is not reproducing a likely naming conflict. In either case, the
plan is to test with real MongoDB models so this test would be removed
eventually.
@ellnix
Copy link
Collaborator Author

ellnix commented Feb 29, 2024

Rebased to main now that #342 is merged.

'is_synchronous' tests a private method and only tests that the
configuration was applied
'has maxValuesPerFacet set' tests meilisearch-ruby's Index class
@ellnix
Copy link
Collaborator Author

ellnix commented May 27, 2024

Closing in favor of only keeping #350, this PR didn't pan out like I expected and thus is not useful.

@ellnix ellnix closed this May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Anything related to maintenance (CI, tests, refactoring...) skip-changelog The PR will not appear in the release changelogs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant