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
2 changes: 1 addition & 1 deletion lib/segment/analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def method_missing message, *args, &block
end
end

def respond_to? method_name, include_private = false
def respond_to_missing?(method_name, include_private = false)
@client.respond_to?(method_name) || super
end

Expand Down
14 changes: 14 additions & 0 deletions spec/segment/analytics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@ class Analytics
end.to_not raise_error
end
end

describe '#respond_to?' do
it 'responds to all public instance methods of Segment::Analytics::Client' do
expect(analytics).to respond_to(*Segment::Analytics::Client.public_instance_methods(false))
end
end

describe '#method' do
Segment::Analytics::Client.public_instance_methods(false).each do |public_method|
it "returns a Method object with '#{public_method}' as argument" do
expect(analytics.method(public_method).class).to eq(Method)
end
end
end
end
end
end