source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/owner/find_spec.rb
Ruby
mit
298
master
22,892
describe Travis::API::V3::Services::Owner::Find, set_app: true do before { stub_request(:post, %r((.+)/usage/stats)) } describe "organization" do let(:org) { Travis::API::V3::Models::Organization.new(login: 'example-org', github_id: 1234) } before { org.save! } after { org.delete ...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/v2_subscriptions/all_spec.rb
Ruby
mit
298
master
10,630
describe Travis::API::V3::Services::V2Subscriptions::All, set_app: true, billing_spec_helper: true do let(:parsed_body) { JSON.load(last_response.body) } let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } before do Travis.config.billing.url = billing_url Travis...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/v2_subscriptions/create_spec.rb
Ruby
mit
298
master
14,607
describe Travis::API::V3::Services::V2Subscriptions::Create, set_app: true, billing_spec_helper: true do let(:parsed_body) { JSON.load(last_response.body) } let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } before do Travis.config.billing.url = billing_url Tra...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/plans/all_spec.rb
Ruby
mit
298
master
4,430
describe Travis::API::V3::Services::Plans::All, set_app: true, billing_spec_helper: true do let(:parsed_body) { JSON.load(last_response.body) } let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } let(:organization_id) { rand(999) } before do Travis.config.billing....
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/account_env_var/delete_spec.rb
Ruby
mit
298
master
963
describe Travis::API::V3::Services::AccountEnvVar::Delete, set_app: true do let(:user) { FactoryBot.create(:user) } let(:account_env_var) { account_env_var = Travis::API::V3::Models::AccountEnvVar.new( owner_type: 'User', owner_id: user.id, name: 'TEST_VAR', value: 'VAL', public...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/account_env_var/create_spec.rb
Ruby
mit
298
master
1,357
describe Travis::API::V3::Services::AccountEnvVars::Create, set_app: true do let(:user) { FactoryBot.create(:user) } let(:token) { Travis::Api::App::AccessToken.create(user: user, app_id: 1) } let(:headers) {{ 'HTTP_AUTHORIZATION' => "token #{token}", "Content-Type" => "application/json" }} let(:options) d...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/beta_migration_requests/proxy_find_spec.rb
Ruby
mit
298
master
4,145
require 'spec_helper' describe Travis::API::V3::Services::BetaMigrationRequests::Find, set_app: true do let!(:user) { FactoryBot.create(:user) } let(:beta_migration_request) { FactoryBot.create(:beta_migration_request, owner_id: user.id) } let(:org1) { FactoryBot.create(:org_v3) } let(:org2) { FactoryBot.crea...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/beta_migration_requests/create_spec.rb
Ruby
mit
298
master
2,861
require 'spec_helper' describe Travis::API::V3::Services::BetaMigrationRequests::Create, set_app: true do let(:user) { FactoryBot.create(:user, login: 'some_beta_user') } let(:auth_headers) { { 'HTTP_AUTHORIZATION' => 'internal some_app:sometoken' } } let(:params) { { user_login: user.login, organizations: val...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/builds/for_current_user_spec.rb
Ruby
mit
298
master
6,544
describe Travis::API::V3::Services::Builds::ForCurrentUser, set_app: true do include Support::Formats let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } let(:build) { repo.builds.first } let(:branch) { Travis::API::V3::Models::Branch.find_by(repository...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/builds/find_spec.rb
Ruby
mit
298
master
20,559
describe Travis::API::V3::Services::Builds::Find, set_app: true do include Support::Formats let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } let(:build) { repo.builds.first } let(:stages) { build.stages } let(:jobs) { Travis::API::V3::Models::Build....
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/custom_images/delete_spec.rb
Ruby
mit
298
master
1,651
describe Travis::API::V3::Services::CustomImages::Delete, set_app: true do let(:user) { FactoryBot.create(:user) } let(:token) { Travis::Api::App::AccessToken.create(user: user, app_id: 1) } let(:headers) {{ 'HTTP_AUTHORIZATION' => "token #{token}" }} let(:parsed_body) { JSON.load(body) } let(:url) { 'ht...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/custom_images/for_owner_spec.rb
Ruby
mit
298
master
2,566
require 'spec_helper' RSpec.describe Travis::API::V3::Services::CustomImages::ForOwner, set_app: true do let(:json_headers) { { 'HTTP_ACCEPT' => 'application/json' } } let(:authorization) { { 'permissions' => [ 'repository_state_update', 'repository_build_create' ] } } before do Travis.config.host = 'travis...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/env_vars/for_repository_spec.rb
Ruby
mit
298
master
2,818
require 'spec_helper' describe Travis::API::V3::Services::EnvVars::ForRepository, set_app: true do let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first_or_create } let(:token) { Travis::Api::App::AccessToken.create(user: repo.owner, app_id: 1) } let(:env_var) { ...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/env_vars/create_spec.rb
Ruby
mit
298
master
7,753
require 'spec_helper' describe Travis::API::V3::Services::EnvVars::Create, set_app: true do let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first_or_create } let(:token) { Travis::Api::App::AccessToken.create(user: repo.owner, app_id: 1) } let(:auth_headers) { { ...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/trials/all_spec.rb
Ruby
mit
298
master
2,090
describe Travis::API::V3::Services::Trials::All, set_app: true, billing_spec_helper: true do let(:parsed_body) { JSON.load(last_response.body) } let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } before do Travis.config.billing.url = billing_url Travis.config.b...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/trials/create_trial_spec.rb
Ruby
mit
298
master
5,660
describe Travis::API::V3::Services::Trials::Create, set_app: true, billing_spec_helper: true do let(:parsed_body) { JSON.load(last_response.body) } let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } let(:authorization) { { 'permissions' => ['account_billing_view...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/installation/find_spec.rb
Ruby
mit
298
master
3,266
describe Travis::API::V3::Services::Installation::Find, set_app: true, billing_spec_helper: true do let(:user) { Travis::API::V3::Models::User.find_by_login('svenfuchs') } let!(:installation) { Travis::API::V3::Models::Installation.create(owner_type: 'User', owner_id: user.id, github_id: 789) } let(:token) { T...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/subscription/invoices_spec.rb
Ruby
mit
298
master
2,139
describe Travis::API::V3::Services::Subscription::Invoices, set_app: true, billing_spec_helper: true do let(:parsed_body) { JSON.load(last_response.body) } let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } before do Travis.config.billing.url = billing_url Trav...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/subscription/pay_spec.rb
Ruby
mit
298
master
1,819
describe Travis::API::V3::Services::Subscription::Pay, set_app: true, billing_spec_helper: true do let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } let(:organization) { FactoryBot.create(:org, login: 'travis') } let(:org_authorization) { { 'permissions' => ['account_...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/subscription/update_creditcard_spec.rb
Ruby
mit
298
master
1,390
describe Travis::API::V3::Services::Subscription::UpdateCreditcard, set_app: true, billing_spec_helper: true do let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } before do Travis.config.billing.url = billing_url Travis.config.billing.auth_key = billing_auth_key ...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/subscription/update_address_spec.rb
Ruby
mit
298
master
1,981
describe Travis::API::V3::Services::Subscription::UpdateAddress, set_app: true, billing_spec_helper: true do let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } before do Travis.config.billing.url = billing_url Travis.config.billing.auth_key = billing_auth_key e...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/subscription/update_plan_spec.rb
Ruby
mit
298
master
1,354
describe Travis::API::V3::Services::Subscription::UpdatePlan, set_app: true, billing_spec_helper: true do let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } before do Travis.config.billing.url = billing_url Travis.config.billing.auth_key = billing_auth_key end ...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/subscription/resubscribe_spec.rb
Ruby
mit
298
master
1,535
describe Travis::API::V3::Services::Subscription::Resubscribe, set_app: true, billing_spec_helper: true do let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } before do Travis.config.billing.url = billing_url Travis.config.billing.auth_key = billing_auth_key end...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/subscription/update_payment_details_spec.rb
Ruby
mit
298
master
3,267
describe Travis::API::V3::Services::Subscription::UpdatePaymentDetails, set_app: true, billing_spec_helper: true do let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } before do Travis.config.billing.url = billing_url Travis.config.billing.auth_key = billing_auth_...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/subscription/cancel_spec.rb
Ruby
mit
298
master
1,371
describe Travis::API::V3::Services::Subscription::Cancel, set_app: true, billing_spec_helper: true do let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } let(:reason_data) { {"reason"=>"Other", "reason_details"=>"Cancellation details go here"} } before do Travis.con...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/custom_keys/create_spec.rb
Ruby
mit
298
master
1,983
describe Travis::API::V3::Services::CustomKeys::Create, set_app: true do let(:private_key) { OpenSSL::PKey::RSA.new(TEST_PRIVATE_KEY).to_pem } let(:user) { FactoryBot.create(:user) } let(:token) { Travis::Api::App::AccessToken.create(user: user, app_id: 1) } let(:headers) {{ 'HTTP_AUTHORIZATION' => "token ...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/build/cancel_spec.rb
Ruby
mit
298
master
12,445
describe Travis::API::V3::Services::Build::Cancel, set_app: true do let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } let(:build) { repo.builds.first } let(:payload) { { 'id'=> "#{build.id}", 'user_id' => 1, 'source' => 'api' } } let(:authorization) { { 'p...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/build/priority_spec.rb
Ruby
mit
298
master
6,685
describe Travis::API::V3::Services::Build::Priority, set_app: true do let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } let(:build) { repo.builds.first } let(:org) { Travis::API::V3::Models::Organization.create(login: 'travis-ci', name: 'travis-ci') } let(:...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/build/find_spec.rb
Ruby
mit
298
master
18,389
describe Travis::API::V3::Services::Build::Find, set_app: true do include Support::Formats let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } let(:build) { repo.builds.first } let(:stages) { build.stages } let(:jobs) { Travis::API::V3::Models::Build.f...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/build/restart_spec.rb
Ruby
mit
298
master
16,242
describe Travis::API::V3::Services::Build::Restart, set_app: true do let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } let(:build) { repo.builds.first } let(:payload) { { 'id'=> "#{build.id}", 'user_id' => 1 } } let(:authorization) { { 'permissions' => ['r...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/scan_results/all_spec.rb
Ruby
mit
298
master
4,606
describe Travis::API::V3::Services::ScanResults::All, set_app: true, scanner_spec_helper: true do let(:parsed_body) { JSON.load(last_response.body) } let(:scanner_url) { 'http://scanner' } let(:scanner_auth_key) { 'secret' } before do Travis.config.scanner.url = scanner_url Travis.config.scanner.token ...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/repositories/filter_spec.rb
Ruby
mit
298
master
5,786
describe Travis::API::V3::Services::Repositories::ForCurrentUser, set_app: true do let(:user) { FactoryBot.create(:user) } let(:token) { Travis::Api::App::AccessToken.create(user: user, app_id: 1) } let(:headers) { { 'HTTP_AUTHORIZATION' => "token #{token}" } } before { ActiveRecord::Base.connection.execu...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/repositories/for_current_user_spec.rb
Ruby
mit
298
master
9,850
describe Travis::API::V3::Services::Repositories::ForCurrentUser, set_app: true do let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } let(:build) { repo.builds.first } let(:jobs) { Travis::API::V3::Models::Build.find(build.id).jobs } let(:token) { Travi...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/repositories/for_owner_spec.rb
Ruby
mit
298
master
33,666
describe Travis::API::V3::Services::Repositories::ForOwner, set_app: true, billing_spec_helper: true do include Support::Formats let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } let(:sharedrepo) { Travis::API::V3::Models::Repository.where(owner_name: 'shar...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/active/for_owner_spec.rb
Ruby
mit
298
master
11,804
require 'spec_helper' RSpec::Matchers.define :contain_builds do |*builds| match do |response| response = JSON.parse(response.body) @returned = response['builds'].map { |b| b['id'] } builds.map(&:id).all? { |id| @returned.include?(id) } end failure_message { |_| "expected response #{@returned} to cont...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/v2_subscription/cancel_spec.rb
Ruby
mit
298
master
1,387
describe Travis::API::V3::Services::V2Subscription::Cancel, set_app: true, billing_spec_helper: true do let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } let(:reason_data) { { 'reason' => 'Other', 'reason_details' => 'Cancellation details go here' } } before do Tr...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/v2_subscription/invoices_spec.rb
Ruby
mit
298
master
2,143
describe Travis::API::V3::Services::V2Subscription::Invoices, set_app: true, billing_spec_helper: true do let(:parsed_body) { JSON.load(last_response.body) } let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } before do Travis.config.billing.url = billing_url Tr...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/v2_subscription/update_plan_spec.rb
Ruby
mit
298
master
1,351
describe Travis::API::V3::Services::V2Subscription::UpdatePlan, set_app: true, billing_spec_helper: true do let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } before do Travis.config.billing.url = billing_url Travis.config.billing.auth_key = billing_auth_key en...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/v2_subscription/update_address_spec.rb
Ruby
mit
298
master
1,906
describe Travis::API::V3::Services::V2Subscription::UpdateAddress, set_app: true, billing_spec_helper: true do let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } before do Travis.config.billing.url = billing_url Travis.config.billing.auth_key = billing_auth_key ...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/v2_subscription/pay_spec.rb
Ruby
mit
298
master
1,524
describe Travis::API::V3::Services::V2Subscription::Pay, set_app: true, billing_spec_helper: true do let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } let(:organization) {Travis::API::V3::Models::Organization.create() } before do Travis.config.billing.url = billin...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/v2_subscription/share_spec.rb
Ruby
mit
298
master
2,571
describe Travis::API::V3::Services::V2Subscription::Share, set_app: true, billing_spec_helper: true do let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } let(:receiver) { FactoryBot.create(:org) } let(:data) { {'plan'=> subscription_id, 'receiver_id' => receiver.id } } ...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/v2_subscription/executions_spec.rb
Ruby
mit
298
master
12,570
describe Travis::API::V3::Services::Executions, set_app: true, billing_spec_helper: true do let(:parsed_body) { JSON.load(last_response.body) } let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } let(:user) { Travis::API::V3::Models::User.create(login: 'tester')} let(:...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/v2_subscription/update_payment_details_spec.rb
Ruby
mit
298
master
3,306
describe Travis::API::V3::Services::V2Subscription::UpdatePaymentDetails, set_app: true, billing_spec_helper: true do let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } before do Travis.config.billing.url = billing_url Travis.config.billing.auth_key = billing_aut...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/v2_subscription/update_creditcard_spec.rb
Ruby
mit
298
master
1,489
describe Travis::API::V3::Services::V2Subscription::UpdateCreditcard, set_app: true, billing_spec_helper: true do let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } before do Travis.config.billing.url = billing_url Travis.config.billing.auth_key = billing_auth_ke...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/crons/for_repository_spec.rb
Ruby
mit
298
master
4,419
describe Travis::API::V3::Services::Crons::ForRepository, set_app: true do let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } let(:branch) { Travis::API::V3::Models::Branch.where(repository_id: repo).first } let(:cron) { Travis::API::V3::Models::Cron.create(b...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/caches/find_spec.rb
Ruby
mit
298
master
14,017
require 'spec_helper' describe Travis::API::V3::Services::Caches::Find, set_app: true do let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } let(:build) { repo.builds.first } let(:jobs) { Travis::API::V3::Models::Build.find(build.id).jobs } let(:s3_bucket_...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/caches/delete_spec.rb
Ruby
mit
298
master
16,245
require 'spec_helper' describe Travis::API::V3::Services::Caches::Delete, set_app: true do let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } let(:build) { repo.builds.first } let(:jobs) { Travis::API::V3::Models::Build.find(build.id).jobs } let(:s3_bucket...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/users/suspend_spec.rb
Ruby
mit
298
master
1,953
describe Travis::API::V3::Services::Organization::Suspend, set_app: true do let(:organization_id) { 1 } let(:organization) { FactoryBot.create(:org) } context 'unauthenticated' do it 'responds 403' do post("/v3/users/suspend",JSON.generate({user_ids: [1,2,3]})) expect(last_response.status).to eq(...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/broadcasts/for_current_user_spec.rb
Ruby
mit
298
master
3,077
describe Travis::API::V3::Services::Broadcasts::ForCurrentUser, set_app: true do let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } let(:token) { Travis::Api::App::AccessToken.create(user: repo.owner, app_id: 1) } let(:headers) {{ 'HTTP_AUTHORIZATION' => ...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/credits_calculator/calculator_spec.rb
Ruby
mit
298
master
2,068
describe Travis::API::V3::Services::CreditsCalculator::Calculator, set_app: true, billing_spec_helper: true do let(:parsed_body) { JSON.load(last_response.body) } let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } before do Travis.config.billing.url = billing_url ...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/credits_calculator/default_config_spec.rb
Ruby
mit
298
master
1,547
describe Travis::API::V3::Services::CreditsCalculator::DefaultConfig, set_app: true, billing_spec_helper: true do let(:parsed_body) { JSON.load(last_response.body) } let(:billing_url) { 'http://billingfake.travis-ci.com' } let(:billing_auth_key) { 'secret' } before do Travis.config.billing.url = billing_ur...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/preferences/for_user_spec.rb
Ruby
mit
298
master
2,894
describe Travis::API::V3::Services::Preferences::ForUser, set_app: true do let(:user) { Travis::API::V3::Models::User.create!(name: 'svenfuchs') } let(:token) { Travis::Api::App::AccessToken.create(user: user, app_id: 1) } let(:auth_headers) { { 'HTTP_AUTHORIZATION' => "token #{token}" } } let(:json_headers) { ...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/preferences/for_organization_spec.rb
Ruby
mit
298
master
3,697
describe Travis::API::V3::Services::Preferences::ForOrganization, set_app: true do let(:organization) { Travis::API::V3::Models::Organization.create!(name: 'travis-ci') } let(:user) { Travis::API::V3::Models::User.create!(name: 'svenfuchs') } let(:token) { Travis::Api::App::AccessToken.create(user: user, app_id: ...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/beta_feature/update_spec.rb
Ruby
mit
298
master
4,228
require 'spec_helper' describe Travis::API::V3::Services::BetaFeature::Update, set_app: true do let(:user) { Travis::API::V3::Models::User.where(login: 'svenfuchs').first_or_create } let(:token) { Travis::Api::App::AccessToken.create(user: user, app_id: 1) } let(:beta_feature) { Travis::API::V3::Models::BetaFea...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/beta_feature/delete_spec.rb
Ruby
mit
298
master
1,914
require 'spec_helper' describe Travis::API::V3::Services::BetaFeature::Delete, set_app: true do let(:user) { Travis::API::V3::Models::User.where(login: 'svenfuchs').first_or_create } let(:token) { Travis::Api::App::AccessToken.create(user: user, app_id: 1) } let(:beta_feature) { Travis::API::V3::Models::BetaFea...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/repository/star_spec.rb
Ruby
mit
298
master
5,221
describe Travis::API::V3::Services::Repository::Star, set_app: true do let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } let(:authorization) { { 'permissions' => ['repository_state_update'] } } let(:authorization_role) { { 'roles' => ['repository_admin'] }...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/repository/deactivate_spec.rb
Ruby
mit
298
master
10,011
describe Travis::API::V3::Services::Repository::Deactivate, set_app: true do let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } let(:keys) { [] } let!(:keys_request) do stub_request(:get, "http://vcsfake.travis-ci.com/repos/#{repo.id}/keys?user_id=#{repo....
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/repository/find_spec.rb
Ruby
mit
298
master
22,225
describe Travis::API::V3::Services::Repository::Find, set_app: true do let(:user) { User.where(login: 'svenfuchs').first } let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } let(:build) { repo.builds.first } let(:jobs) { Travis::API::V3::Models::Build.find(...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/repository/unstar_spec.rb
Ruby
mit
298
master
5,241
describe Travis::API::V3::Services::Repository::Unstar, set_app: true do let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } let(:authorization) { { 'permissions' => ['repository_state_update'] } } let(:authorization_role) { { 'roles' => ['repository_admin']...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/repository/activate_spec.rb
Ruby
mit
298
master
8,925
describe Travis::API::V3::Services::Repository::Activate, set_app: true do let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } let(:authorization) { { 'permissions' => ['repository_state_update', 'repository_build_create', 'repository_settings_create', 'reposito...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/repository/update_spec.rb
Ruby
mit
298
master
3,706
describe Travis::API::V3::Services::Repository::Update, set_app: true do let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } before { Travis.config.applications = { app: { full_access: true, token: '12345' } } } after { Travis.config.applications = {} } let...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/build_backups/all_spec.rb
Ruby
mit
298
master
1,939
describe Travis::API::V3::Services::BuildBackups::All, set_app: true do let(:parsed_body) { JSON.parse(last_response.body) } context 'unauthenticated' do it 'responds 403' do get('/v3/build_backups') expect(last_response.status).to eq(403) end end context 'authenticated' do let(:user)...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/organizations/for_current_user_spec.rb
Ruby
mit
298
master
4,795
describe Travis::API::V3::Services::Organizations::ForCurrentUser, set_app: true do let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } let(:token) { Travis::Api::App::AccessToken.create(user: repo.owner, app_id: 1) } let(:headers) {{ 'HTTP_AUTHORIZATION' =>...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/branch/find_spec.rb
Ruby
mit
298
master
2,492
describe Travis::API::V3::Services::Branch::Find, set_app: true do let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } let(:build) { repo.builds.first } before { repo.default_branch.save! } let(:authorization) { { 'permissions' => ['repository_state_update...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/gdpr/purge_spec.rb
Ruby
mit
298
master
991
describe Travis::API::V3::Services::Gdpr::Purge, set_app: true, gdpr_spec_helper: true do let(:gdpr_url) { 'http://gdpr.travis-ci.dev' } let(:gdpr_auth_token) { 'secret' } before do Travis.config.gdpr.endpoint = gdpr_url Travis.config.gdpr.auth_token = gdpr_auth_token end context 'unauthenticated' d...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/services/gdpr/export_spec.rb
Ruby
mit
298
master
996
describe Travis::API::V3::Services::Gdpr::Export, set_app: true, gdpr_spec_helper: true do let(:gdpr_url) { 'http://gdpr.travis-ci.dev' } let(:gdpr_auth_token) { 'secret' } before do Travis.config.gdpr.endpoint = gdpr_url Travis.config.gdpr.auth_token = gdpr_auth_token end context 'unauthenticated' ...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/models/mailer_spec.rb
Ruby
mit
298
master
1,226
describe Travis::API::V3::Models::Mailer do subject { Travis::API::V3::Models::Mailer.new } let(:user) { FactoryBot.create(:user) } let(:organization) { FactoryBot.create(:org_v3) } let!(:membership) { FactoryBot.create(:membership, user: user, organization: organization) } describe '#send_beta_confirmatio...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/models/subscription_spec.rb
Ruby
mit
298
master
1,210
describe Travis::API::V3::Models::Subscription do let(:user) { FactoryBot.create(:user) } let(:attributes) do { 'id' => 1, 'permissions' => { 'read' => true, 'write' => true }, 'valid_to' => Date.today.to_s, 'created_at' => Date.today.to_s, 'cancellation_requested' => false, ...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/models/custom_key_spec.rb
Ruby
mit
298
master
4,040
describe Travis::API::V3::Models::CustomKey do let(:user) { FactoryBot.create(:user) } let(:owner_type) { 'User' } let(:owner_id) { user.id } let(:name) { 'TEST_KEY' } let(:added_by) { user.id } let(:private_key) { OpenSSL::PKey::RSA.new(TEST_PRIVATE_KEY).to_pem } let(:ec_private_key) {"-----BEGIN EC PRI...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/models/credits_result_spec.rb
Ruby
mit
298
master
533
describe Travis::API::V3::Models::CreditsResult do let(:user) { FactoryBot.create(:user) } let(:attributes) do { 'users' => 5, 'minutes' => 1200, 'os' => 'linux', 'instance_size' => '2x-large', 'credits' => 25_000, 'price' => 1_500 } end subject { Travis::API::V3::Mo...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/models/branch_spec.rb
Ruby
mit
298
master
316
describe Travis::API::V3::Models::Branch do let!(:subject) { FactoryBot.create(:branch) } it "cron should be deleted when the related branch is deleted" do cron = FactoryBot.create(:cron, branch: subject) subject.destroy expect(Travis::API::V3::Models::Cron.find_by_id(cron.id)).to be nil end end
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/models/repository_migration_spec.rb
Ruby
mit
298
master
1,256
describe Travis::API::V3::Models::RepositoryMigration do let(:repository) { FactoryBot.create(:repository) } subject { Travis::API::V3::Models::RepositoryMigration.new(repository) } context 'when migration is enabled globally' do context 'when migration is enabled for owner' do before { allow(Travis::...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/models/repository_spec.rb
Ruby
mit
298
master
890
# frozen_string_literal: true describe Travis::API::V3::Models::Repository do let(:repo) { FactoryBot.build :repository } let(:v3_repo) { described_class.new(repo.attributes) } describe '#perforce?' do subject { v3_repo.perforce? } context 'when server_type is perforce' do before { v3_repo.serve...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/models/credits_calculator_config_spec.rb
Ruby
mit
298
master
492
describe Travis::API::V3::Models::CreditsResult do let(:user) { FactoryBot.create(:user) } let(:attributes) do { 'users' => 5, 'minutes' => 1200, 'os' => 'linux', 'instance_size' => '2x-large' } end subject { Travis::API::V3::Models::CreditsCalculatorConfig.new(attributes) } ...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/models/v2_subscription_spec.rb
Ruby
mit
298
master
4,974
describe Travis::API::V3::Models::V2Subscription do let(:user) { FactoryBot.create(:user) } let(:attributes) do { 'id' => 'id', 'permissions' => { 'read' => true, 'write' => true }, 'created_at' => Date.today.to_s, 'status' => nil, 'valid_to' => nil, 'canceled_at' => nil, ...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/models/build_backup_spec.rb
Ruby
mit
298
master
245
describe Travis::API::V3::Models::BuildBackup do let(:build_backup) { FactoryBot.create(:build_backup) } subject { Travis::API::V3::Models::BuildBackup.find_by_id(build_backup.id) } example { expect(subject.file_name).to be_present } end
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/models/fingerprint_spec.rb
Ruby
mit
298
master
1,883
describe Travis::API::V3::Models::Fingerprint do let(:klass_without_implementation) do Class.new do include Travis::API::V3::Models::Fingerprint end end let(:klass_with_nil_source) do Class.new do include Travis::API::V3::Models::Fingerprint def fingerprint_source nil e...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/models/scanner_collection_spec.rb
Ruby
mit
298
master
914
describe Travis::API::V3::Models::ScannerCollection do let(:collection) { [ { id: 1, name: 'test1' }, { id: 2, name: 'test2' }, { id: 3, name: 'test3' } ] } subject { Travis::API::V3::Models::ScannerCollection.new(collection, collection.count) } describe "#count" do it 'returns total_count' do expect(s...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/models/build_spec.rb
Ruby
mit
298
master
544
describe Travis::API::V3::Models::Build do let(:build) { FactoryBot.create(:build, state: nil) } subject { Travis::API::V3::Models::Build.find_by_id(build.id) } example { expect(subject.state).to eq 'created' } describe 'casting sender to V3 model' do let(:sender) { FactoryBot.create(:user) } before ...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/v3/models/cron_spec.rb
Ruby
mit
298
master
6,226
require 'spec_helper' RSpec::Matchers.define :eq_datetime do |*expected| match do |actual| actual.to_i == DateTime.new(*expected).to_i end end describe Travis::API::V3::Models::Cron do let(:subject) { FactoryBot.create(:cron, branch_id: FactoryBot.create(:branch).id) } let!(:scheduler_interval) { Travis:...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/support/private_key.rb
Ruby
mit
298
master
1,701
TEST_PRIVATE_KEY = "-----BEGIN RSA PRIVATE KEY----- MIIEpAIBAAKCAQEA6Dm1n+fc0ILeLWeiwqsWs1MZaGAfccrmpvuxfcE9UaJp2POy 079g+mdiBgtWfnQlU84YX31rU2x9GJwnb8G6UcvkEjqczOgHHmELtaNmrRH1g8qO fJpzXB8XiNib1L3TDs7qYMKLDCbl2bWrcO7Dol9bSqIeb7f9rzkCd4tuXObL3pMD /VIW5uzeVqLBAc0Er+qw6U7clnMnHHMekXt4JSRfauSCxktR2FzigoQbJc8t4iWO rmNi5Q84...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/support/active_record.rb
Ruby
mit
298
master
939
require 'active_record' require 'logger' require 'fileutils' require 'database_cleaner' require 'travis/testing/factories' FileUtils.mkdir_p('log') ActiveRecord.default_timezone = :utc ActiveRecord::Base.logger = Logger.new('log/test.db.log') ActiveRecord::Base.establish_connection(Travis.config.database.to_h) Datab...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/support/payloads.rb
Ruby
mit
298
master
18,879
API_PAYLOADS = { 'custom' => { 'repository' => { 'owner_id' => 2208, 'owner_type' => 'User', 'owner_name' => 'svenfuchs', 'name' => 'gem-release' }, 'branch' => 'master', 'config' => { 'env' => ['FOO=foo', 'BAR=bar'] }, 'user' => { 'id' => 1 } } } GIT...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/support/billing_spec_helper.rb
Ruby
mit
298
master
12,329
module Support module BillingSpecHelper def stub_billing_request(method, path, auth_key:, user_id:) url = URI(billing_url).tap do |url| url.path = path end.to_s stub_request(method, url).with(basic_auth: ['_', auth_key], headers: { 'X-Travis-User-Id' => user_id }) end def billin...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/support/gdpr_spec_helper.rb
Ruby
mit
298
master
358
module Support module GdprSpecHelper def stub_gdpr_request(method, path, user_id:) url = URI(gdpr_url).tap do |url| url.path = path end.to_s stub_request(method, url).with(headers: { 'Authorization' => "Token token=\"#{gdpr_auth_token}\"", 'X-Travis-User-Id' => user_id, 'X-Travis-Source'...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/support/test_helpers.rb
Ruby
mit
298
master
654
require 'sinatra/test_helpers' module TestHelpers include Sinatra::TestHelpers def custom_endpoints @custom_endpoints ||= [] end def add_settings_endpoint(name, options = {}) if options[:singleton] Travis::Api::App::SingletonSettingsEndpoint.subclass(name) else Travis::Api::App::Setti...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/support/formats.rb
Ruby
mit
298
master
1,248
module Support module Formats def json_response response = respond_to?(:last_response) ? last_response : self.response ActiveSupport::JSON.decode(response.body) end def xml_response response = respond_to?(:last_response) ? last_response : self.response ActiveSupport::XmlMini.parse...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/support/s3.rb
Ruby
mit
298
master
1,472
module Support module S3 class FakeObject attr_accessor :key, :size, :last_modified def initialize(key, options = {}) @key = key @size = options[:size] || "0" end end class FakeService attr_reader :buckets def initialize(bucket, objects) @buckets = [...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/support/matchers.rb
Ruby
mit
298
master
2,242
# TODO move to travis-core? RSpec::Matchers.define :deliver_json_for do |resource, options = {}| match do |response| if response.status == 200 actual = parse(response.body) expected = resource.is_a?(Hash) ? resource : Travis::Api::Serialize.data(resource, options) failure_message do "e...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/support/scanner_spec_helper.rb
Ruby
mit
298
master
4,073
module Support module ScannerSpecHelper def stub_scanner_request(method, path, query: '', auth_key:) url = URI(scanner_url).tap do |url| url.path = path url.query = query end.to_s stub_request(method, url).with(headers: { 'Authorization' => "Token token=\"#{auth_key}\"" }) en...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/support/gcs.rb
Ruby
mit
298
master
670
require 'google/apis/storage_v1' module Support module GCS class FakeObject attr_accessor :key, :size def initialize(key, options = {}) @key = key @size = options[:size] || "0" end end class FakeService def authorization=(auth) true end def b...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/support/shared_examples.rb
Ruby
mit
298
master
3,220
RSpec.shared_examples 'not authenticated' do example { expect(last_response.status).to eq(403) } example do expect(JSON.load(body)).to eq( '@type' => 'error', 'error_type' => 'login_required', 'error_message' => 'login required' ) end end RSpec.shared_examples 'paid feature error' do ...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/support/env.rb
Ruby
mit
298
master
430
module Support module Env def self.included(base) base.send(:extend, ClassMethods) end module ClassMethods def env(vars) before { define_env(vars) } after { undefine_env(vars) } end end def define_env(vars) vars.each { |key, value| ENV[key.to_s] = value.t...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/support/ssl_keys.rb
Ruby
mit
298
master
1,056
SSL_KEYS = { :public_key => "-----BEGIN PUBLIC KEY-----\nMDwwDQYJKoZIhvcNAQEBBQADKwAwKAIhALlyZuHmCjZf8pGCUmqz1NESpeVMJoes\nWQblf1p2WhnZAgMBAAE=\n-----END PUBLIC KEY-----\n", :private_key => "-----BEGIN RSA PRIVATE KEY-----\nMIGrAgEAAiEAuXJm4eYKNl/ykYJSarPU0RKl5Uwmh6xZBuV/WnZaGdkCAwEAAQIg\nVHk9Tjd4fW5VU1z25+4...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/unit/default_spec.rb
Ruby
mit
298
master
496
describe Travis::Api::App::Endpoint::Home, set_app: true do describe 'GET /' do it 'replies with a json response by default' do expect(get('/')["Content-Type"]).to include("json") end it 'redirects HTML requests to /docs' do get '/', {}, 'HTTP_ACCEPT' => 'text/html' expect(status).to eq...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/unit/attack_spec.rb
Ruby
mit
298
master
1,057
describe Rack::Attack do describe 'image request' do let(:request) { env = Rack::MockRequest.env_for("https://api-test.travis-ci.org/travis-ci/travis-github-sync.png") Rack::Attack::Request.new(env) } it 'should be safelisted' do expect(Rack::Attack.configuration.safelisted?(request)).t...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/unit/endpoint_spec.rb
Ruby
mit
298
master
1,160
describe Travis::Api::App::Endpoint, set_app: true do let(:token) { Travis::Api::App::AccessToken.create(user: User.last, app_id: 1) } let(:auth_headers) { { 'HTTP_AUTHORIZATION' => "token #{token}" } } class MyEndpoint < Travis::Api::App::Endpoint set :prefix, '/my_endpoint' get('/') { 'ok' } end i...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/unit/access_token_spec.rb
Ruby
mit
298
master
1,625
describe Travis::Api::App::AccessToken do it 'errors out on wrong type of :expires_in argument' do expect { described_class.new(app_id: 1, user_id: 2, expires_in: 'foo') }.to raise_error(ArgumentError, 'expires_in must be of integer type') end it 'allows to skip expires_in' do expect { de...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/unit/cors_spec.rb
Ruby
mit
298
master
1,717
describe Travis::Api::App::Cors do before do mock_app do use Travis::Api::App::Cors get('/check_cors') { 'ok' } end end describe 'normal request' do before { expect(get('/check_cors')).to be_ok } it 'sets Access-Control-Allow-Origin' do expect(headers['Access-Control-Allow-Orig...
github
travis-ci/travis-api
https://github.com/travis-ci/travis-api
spec/unit/middleware/scope_check_spec.rb
Ruby
mit
298
master
2,403
describe Travis::Api::App::Middleware::ScopeCheck do include Travis::Testing::Stubs let :access_token do Travis::Api::App::AccessToken.create(user: user, scope: :foo, app_id: -1) end before do mock_app do use Travis::Api::App::Middleware::ScopeCheck get('/') { 'ok' } get('/token') { ...