Skip to content

Conversation

@jitingcn
Copy link
Contributor

@jitingcn jitingcn commented Dec 21, 2021

Fixes #93

This conversion is done by Transpec 3.4.0 with the following command:
    transpec -f

* 70 conversions
    from: obj.should
      to: expect(obj).to

* 25 conversions
    from: == expected
      to: eq(expected)

* 4 conversions
    from: obj.should_not
      to: expect(obj).not_to

For more details: https://github.com/yujinakayama/transpec#supported-conversions
Comment on lines 1039 to 1049
begin
expect(b['hits'][0]['name']).to eq('"> hack0r')
expect(b['hits'][0]['name']).to eq('"> hack0r').and_raise(StandardError)
expect(b['hits'][0]['author']).to eq('alert(1)')
expect(b['hits'][0]['_formatted']['name']).to eq('"> <em>hack</em>0r')
rescue StandardError
# rails 4.2's sanitizer
begin
expect(b['hits'][0]['name']).to eq('&quot;&gt; hack0r')
expect(b['hits'][0]['name']).to eq('&quot;&gt; hack0r').and_raise(StandardError)
expect(b['hits'][0]['author']).to eq('')
expect(b['hits'][0]['_formatted']['name']).to eq('&quot;&gt; <em>hack</em>0r')
rescue StandardError
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Failures:

  1) Book sanitizes attributes
     Failure/Error: Transpec.analyze((expect(b['hits'][0]['name'])), self, "spec/integration_spec.rb_29236_29264", { :expect_source_location => [:context, "method(:expect).source_location"], :expect_example_method_defined_by_user? => [:context, "owner = method(:expect).owner\nowner != RSpec::Core::ExampleGroup &&\n  owner.ancestors.include?(RSpec::Core::ExampleGroup)"] }).to eq('"> hack0r')
     
       expected: "\"> hack0r"
            got: "\"&gt; hack0r"
     
       (compared using ==)

It may require further investigation, not sure why this behaviour has changed

Copy link
Member

Choose a reason for hiding this comment

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

Since we are doing this kind of flow control with exceptions could be hard to tell what rails version was used in the first place. I'll reference your question into a issue and this problem in a new issue to be investigated in the future :)

@jitingcn jitingcn changed the title Upgrade rspec main version to 3.0 Upgrade rspec version to 3.x Dec 21, 2021
@jitingcn jitingcn marked this pull request as ready for review December 21, 2021 15:59
Exclude:
- 'lib/meilisearch-rails.rb'

# Offense count: 15
Copy link
Member

Choose a reason for hiding this comment

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

Awesome! 👏

Copy link
Member

@brunoocasali brunoocasali left a comment

Choose a reason for hiding this comment

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

Hey @jitingcn, thanks again for your contribution you rocks 🤘!

I left a comment about rubocop cop RSpec/MultipleExpectations, let me know what you think about that :)

Thanks for raising the issue and making this improvement!

Comment on lines 1039 to 1049
begin
expect(b['hits'][0]['name']).to eq('"> hack0r')
expect(b['hits'][0]['name']).to eq('"> hack0r').and_raise(StandardError)
expect(b['hits'][0]['author']).to eq('alert(1)')
expect(b['hits'][0]['_formatted']['name']).to eq('"> <em>hack</em>0r')
rescue StandardError
# rails 4.2's sanitizer
begin
expect(b['hits'][0]['name']).to eq('&quot;&gt; hack0r')
expect(b['hits'][0]['name']).to eq('&quot;&gt; hack0r').and_raise(StandardError)
expect(b['hits'][0]['author']).to eq('')
expect(b['hits'][0]['_formatted']['name']).to eq('&quot;&gt; <em>hack</em>0r')
rescue StandardError
Copy link
Member

Choose a reason for hiding this comment

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

Since we are doing this kind of flow control with exceptions could be hard to tell what rails version was used in the first place. I'll reference your question into a issue and this problem in a new issue to be investigated in the future :)

@curquiza curquiza removed their request for review January 10, 2022 09:36
Copy link
Member

@brunoocasali brunoocasali left a comment

Choose a reason for hiding this comment

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

Awesome, we're good to go!

Thank you @jitingcn 🥇

@curquiza curquiza added the skip-changelog The PR will not appear in the release changelogs label Jan 10, 2022
Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

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

Thanks a lot, @jitingcn for your PR! It definitely improves this repository!

@brunoocasali
Copy link
Member

bors merge

@bors
Copy link
Contributor

bors bot commented Jan 10, 2022

@bors bors bot merged commit 5f177c6 into meilisearch:main Jan 10, 2022
bors bot added a commit that referenced this pull request Jan 13, 2022
100: Update version for the next release (v0.4.0) r=brunoocasali a=brunoocasali

Why is it breaking?
- #99
- #92

Other relevant changes:
- #96
- #94

Co-authored-by: Bruno Casali <brunoocasali@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog The PR will not appear in the release changelogs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

upgrade rspec 3

3 participants