v3: tidy specs for star, unstar, enable, disable

This commit is contained in:
carlad 2015-12-01 15:02:10 +01:00
parent 54ffac9916
commit 50e198beee
4 changed files with 3 additions and 32 deletions

View File

@ -5,7 +5,6 @@ describe Travis::API::V3::Services::Repository::Disable do
before do
repo.update_attributes!(active: true)
Travis::Features.stubs(:owner_active?).returns(true)
end
describe "not authenticated" do
@ -70,6 +69,4 @@ describe Travis::API::V3::Services::Repository::Disable do
describe "existing repository, push access"
# as this reqires a call to github, and stubbing this request has proven difficult,
# this test has been omitted for now
end

View File

@ -4,8 +4,7 @@ describe Travis::API::V3::Services::Repository::Enable do
let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first }
before do
repo.update_attributes!(active: true)
Travis::Features.stubs(:owner_active?).returns(true)
repo.update_attributes!(active: false)
end
describe "not authenticated" do
@ -70,6 +69,4 @@ describe Travis::API::V3::Services::Repository::Enable do
describe "existing repository, push access"
# as this reqires a call to github, and stubbing this request has proven difficult,
# this test has been omitted for now
end

View File

@ -4,7 +4,7 @@ describe Travis::API::V3::Services::Repository::Star do
let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first }
before do
Travis::Features.stubs(:owner_active?).returns(true)
# Travis::Features.stubs(:owner_active?).returns(true)
end
describe "not authenticated" do

View File

@ -86,28 +86,5 @@ describe Travis::API::V3::Services::Repository::Unstar do
"id")
}
example { expect(Travis::API::V3::Models::Star.where(user_id: repo.owner_id, repository_id: repo.id)).to be == []}
end
# TODO return an error when alreasy not on the star db
describe "existing repository, push access, already starred" do
let(:params) {{}}
let(:token) { Travis::Api::App::AccessToken.create(user: repo.owner, app_id: 1) }
let(:headers) {{ 'HTTP_AUTHORIZATION' => "token #{token}" }}
before { Travis::API::V3::Models::Permission.create(repository: repo, user: repo.owner, push: true) }
before { post("/v3/repo/#{repo.id}/unstar", params, headers) }
example { expect(last_response.status).to be == 403 }
example { expect(JSON.load(body).to_s).to include(
"@type",
"star",
"@href",
"@representation",
"minimal",
"false",
"id")
}
example { expect(Travis::API::V3::Models::Star.where(user_id: repo.owner_id, repository_id: repo.id)).to be == "idushifuhds"}
end
end
end