Skip to content

Commit

Permalink
test: backfill coverage on Cookie#set_domain deprecation message
Browse files Browse the repository at this point in the history
so that we have test coverage for both class and instance methods'
deprecation messages.
  • Loading branch information
flavorjones committed Feb 21, 2024
1 parent 8c47e35 commit 9de5c1d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/test_mechanize_cookie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -502,12 +502,23 @@ def test_domain=
cookie.domain = 'Dom.example.com'
assert 'dom.example.com', cookie.domain

cookie.domain = Object.new.tap { |o|
new_domain = Object.new.tap { |o|
def o.to_str
'Example.com'
end
}
cookie.domain = new_domain
assert 'example.com', cookie.domain

new_domain = Object.new.tap { |o|
def o.to_str
'Example2.com'
end
}
assert_output nil, /The call of Mechanize::Cookie#set_domain/ do
cookie.set_domain(new_domain)
end
assert 'example2.com', cookie.domain
end

def test_cookie_httponly
Expand Down

0 comments on commit 9de5c1d

Please sign in to comment.