Skip to content

Commit 002243d

Browse files
committed
fix(exists-method): fix method syntax with an alias
1 parent 6245387 commit 002243d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/algolia/index.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,11 @@ def exists
12951295
return true
12961296
end
12971297

1298+
#
1299+
# Aliases the exists method
1300+
#
1301+
alias :exists? :exists
1302+
12981303
# Deprecated
12991304
alias_method :get_user_key, :get_api_key
13001305
alias_method :list_user_keys, :list_api_keys

spec/client_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,12 @@ def wait_global_key_missing(key)
177177

178178
it "should tell if index exists" do
179179
@index.add_object!({ :name => "John Doe", :email => "[email protected]" }, "1")
180-
expect(@index.exists).to be true
180+
expect(@index.exists?).to be true
181181
end
182182

183183
it "should tell if index does not exist" do
184184
index = Algolia::Index.new('nonexistent_index')
185-
expect(index.exists).to be false
185+
expect(index.exists?).to be false
186186
end
187187

188188
it "should add a simple object" do

0 commit comments

Comments
 (0)