Skip to content

Commit

Permalink
Fixes failng specs
Browse files Browse the repository at this point in the history
  • Loading branch information
benichu committed Sep 26, 2015
1 parent 877202e commit efbc187
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/checklister/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Client
#
IMPLEMENTED_BACKENDS = %w(gitlab github)

attr_accessor :api_client
attr_reader :api_client

# Initialize all the issue service options required to be able to interact with it
#
Expand Down
12 changes: 6 additions & 6 deletions spec/checklister/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,31 @@

it "needs an implemented backend API client, based on kind" do
expect do
Checklister::Client.new(gitlab_config.merge!(kind: "foo")).get_api_client
end.to raise_error ArgumentError, "No foo API client has been implemented"
Checklister::Client.new(gitlab_config.merge!(kind: "foo"))
end.to raise_error NotImplementedError, "No foo API client has been implemented"
end

context "create github API client" do
it "initializes client" do
github_client = Checklister::Client.new(github_config).get_api_client
github_client = Checklister::Client.new(github_config).api_client
expect(github_client).to be_a Octokit::Client
end

it "removes the :endpoint option and renames :private_token into :access_token" do
expect(Octokit::Client).to receive(:new).with(access_token: "supersecret")
Checklister::Client.new(github_config).get_api_client
Checklister::Client.new(github_config).api_client
end
end

context "create gitlab API client" do
subject(:gitlab_client) { Checklister::Client.new(gitlab_config).get_api_client }
subject(:gitlab_client) { Checklister::Client.new(gitlab_config).api_client }
it "initializes client" do
expect(gitlab_client).to be_a Gitlab::Client
end

it "needs a valid kind option" do
expect do
Checklister::Client.new(gitlab_config.reject { |k| k == :kind }).get_api_client
Checklister::Client.new(gitlab_config.reject { |k| k == :kind })
end.to raise_error ArgumentError, "No API client can be initialized"
end

Expand Down
2 changes: 1 addition & 1 deletion spec/checklister/gitlab/issue_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
let(:gitlab_config) do
{ endpoint: "https://www.gitlab.com/api", private_token: "supersecret", kind: "gitlab" }
end
let(:client) { Checklister::Client.new(gitlab_config).get_api_client }
let(:client) { Checklister::Client.new(gitlab_config).api_client }

describe "#create" do
before(:each) do
Expand Down
2 changes: 1 addition & 1 deletion spec/checklister/gitlab/project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
let(:gitlab_config) do
{ endpoint: "https://www.gitlab.com/api", private_token: "supersecret", kind: "gitlab" }
end
let(:client) { Checklister::Client.new(gitlab_config).get_api_client }
let(:client) { Checklister::Client.new(gitlab_config).api_client }

describe ".get" do
let(:project) { Checklister::Gitlab::Project.new(client).get(1) }
Expand Down

0 comments on commit efbc187

Please sign in to comment.