diff --git a/CHANGELOG.md b/CHANGELOG.md index debcc641..19ce14c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.1.2 (June 23, 2013) + +* Fixed a bug where User objects would raise an exception when compared against non-User objects. + ## 1.1.1 (June 23, 2013) * Fixed broken internals in the authorization API. Auth commands will now correctly detect the user making the command and will normalize group names so that capitalization and white space don't matter. diff --git a/lib/lita/user.rb b/lib/lita/user.rb index 29b343b8..71832a5a 100644 --- a/lib/lita/user.rb +++ b/lib/lita/user.rb @@ -42,7 +42,8 @@ def save end def ==(other) - id == other.id && name == other.name + other.respond_to?(:id) && id == other.id && + other.respond_to?(:name) && name == other.name end private diff --git a/lib/lita/version.rb b/lib/lita/version.rb index 3af446d5..89db68fd 100644 --- a/lib/lita/version.rb +++ b/lib/lita/version.rb @@ -1,3 +1,3 @@ module Lita - VERSION = "1.1.1" + VERSION = "1.1.2" end diff --git a/spec/lita/user_spec.rb b/spec/lita/user_spec.rb index 5c0180c3..61b67a88 100644 --- a/spec/lita/user_spec.rb +++ b/spec/lita/user_spec.rb @@ -54,5 +54,10 @@ user2 = described_class.new(1, name: "Carl") expect(user1).to eq(user2) end + + it "doesn't assume the comparison object is a Lita::User" do + user = described_class.new(1, name: "Carl") + expect(user).not_to eq("not a Lita::User object") + end end end