Skip to content

Commit c990db6

Browse files
cltweediedmgarland
authored andcommitted
Fix .api_methods_in in actions.rb
1 parent feebd53 commit c990db6

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

lib/bitbucket_rest_api/api/actions.rb

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,18 @@ def actions
1717
end
1818

1919
def api_methods_in(klass)
20-
puts "---"
20+
methods = []
2121
(klass.send(:instance_methods, false) - ['actions']).sort.each do |method|
22-
puts "|--> #{method}"
22+
methods << method
2323
end
2424
klass.included_modules.each do |mod|
2525
if mod.to_s =~ /#{klass}/
26-
puts "| \\ #{mod.to_s}"
2726
mod.instance_methods(false).each do |met|
28-
puts "| |--> #{met}"
27+
methods << met
2928
end
30-
puts "| /"
3129
end
3230
end
33-
puts "---"
34-
nil
31+
methods
3532
end
3633

3734
def append_arguments(method)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
require 'spec_helper'
2+
3+
describe BitBucket::API, '#actions' do
4+
let(:api) { BitBucket::Repos::Keys }
5+
6+
context 'when class' do
7+
it "lists all available actions for an api" do
8+
expect(api.actions).to eq([:actions, :all, :create, :delete, :edit, :list])
9+
end
10+
end
11+
12+
context 'when instance' do
13+
it "lists all available actions for an api" do
14+
expect(api.new.actions).to eq([:actions, :all, :create, :delete, :edit, :list])
15+
end
16+
end
17+
end

0 commit comments

Comments
 (0)