Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
- "3.1"
- "3.2"
- "3.3"
- "3.4"
- "jruby-9.4"
steps:
- name: Checkout code
Expand Down
7 changes: 6 additions & 1 deletion spec/core/resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,12 @@ def to_param

context "#inspect" do
it "should display nicely" do
expect(ZendeskAPI::User.new(client, :foo => :bar).inspect).to eq("#<ZendeskAPI::User {\"foo\"=>:bar}>")
expected_user_representation = if RUBY_VERSION >= "3.4"
"#<ZendeskAPI::User {\"foo\" => :bar}>"
else
"#<ZendeskAPI::User {\"foo\"=>:bar}>"
end
expect(ZendeskAPI::User.new(client, :foo => :bar).inspect).to eq(expected_user_representation)
Comment on lines +458 to +463
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be done differently:

expect(ZendeskAPI::User.new(client, :foo => :bar).inspect).to eq("#<ZendeskAPI::User #{{'foo' => :bar}}>")

That is, we interpolate a hash directly in the expected output, and it match Hash#inspect behaviour. However, here we only have one such test, and we explicitly are interested in how User#inspect behaves, so I thought it would be better to have two branches.

end
end

Expand Down
Loading