Skip to content

Commit e8b5756

Browse files
committed
Change api actions.
1 parent 556fff6 commit e8b5756

3 files changed

Lines changed: 19 additions & 21 deletions

File tree

lib/github_api/api/actions.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ class API
99
#
1010
# @api public
1111
def self.extend_with_actions(child_class)
12+
return unless child_class.is_a?(Class)
13+
return if child_class.name.nil? # Skip anonymous classes
14+
1215
child_class.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
1316
def self.actions
14-
self.new.api_methods_in(#{child_class}) +
15-
self.new.module_methods_in(#{child_class})
17+
self.new.actions
1618
end
1719
1820
def actions

spec/github/api/actions_spec.rb

Lines changed: 0 additions & 19 deletions
This file was deleted.

spec/unit/api/actions_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# encoding: utf-8
2+
3+
require 'spec_helper'
4+
5+
RSpec.describe Github::API, '#actions' do
6+
let(:api) { Github::Client::Repos::Contents }
7+
8+
it "lists all available actions for an api class" do
9+
expect(api.actions).to eq([:archive, :create, :delete, :find, :get, :readme, :update])
10+
end
11+
12+
it "lists all available actions for an api instance" do
13+
expect(api.new.actions).to eq([:archive, :create, :delete, :find, :get, :readme, :update])
14+
end
15+
end

0 commit comments

Comments
 (0)