Skip to content
This repository was archived by the owner on Jun 8, 2026. It is now read-only.

Improve Result#inspect output - #83

Merged
jage merged 3 commits into
masterfrom
issue/79/consistent-inspect
Apr 1, 2019
Merged

jage merged 3 commits into
masterfrom
issue/79/consistent-inspect

Conversation

@jage

@jage jage commented Mar 27, 2019 •

Copy link
Copy Markdown
Contributor

Close #79

* Consistent comma separation (#79)
* Simple specs, assumes all available instance methods should be printed
* Remove @-prefx from output
* Update examples

Close #79
@jage

jage commented Mar 27, 2019

Copy link
Copy Markdown
Contributor Author

Also close #66 hehe (#79 is a duplicate issue)

Comment thread spec/livefeed/result_spec.rb Outdated
subject { described_class.new.inspect }

instance_methods.each do |method|
it { should include(method.to_s) }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we need something before and after the method name here. posts matches number_of_posts for example. Something like the following (disclaimer: I have no idea whether this works):

Suggested change
it { should include(method.to_s) }
it { should match(/ #{method}[,=]/) }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, good catch! I was a bit hesitant to repeat the exact syntax here, but that looks reasonable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread spec/result_spec.rb Outdated
subject { described_class.new.inspect }

instance_methods.each do |method|
it { should include(method.to_s) }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same as https://github.com/twingly/twingly-search-api-ruby/pull/83/files#r269577064 (it's not a problem right now though as all instance methods here have unique names)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread lib/twingly/search/result.rb Resolved
@jage
jage requested a review from roback April 1, 2019 09:56

@roback roback left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@jage
jage merged commit 309cf5b into master Apr 1, 2019
@jage
jage deleted the issue/79/consistent-inspect branch April 1, 2019 11:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants