spec/github/repos/keys_spec.rb in github_api-0.4.6 vs spec/github/repos/keys_spec.rb in github_api-0.4.7

- old
+ new

@@ -1,20 +1,24 @@ require 'spec_helper' -describe Github::Repos::Keys, :type => :base do +describe Github::Repos::Keys do + let(:github) { Github.new } + let(:user) { 'peter-murach' } + let(:repo) { 'github' } + after { github.user, github.repo, github.oauth_token = nil, nil, nil } + it { described_class::VALID_KEY_PARAM_NAMES.should_not be_nil } describe "keys" do context "resource found" do before do stub_get("/repos/#{user}/#{repo}/keys"). to_return(:body => fixture("repos/keys.json"), :status => 200, :headers => {}) end it "should fail to get resource without username" do - github.user, github.repo = nil, nil expect { github.repos.keys }.to raise_error(ArgumentError) end it "should get the resources" do github.repos.keys(user, repo) @@ -43,11 +47,10 @@ expect { github.repos.keys user, repo }.to raise_error(Github::Error::NotFound) end end - end describe "get_key" do let(:key_id) { 1 } @@ -98,17 +101,17 @@ end it "should fail to create resource if 'title' input is missing" do expect { github.repos.create_key(user, repo, :key => 'ssh-rsa AAA...') - }.to raise_error(ArgumentError) + }.to raise_error(Github::Error::RequiredParams) end it "should fail to create resource if 'key' input is missing" do expect { github.repos.create_key(user, repo, :title => 'octocat@octomac') - }.to raise_error(ArgumentError) + }.to raise_error(Github::Error::RequiredParams) end it "should create the resource" do github.repos.create_key(user, repo, inputs) a_post("/repos/#{user}/#{repo}/keys").with(inputs).should have_been_made @@ -166,10 +169,9 @@ expect { github.repos.edit_key(user, repo, key_id, inputs) }.to raise_error(Github::Error::NotFound) end end - end describe "delete_key" do let(:key_id) { 1 }