Skip to content

Commit

Permalink
feat(has_j_send_status_and_attributes): introduce Message#empty?
Browse files Browse the repository at this point in the history
  • Loading branch information
marian13 committed Sep 20, 2023
1 parent 27f43e1 commit 6c1452d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ def initialize(value:, result: nil)
@result = result
end

##
# @return [Boolean]
#
def empty?
value.empty?
end

##
# @param other [Object] Can be any type.
# @return [Boolean, nil]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,23 @@
it { is_expected.to have_attr_reader(:result) }
end

describe "#empty?" do
##
# NOTE: `value` is unfrozen in order to allow stubs on it. Otherwise an excepion like the following is raised:
#
# ArgumentError:
# Cannot proxy frozen objects, rspec-mocks relies on proxies for method stubbing and expectations.
#
let(:value) { +"foo" }

specify do
expect { message.empty? }
.to delegate_to(message.value, :empty?)
.without_arguments
.and_return_its_value
end
end

example_group "comparisons" do
describe "#==" do
##
Expand Down

0 comments on commit 6c1452d

Please sign in to comment.