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 | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/reactions_spec.rb | Ruby | mit | 3,922 | main | 7,992 | # frozen_string_literal: true
describe Octokit::Client::Reactions do
before do
Octokit.reset!
@client = oauth_client
end
context 'with repository', :vcr do
before(:each) do
@repo = @client.create_repository('an-repo', auto_init: true)
end
after(:each) do
@client.delete_repositor... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/actions_workflow_runs_spec.rb | Ruby | mit | 3,922 | main | 4,902 | # frozen_string_literal: true
describe Octokit::Client::ActionsWorkflowRuns, :vcr do
before do
Octokit.reset!
@client = oauth_client
@run_id = 96_922_843
end
after do
Octokit.reset!
end
describe '.workflow_runs' do
workflow_name = 'workflow.yml'
it 'returns runs for a workflow' do
... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/objects_spec.rb | Ruby | mit | 3,922 | main | 2,629 | # frozen_string_literal: true
describe Octokit::Client::Objects do
before do
Octokit.reset!
@client = oauth_client
end
describe '.tree', :vcr do
it 'gets a tree' do
result = @client.tree('sferik/rails_admin', '3cdfabd973bc3caac209cba903cfdb3bf6636bcd')
expect(result.sha).to eq('3cdfabd97... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/repositories_spec.rb | Ruby | mit | 3,922 | main | 24,871 | # frozen_string_literal: true
require 'faraday-http-cache'
require 'timecop'
describe Octokit::Client::Repositories do
before do
Octokit.reset!
@client = oauth_client
end
describe '.repository', :vcr do
it 'returns the matching repository' do
repository = @client.repository('sferik/rails_admi... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/pages_spec.rb | Ruby | mit | 3,922 | main | 1,970 | # frozen_string_literal: true
describe Octokit::Client::Pages do
before do
Octokit.reset!
@client = oauth_client
end
describe '.pages', :vcr do
it 'lists page information' do
pages = @client.pages('github/developer.github.com')
expect(pages.cname).to eq('developer.github.com')
asse... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/hooks_spec.rb | Ruby | mit | 3,922 | main | 6,243 | # frozen_string_literal: true
describe Octokit::Client::Hooks do
before do
Octokit.reset!
@client = oauth_client
end
context 'with repository' do
before(:each) do
@repo = @client.create_repository('an-repo')
end
after(:each) do
@client.delete_repository(@repo.full_name)
resc... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/environments_spec.rb | Ruby | mit | 3,922 | main | 3,720 | # frozen_string_literal: true
describe Octokit::Client::Environments do
before do
Octokit.reset!
@client = oauth_client
@environment_name = 'octokit-environment'
end
after do
Octokit.reset!
end
describe '.environment', :vcr do
before(:each) do
@client.create_or_update_environment(... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/milestones_spec.rb | Ruby | mit | 3,922 | main | 2,138 | # frozen_string_literal: true
describe Octokit::Client::Milestones do
before do
Octokit.reset!
@client = oauth_client
end
describe '.list_milestones', :vcr do
it 'lists milestones belonging to repository' do
milestones = @client.list_milestones(@test_repo)
expect(milestones).to be_kind_o... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/source_import_spec.rb | Ruby | mit | 3,922 | main | 4,411 | # frozen_string_literal: true
describe Octokit::Client::SourceImport do
before do
Octokit.reset!
@client = oauth_client
end
before(:each) do
@repo = @client.create_repository('an-repo')
end
after(:each) do
@client.delete_repository(@repo.full_name)
rescue Octokit::NotFound
end
descri... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/say_spec.rb | Ruby | mit | 3,922 | main | 580 | # frozen_string_literal: true
describe Octokit::Client::Say do
before do
Octokit.reset!
@client = oauth_client
end
describe '.say', :vcr do
it 'returns an ASCII octocat' do
text = @client.say
expect(text).to match(/MMMMMMMMMMMMMMMMMMMMM/)
assert_requested :get, github_url('/octocat... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/gists_spec.rb | Ruby | mit | 3,922 | main | 6,476 | # frozen_string_literal: true
describe Octokit::Client::Gists do
before do
Octokit.reset!
end
describe 'unauthenticated', :vcr do
describe '.public_gists' do
it 'returns public gists' do
gists = Octokit.client.public_gists
expect(gists).not_to be_empty
assert_requested :get... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/feeds_spec.rb | Ruby | mit | 3,922 | main | 1,372 | # frozen_string_literal: true
describe Octokit::Client::Feeds do
before do
Octokit.reset!
end
describe '.feeds', :vcr do
context 'when unauthenticated' do
it 'returns the public feeds list' do
feeds = Octokit.feeds
expect(Octokit.user_authenticated?).to be false
expect(feed... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/apps_spec.rb | Ruby | mit | 3,922 | main | 13,575 | # frozen_string_literal: true
describe Octokit::Client::Apps do
before(:each) do
Octokit.reset!
@client = oauth_client
@jwt_client = Octokit::Client.new(bearer_token: new_jwt_token)
use_vcr_placeholder_for(@jwt_client.bearer_token, '<JWT_BEARER_TOKEN>')
end
after(:each) do
Octokit.reset!... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/tokens_spec.rb | Ruby | mit | 3,922 | main | 1,033 | # frozen_string_literal: true
require 'securerandom'
describe Octokit::Client::Tokens do
before do
Octokit.reset!
@client = basic_auth_client
@app_client = Octokit::Client.new \
client_id: test_github_client_id,
client_secret: test_github_client_secret
end
after do
Octokit.reset!
... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/commit_branches_spec.rb | Ruby | mit | 3,922 | main | 610 | # frozen_string_literal: true
describe Octokit::Client::CommitBranches do
before do
Octokit.reset!
@client = Octokit::Client.new
end
describe '.commit_branches', :vcr do
it 'returns a list of all branches associated with a commit' do
branches = @client.commit_branches(
'sferik/rails_ad... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/actions_workflow_jobs_spec.rb | Ruby | mit | 3,922 | main | 2,858 | # frozen_string_literal: true
describe Octokit::Client::ActionsWorkflowJobs, :vcr do
before do
Octokit.reset!
@client = oauth_client
@run_id = 3_163_227_438
@attempt_number = 1
@job_id = 69_548_127
end
after do
Octokit.reset!
end
describe '.workflow_run_job' do
it 'returns job f... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/emojis_spec.rb | Ruby | mit | 3,922 | main | 267 | # frozen_string_literal: true
describe Octokit::Client::Emojis do
describe '.emojis', :vcr do
it 'returns all github emojis' do
client = oauth_client
emojis = client.emojis
expect(emojis[:metal]).to match(/metal/)
end
end # .emojis
end |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/stats_spec.rb | Ruby | mit | 3,922 | main | 6,830 | # frozen_string_literal: true
describe Octokit::Client::Stats do
before do
Octokit.reset!
@client = oauth_client
end
context 'with empty repo' do
before do
VCR.turn_off!
stub_request(:any, %r{api\.github\.com/repos/octokit})
.to_return(
{ status: 202 }, # Cold request
... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/pull_requests_spec.rb | Ruby | mit | 3,922 | main | 9,974 | # frozen_string_literal: true
describe Octokit::Client::PullRequests do
before do
Octokit.reset!
@client = oauth_client
end
describe '.pull_requests', :vcr do
it 'lists all pull requests' do
pulls = @client.pulls('octokit/octokit.rb')
expect(pulls).to be_kind_of Array
assert_reques... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/community_profile_spec.rb | Ruby | mit | 3,922 | main | 510 | # frozen_string_literal: true
describe Octokit::Client::CommunityProfile do
before do
Octokit.reset!
@client = oauth_client
end
describe '.community_profile', :vcr do
it 'returns community profile metrics for a repository' do
community_profile = @client.community_profile('octokit/octokit.rb')
... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/marketplace_spec.rb | Ruby | mit | 3,922 | main | 1,493 | # frozen_string_literal: true
describe Octokit::Client::Marketplace do
before(:each) do
Octokit.reset!
@client = oauth_client
@jwt_client = Octokit::Client.new(bearer_token: new_jwt_token)
use_vcr_placeholder_for(@jwt_client.bearer_token, '<JWT_BEARER_TOKEN>')
end
after(:each) do
Octokit... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/repository_invitations_spec.rb | Ruby | mit | 3,922 | main | 2,887 | # frozen_string_literal: true
describe Octokit::Client::RepositoryInvitations do
before do
Octokit.reset!
@client = oauth_client
end
context 'with repository' do
before(:each) do
@repo = @client.create_repository('an-repo', organization: test_github_org)
end
after(:each) do
@cli... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/users_spec.rb | Ruby | mit | 3,922 | main | 12,445 | # frozen_string_literal: true
describe Octokit::Client::Users do
before(:each) do
Octokit.reset!
@client = oauth_client
end
describe '.all_users', :vcr do
it 'returns all GitHub users' do
users = Octokit.all_users
expect(users).to be_kind_of Array
end
end # .all_users
describe '... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/actions_secrets_spec.rb | Ruby | mit | 3,922 | main | 13,389 | # frozen_string_literal: true
require 'rbnacl'
require 'base64'
def create_box(public_key)
b64_key = RbNaCl::PublicKey.new(Base64.decode64(public_key[:key]))
{
key_id: public_key[:key_id],
box: RbNaCl::Boxes::Sealed.from_public_key(b64_key)
}
end
describe Octokit::Client::ActionsSecrets do
before do
... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/legacy_search_spec.rb | Ruby | mit | 3,922 | main | 1,394 | # frozen_string_literal: true
describe Octokit::Client::LegacySearch do
before do
Octokit.reset!
@client = oauth_client
end
describe '.legacy_search_issues', :vcr do
it 'returns matching issues' do
issues = @client.legacy_search_issues('sferik/rails_admin', 'activerecord')
expect(issues)... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/organizations_spec.rb | Ruby | mit | 3,922 | main | 17,581 | # frozen_string_literal: true
describe Octokit::Client::Organizations do
before do
Octokit.reset!
@client = oauth_client
end
describe '.organization', :vcr do
it 'returns an organization' do
organization = @client.organization('codeforamerica')
expect(organization.name).to eq('Code for A... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/commits_spec.rb | Ruby | mit | 3,922 | main | 7,821 | # frozen_string_literal: true
describe Octokit::Client::Commits do
before do
Octokit.reset!
@client = oauth_client
end
describe '.commits', :vcr do
it 'returns all commits' do
commits = @client.commits('sferik/rails_admin')
expect(commits.first.author).not_to be_nil
assert_requeste... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/refs_spec.rb | Ruby | mit | 3,922 | main | 4,112 | # frozen_string_literal: true
describe Octokit::Client::Refs do
before do
Octokit.reset!
@client = oauth_client
end
describe '.matching_refs', :vcr do
it 'returns all matching refs' do
refs = @client.matching_refs('sferik/rails_admin', 'heads/rails')
expect(refs).to be_kind_of Array
... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/codespaces_secrets_spec.rb | Ruby | mit | 3,922 | main | 8,881 | # frozen_string_literal: true
require 'rbnacl'
require 'base64'
def create_box(public_key)
b64_key = RbNaCl::PublicKey.new(Base64.decode64(public_key[:key]))
{
key_id: public_key[:key_id],
box: RbNaCl::Boxes::Sealed.from_public_key(b64_key)
}
end
describe Octokit::Client::CodespacesSecrets do
before ... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/releases_spec.rb | Ruby | mit | 3,922 | main | 5,126 | # frozen_string_literal: true
describe Octokit::Client::Releases do
before do
Octokit.reset!
@client = oauth_client
end
describe '.releases' do
it 'lists releases for a repo', :vcr do
releases = @client.releases @test_repo
expect(releases).to be_kind_of Array
assert_requested :get,... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/dependabot_secrets_spec.rb | Ruby | mit | 3,922 | main | 12,655 | # frozen_string_literal: true
require 'rbnacl'
require 'base64'
def create_box(public_key)
b64_key = RbNaCl::PublicKey.new(Base64.decode64(public_key[:key]))
{
key_id: public_key[:key_id],
box: RbNaCl::Boxes::Sealed.from_public_key(b64_key)
}
end
describe Octokit::Client::DependabotSecrets do
before ... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/rate_limit_spec.rb | Ruby | mit | 3,922 | main | 2,377 | # frozen_string_literal: true
describe Octokit::Client do
subject { Octokit::Client }
let(:client) { Octokit::Client.new }
describe '#rate_limit' do
context 'with no last response' do
it 'makes a response', vcr: { cassette_name: 'rate_limit' } do
rate = client.rate_limit
expect(rate.l... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/traffic_spec.rb | Ruby | mit | 3,922 | main | 1,257 | # frozen_string_literal: true
describe Octokit::Client::Traffic do
describe '.top_referrers', :vcr do
it 'returns the referrers stats for a repository' do
referrers = oauth_client.top_referrers(@test_repo)
expect(referrers).to be_kind_of Array
assert_requested :get, github_url("/repos/#{@test_r... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/search_spec.rb | Ruby | mit | 3,922 | main | 3,447 | # frozen_string_literal: true
describe Octokit::Client::Search do
before do
Octokit.reset!
@client = oauth_client
end
describe '.search_code' do
it 'searches code', :vcr do
results = @client.search_code 'code user:github in:file extension:gemspec -repo:octokit/octokit.rb',
... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/markdown_spec.rb | Ruby | mit | 3,922 | main | 482 | # frozen_string_literal: true
describe Octokit::Client::Markdown do
before do
Octokit.reset!
@client = oauth_client
end
describe '.markdown', :vcr do
it 'renders markdown' do
text = 'This is for #111'
markdown = @client.markdown(text, context: 'octokit/octokit.rb', mode: 'gfm')
ex... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/labels_spec.rb | Ruby | mit | 3,922 | main | 5,627 | # frozen_string_literal: true
describe Octokit::Client::Labels do
before do
Octokit.reset!
@client = oauth_client
end
describe '.labels', :vcr do
it 'returns labels' do
labels = @client.labels('octokit/octokit.rb')
expect(labels).to be_kind_of Array
assert_requested :get, github_ur... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/meta_spec.rb | Ruby | mit | 3,922 | main | 313 | # frozen_string_literal: true
describe Octokit::Client::Meta do
describe '.github_meta', :vcr do
it 'returns meta information about github' do
github_meta = oauth_client.github_meta
expect(github_meta.git).to be
assert_requested :get, github_url('/meta')
end
end # .github_meta
end |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/events_spec.rb | Ruby | mit | 3,922 | main | 3,933 | # frozen_string_literal: true
describe Octokit::Client::Events do
before do
Octokit.reset!
@client = oauth_client
end
describe '.public_events', :vcr do
it 'returns all public events' do
public_events = @client.public_events
expect(public_events).to be_kind_of Array
assert_requeste... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/checks_spec.rb | Ruby | mit | 3,922 | main | 11,854 | # frozen_string_literal: true
describe Octokit::Client::Checks, :vcr do
before do
Octokit.reset!
@client = oauth_client
@path = 'README.md'
@commit = 'e1db7418a77db065d1900e579c82ef0aad1da2b1'
@branch = 'master' # Equivalent to @commit
@tag = 'v1.0' # Equivalent to @commit
@check_suite_i... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/notifications_spec.rb | Ruby | mit | 3,922 | main | 3,133 | # frozen_string_literal: true
describe Octokit::Client::Notifications do
before do
Octokit.reset!
@client = oauth_client
end
describe '.notifications', :vcr do
it 'lists the notifications for the current user' do
notifications = @client.notifications
expect(notifications).to be_kind_of A... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/code_scanning_spec.rb | Ruby | mit | 3,922 | main | 6,304 | # frozen_string_literal: true
describe Octokit::Client::CodeScanning do
before do
@client = oauth_client
@sarif_id = 'fb31fa2c-095d-11ee-98fe-c609abca1772'
@code_scanning_test_repo = 'Caja-de-Dano/active-wrapper'
end
describe '.list_code_scanning_alerts_for_org', :vcr do
it 'lists code scanning ... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/deployments_spec.rb | Ruby | mit | 3,922 | main | 3,605 | # frozen_string_literal: true
describe Octokit::Client::Deployments do
before do
Octokit.reset!
@client = oauth_client
end
after do
Octokit.reset!
end
describe '.deployments', :vcr do
it 'lists deployments' do
deployments = @client.deployments(@test_repo)
expect(deployments).to ... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/issues_spec.rb | Ruby | mit | 3,922 | main | 10,142 | # frozen_string_literal: true
describe Octokit::Client::Issues do
before do
Octokit.reset!
@client = oauth_client
end
after do
Octokit.reset!
end
describe '.list_issues', :vcr do
it 'returns issues for a repository' do
issues = @client.issues('sferik/rails_admin')
expect(issues)... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/licenses_spec.rb | Ruby | mit | 3,922 | main | 764 | # frozen_string_literal: true
require 'base64'
describe Octokit::Client::Licenses do
describe '.licenses', :vcr do
it 'returns all licenses' do
licenses = Octokit.licenses
expect(licenses).to be_kind_of Array
end
end
describe '.license', :vcr do
it 'returns a particular license' do
... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/oauth_applications_spec.rb | Ruby | mit | 3,922 | main | 5,489 | # frozen_string_literal: true
require 'securerandom'
# Right now until we come up with a better way we have to make these tokens
# by hand because the Authorizations API is going away.
#
# See https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api/
describe Octokit::Client::OauthA... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/service_status_spec.rb | Ruby | mit | 3,922 | main | 1,456 | # frozen_string_literal: true
describe Octokit::Client::ServiceStatus do
before do
Octokit.reset!
end
describe '.github_status_summary', :vcr do
it 'returns the current system status summary' do
current_status = Octokit.github_status_summary
expect(current_status.status).not_to be_nil
... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/commit_pulls_spec.rb | Ruby | mit | 3,922 | main | 585 | # frozen_string_literal: true
describe Octokit::Client::CommitPulls do
before do
Octokit.reset!
@client = Octokit::Client.new
end
describe '.commit_pulls', :vcr do
it 'returns a list of all pull requests associated with a commit' do
pulls = @client.commit_pulls(
'sferik/rails_admin',
... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/client/actions_workflows_spec.rb | Ruby | mit | 3,922 | main | 2,444 | # frozen_string_literal: true
describe Octokit::Client::ActionsWorkflows do
before do
Octokit.reset!
@client = oauth_client
end
describe '.workflows', :vcr do
it 'returns the repository workflows' do
@client.workflows(@test_repo)
assert_requested :get, github_url("/repos/#{@test_repo}/a... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/enterprise_admin_client/users_spec.rb | Ruby | mit | 3,922 | main | 3,200 | # frozen_string_literal: true
describe Octokit::EnterpriseAdminClient::Users do
before do
Octokit.reset!
@admin_client = enterprise_admin_client
end
describe '.create_user', :vcr do
it 'creates a new user' do
@admin_client.create_user('foobar', 'notreal@foo.bar')
expect(@admin_client.las... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/enterprise_admin_client/orgs_spec.rb | Ruby | mit | 3,922 | main | 491 | # frozen_string_literal: true
describe Octokit::EnterpriseAdminClient::Orgs do
before do
Octokit.reset!
@admin_client = enterprise_admin_client
end
describe '.create_organization', :vcr do
it 'creates a new organization' do
@admin_client.create_organization('SuchAGreatOrg', 'gjtorikian')
... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/enterprise_admin_client/license_spec.rb | Ruby | mit | 3,922 | main | 627 | # frozen_string_literal: true
describe Octokit::EnterpriseAdminClient::License do
before do
Octokit.reset!
@admin_client = enterprise_admin_client
end
describe '.license_info', :vcr do
it 'returns information about the license' do
license = @admin_client.license_info
expect(license.seat... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/enterprise_admin_client/admin_stats_spec.rb | Ruby | mit | 3,922 | main | 6,294 | # frozen_string_literal: true
describe Octokit::EnterpriseAdminClient::AdminStats do
before do
Octokit.reset!
@admin_client = enterprise_admin_client
end
describe '.admin_stats', :vcr do
it 'returns all available enterprise stats' do
admin_stats = @admin_client.admin_stats
expect(admin_... |
github | octokit/octokit.rb | https://github.com/octokit/octokit.rb | spec/octokit/enterprise_admin_client/search_indexing_spec.rb | Ruby | mit | 3,922 | main | 3,181 | # frozen_string_literal: true
describe Octokit::EnterpriseAdminClient::SearchIndexing do
before do
Octokit.reset!
@admin_client = enterprise_admin_client
end
shared_examples 'search index queuer' do |expected_target|
context 'with a valid target' do
it "queues #{expected_target} to be indexed"... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | Gemfile | Ruby | mit | 3,920 | master | 454 | # rubocop:todo all
source 'https://rubygems.org'
gemspec
require_relative './gemfiles/standard'
standard_dependencies
gem 'actionpack'
gem 'activemodel'
i18n_versions = ['~> 1.0', '>= 1.1']
if RUBY_PLATFORM =~ /java/
# https://github.com/jruby/jruby/issues/6573
i18n_versions << '< 1.8.8'
end
gem 'i18n', *i18n... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | Rakefile | Ruby | mit | 3,920 | master | 5,277 | # frozen_string_literal: true
require 'bundler'
Bundler.setup
ROOT = File.expand_path(File.join(File.dirname(__FILE__)))
$: << File.join(ROOT, 'spec/shared/lib')
require 'rake'
require 'rspec/core/rake_task'
load 'spec/shared/lib/tasks/candidate.rake' if File.exist?('./spec/shared/lib/tasks/candidate.rake')
desc ... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | mongoid.gemspec | Ruby | mit | 3,920 | master | 1,626 | # frozen_string_literal: true
# rubocop:todo all
lib = File.expand_path('../lib/', __FILE__)
$:.unshift lib unless $:.include?(lib)
require "mongoid/version"
Gem::Specification.new do |s|
s.name = "mongoid"
s.version = Mongoid::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["The Mong... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | gemfiles/standard.rb | Ruby | mit | 3,920 | master | 1,024 | def standard_dependencies
gem 'rake'
group :development do
gem 'yard', '>= 0.9.35'
platform :mri do
# Debugger for VSCode.
if !ENV['CI'] && !ENV['DOCKER'] && RUBY_VERSION < '3.0'
gem 'debase'
gem 'ruby-debug-ide'
end
end
# Evergreen configuration generation
g... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | perf/benchmark_ips_iteration_cases.rb | Ruby | mit | 3,920 | master | 1,714 | # frozen_string_literal: true
require 'benchmark/ips'
require 'mongoid'
require './perf/models'
require './perf/gc_suite'
Mongoid.connect_to('mongoid_perf_test')
Mongo::Logger.logger.level = Logger::FATAL
Mongoid.purge!
suite = GCSuite.new
10_000.times do |n|
Person.create(title: "#{n}").tap do |person|
perso... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | perf/benchmark_ips.rb | Ruby | mit | 3,920 | master | 5,076 | # frozen_string_literal: true
require 'benchmark/ips'
require 'mongoid'
require './perf/models'
require './perf/gc_suite'
Mongoid.connect_to('mongoid_perf_test')
Mongo::Logger.logger.level = Logger::FATAL
Mongoid.purge!
puts 'Creating indexes...'
[ Person, Post, Game, Preference ].each(&:create_indexes)
puts 'Star... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | perf/models.rb | Ruby | mit | 3,920 | master | 1,563 | # frozen_string_literal: true
class Person
include Mongoid::Document
field :birth_date, type: Date
field :title, type: String
embeds_one :name, validate: false
embeds_many :addresses, validate: false
has_many :posts, validate: false
has_one :game, validate: false
has_and_belongs_to_many :preferences... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | perf/benchmark_eager_load.rb | Ruby | mit | 3,920 | master | 6,948 | # frozen_string_literal: true
require 'benchmark'
require 'mongoid'
require './perf/models'
Mongoid.connect_to('mongoid_perf_test')
Mongo::Logger.logger.level = Logger::FATAL
Mongoid.purge!
puts 'Creating indexes...'
[ Person, Post, Game, Preference, Account, Comment ].each(&:create_indexes)
puts 'Setting up test... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | perf/profile.rb | Ruby | mit | 3,920 | master | 7,991 | # frozen_string_literal: true
require 'perftools'
require 'mongoid'
require './perf/models'
Mongoid.connect_to('mongoid_perf_test')
Mongoid.purge!
puts 'Starting profiler'
def without_gc
GC.disable
yield
ensure
GC.enable
GC.start
end
without_gc do
puts '[ Root Document #new ]'
PerfTools::CpuProfiler.s... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | perf/gc_suite.rb | Ruby | mit | 3,920 | master | 245 | # frozen_string_literal: true
class GCSuite
def warming(*)
run_gc
end
def running(*)
run_gc
end
def warmup_stats(*); end
def add_report(*); end
private
def run_gc
GC.enable
GC.start
GC.disable
end
end |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | perf/benchmark.rb | Ruby | mit | 3,920 | master | 7,468 | # frozen_string_literal: true
require 'benchmark'
require 'mongoid'
require './perf/models'
Mongoid.connect_to('mongoid_perf_test')
Mongo::Logger.logger.level = Logger::FATAL
Mongoid.purge!
puts 'Creating indexes...'
[ Person, Post, Game, Preference ].each(&:create_indexes)
puts 'Starting benchmark...'
Benchmark... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/mongoid_spec.rb | Ruby | mit | 3,920 | master | 2,446 | # frozen_string_literal: true
require 'spec_helper'
describe Mongoid do
describe '.configure' do
context 'when no block supplied' do
it 'returns the config singleton' do
expect(Mongoid.configure).to eq(Mongoid::Config)
end
end
context 'when a block is given' do
config_override... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/spec_helper.rb | Ruby | mit | 3,920 | master | 6,421 | # frozen_string_literal: true
require 'lite_spec_helper'
MODELS = File.join(File.dirname(__FILE__), 'support/models')
$LOAD_PATH.unshift(MODELS)
require 'action_controller'
require 'rspec/retry'
if SpecConfig.instance.client_debug?
Mongoid.logger.level = Logger::DEBUG
Mongo::Logger.logger.level = Logger::DEBUG
... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/lite_spec_helper.rb | Ruby | mit | 3,920 | master | 2,643 | # frozen_string_literal: true
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'shared', 'lib'))
# Load byebug before mongoid, to place breakpoints in the lib methods.
# But SpecConfig needs the driver co... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/callbacks_models.rb | Ruby | mit | 3,920 | master | 3,153 | class Galaxy
include Mongoid::Document
include Mongoid::Timestamps
field :age, type: Integer
field :was_touched, type: Mongoid::Boolean, default: false
before_validation :set_age
embeds_many :stars
set_callback(:touch, :before) do |_document|
self.was_touched = true
end
private
def set_age
... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/isolation_state_spec.rb | Ruby | mit | 3,920 | master | 5,913 | # frozen_string_literal: true
require 'spec_helper'
describe 'Mongoid::Config.isolation_level' do
def thread_operation(value)
Thread.new do
Mongoid::Threaded.stack(:testing) << value
yield if block_given?
Mongoid::Threaded.stack(:testing)
end.join.value
end
def fiber_operation(value)
... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/discriminator_key_spec.rb | Ruby | mit | 3,920 | master | 9,909 | # frozen_string_literal: true
require 'spec_helper'
describe '#discriminator_key' do
context 'when the discriminator key is not set on a class' do
let(:piano) do
Piano.new
end
let(:guitar) do
Guitar.new
end
it 'sets the child discriminator key to _type: Piano' do
expect(piano... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/app_spec.rb | Ruby | mit | 3,920 | master | 16,299 | # frozen_string_literal: true
require 'spec_helper'
BASE = File.join(File.dirname(__FILE__), '../..')
TMP_BASE = File.join(BASE, 'tmp')
def check_call(cmd, **opts)
puts "Executing #{cmd.join(' ')}"
Mrss::ChildProcessHelper.check_call(cmd, **opts)
end
def gem_version_argument(version)
"_#{version}_" if version... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/stringified_symbol_field_spec.rb | Ruby | mit | 3,920 | master | 4,847 | # rubocop:todo all
require "spec_helper"
describe "StringifiedSymbol fields" do
before do
Order.destroy_all
client.subscribe(Mongo::Monitoring::COMMAND, subscriber)
subscriber.clear_events!
document1
document2
end
after do
client.unsubscribe(Mongo::Monitoring::COMMAND, subscriber)
en... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/discriminator_value_spec.rb | Ruby | mit | 3,920 | master | 4,640 | # frozen_string_literal: true
require 'spec_helper'
describe '#discriminator_key' do
context 'when the discriminator value is not set on a class' do
let(:piano) do
Piano.new
end
let(:guitar) do
Guitar.new
end
it 'sets the child discriminator key to _type: Piano' do
expect(pia... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/dots_and_dollars_spec.rb | Ruby | mit | 3,920 | master | 7,273 | # frozen_string_literal: true
require 'spec_helper'
describe 'Dots and Dollars' do
min_server_version '5.0'
before(:all) do
class DADMUser
include Mongoid::Document
field :'first.last', type: String, default: 'Neil.Shweky'
field :$_amount, type: Integer, default: 0
field :'$a.b', typ... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/bson_regexp_raw_spec.rb | Ruby | mit | 3,920 | master | 391 | # frozen_string_literal: true
require 'spec_helper'
describe BSON::Regexp::Raw do
context 'fully qualified name' do
it 'can be created' do
regexp = BSON::Regexp::Raw.new('foo')
regexp.pattern.should eq 'foo'
end
end
context 'via ::Regexp' do
it 'can be created' do
regexp = Regexp:... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/i18n_fallbacks_spec.rb | Ruby | mit | 3,920 | master | 1,244 | # frozen_string_literal: true
require 'spec_helper'
describe 'i18n fallbacks' do
require_fallbacks
context 'when fallbacks are enabled with a locale list' do
with_default_i18n_configs
before do
I18n.fallbacks[:de] = [ :en ]
end
context 'when translation is present in active locale' do
... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/document_spec.rb | Ruby | mit | 3,920 | master | 1,241 | # frozen_string_literal: true
require 'spec_helper'
describe Mongoid::Document do
context 'when including class uses delegate' do
let(:patient) do
DelegatingPatient.new(
email: Email.new(address: 'test@example.com')
)
end
it 'works for instance level delegation' do
patient.add... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/active_job_spec.rb | Ruby | mit | 3,920 | master | 778 | # frozen_string_literal: true
require 'spec_helper'
begin
require 'active_job'
require 'mongoid/railties/bson_object_id_serializer'
describe 'ActiveJob Serialization' do
skip unless defined?(ActiveJob)
class TestBsonObjectIdSerializerJob < ActiveJob::Base
def perform(*args)
args
end... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/matcher_examples_spec.rb | Ruby | mit | 3,920 | master | 20,978 | # frozen_string_literal: true
require 'spec_helper'
# Some of these tests duplicate the tests in matcher_operator_spec.rb.
# The tests in this file are retained because they use model instances
# rather than simple hashes as the YAML tests do, hence in theory these tests
# could provide additional coverage.
describe... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/server_query_spec.rb | Ruby | mit | 3,920 | master | 3,417 | # frozen_string_literal: true
require 'spec_helper'
# This file serves as a record of server query behavior.
describe 'Server queries' do
context 'scalar operator on scalar field' do
let!(:document) do
Survey.create!(
questions: [ Question.new(
answers: [ Answer.new(position: 3) ]
... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/shardable_spec.rb | Ruby | mit | 3,920 | master | 3,438 | # frozen_string_literal: true
require 'spec_helper'
require_relative '../mongoid/shardable_models'
describe 'Sharding helpers' do
require_topology :sharded
min_server_version '4.4'
describe 'shard_collection rake task' do
let(:shard_collections) do
Mongoid::Tasks::Database.shard_collections([ model_c... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/matcher_operator_spec.rb | Ruby | mit | 3,920 | master | 3,958 | # frozen_string_literal: true
require 'spec_helper'
def mop_error?(spec, kind)
raise ArgumentError, "Bogus kind: #{kind}" unless %w[matcher driver dsl].include?(kind)
spec['error'] == true || spec['error'] == kind ||
(spec['error'].is_a?(Array) && spec['error'].include?(kind))
end
describe 'Matcher operator... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/caching_spec.rb | Ruby | mit | 3,920 | master | 1,739 | # frozen_string_literal: true
require 'spec_helper'
describe 'caching integration tests' do
let(:store) { ActiveSupport::Cache::MemoryStore.new }
context 'without updated_at' do
let(:model1) { Person.create }
let(:model2) { Person.create }
before do
store.write(model1, 'model1')
store.wr... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/callbacks_spec.rb | Ruby | mit | 3,920 | master | 16,767 | # frozen_string_literal: true
require 'spec_helper'
require_relative 'callbacks_models'
describe 'callbacks integration tests' do
context 'when modifying attributes in a callback' do
context 'when creating top-level document' do
context 'top level document' do
let(:instance) do
Galaxy.cr... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/matcher_spec.rb | Ruby | mit | 3,920 | master | 5,230 | # frozen_string_literal: true
require 'spec_helper'
describe 'Matcher operators' do
let(:result) do
document._matches?(query)
end
shared_examples 'is true' do
it 'is true' do
result.should be true
end
end
shared_examples 'is false' do
it 'is false' do
result.should be false
... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/encryption_spec.rb | Ruby | mit | 3,920 | master | 3,282 | require 'spec_helper'
require 'support/crypt/models'
describe 'Encryption' do
require_enterprise
require_libmongocrypt
include_context 'with encryption'
restore_config_clients
let(:config) do
{
default: { hosts: SpecConfig.instance.addresses, database: database_id },
key_vault: { hosts: Spec... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/atomic/modifiers_spec.rb | Ruby | mit | 3,920 | master | 4,393 | # frozen_string_literal: true
require 'spec_helper'
describe Mongoid::Atomic::Modifiers do
let(:modifiers) do
described_class.new
end
context 'when performing multiple operations with similar keys' do
let(:pushes) do
{ 'addresses.0.locations' => { 'street' => 'Bond St' } }
end
let(:simil... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/persistence/collection_options_spec.rb | Ruby | mit | 3,920 | master | 842 | # frozen_string_literal: true
require 'spec_helper'
describe 'Collection options' do
before(:all) do
class CollectionOptionsCapped
include Mongoid::Document
store_in collection_options: {
capped: true,
size: 25_600
}
end
end
after(:all) do
CollectionOptionsCapped.... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/persistence/range_field_spec.rb | Ruby | mit | 3,920 | master | 11,499 | # frozen_string_literal: true
require 'spec_helper'
describe 'Range field persistence' do
subject { person.send(field) }
let!(:person) { Person.create!(field => value).reload }
let(:now_utc) { Time.now }
let(:later_utc) { now_utc + 10.minutes }
let(:now_in_zone) { now_utc.in_time_zone('Asia/Tokyo') }
let... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/contextual/empty_spec.rb | Ruby | mit | 3,920 | master | 2,768 | # frozen_string_literal: true
require 'spec_helper'
describe 'Contextual classes when dealing with empty result set' do
shared_examples 'behave as expected' do
describe '#exists?' do
it 'is false' do
context.exists?.should be false
end
end
describe '#count' do
it 'is 0' do
... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/associations/scope_option_spec.rb | Ruby | mit | 3,920 | master | 4,609 | # frozen_string_literal: true
require 'spec_helper'
require_relative '../../mongoid/association/referenced/has_and_belongs_to_many_models'
require_relative '../../mongoid/association/referenced/has_many_models'
require_relative '../../mongoid/association/referenced/has_one_models'
describe 'association :scope option'... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/associations/embedded_spec.rb | Ruby | mit | 3,920 | master | 9,359 | # frozen_string_literal: true
require 'spec_helper'
require_relative '../../mongoid/association/embedded/embeds_many_models'
require_relative '../../mongoid/association/embedded/embeds_one_models'
describe 'embedded associations' do
context 'without default order' do
let(:congress) do
EmmCongress.create!
... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/associations/embedded_dirty_spec.rb | Ruby | mit | 3,920 | master | 1,548 | # frozen_string_literal: true
require 'spec_helper'
require_relative '../../mongoid/association/embedded/embeds_many_models'
require_relative '../../mongoid/association/embedded/embeds_one_models'
describe 'embedded associations' do
describe 'dirty tracking' do
context 'when association is cyclic' do
befo... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/associations/foreign_key_spec_models.rb | Ruby | mit | 3,920 | master | 1,763 | # frozen_string_literal: true
module ForeignKeySpec
class Company
include Mongoid::Document
field :c, type: String
has_many :emails, class_name: 'ForeignKeySpec::Email',
foreign_key: 'c_ref', primary_key: 'c'
has_one :founder, class_name: 'ForeignKeySpec::Founder',
... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/associations/has_one_spec.rb | Ruby | mit | 3,920 | master | 8,592 | # frozen_string_literal: true
require 'spec_helper'
require 'mongoid/association/referenced/has_one_models'
describe 'has_one associations' do
context 'destroying parent in transaction with dependent child' do
require_transaction_support
let(:college) { HomCollege.create! }
let(:address) { HomAddress.c... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/associations/has_many_spec.rb | Ruby | mit | 3,920 | master | 4,904 | # frozen_string_literal: true
require 'spec_helper'
require 'mongoid/association/referenced/has_many_models'
describe 'has_many associations' do
context 'destroying parent in transaction with dependent child' do
require_transaction_support
let(:company) { HmmCompany.create! }
let(:address) { HmmAddress... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/associations/foreign_key_spec.rb | Ruby | mit | 3,920 | master | 3,622 | # frozen_string_literal: true
require 'spec_helper'
require_relative 'foreign_key_spec_models'
describe 'Association foreign key configuration' do
describe 'has_many/belongs_to' do
it 'creates child' do
company = ForeignKeySpec::Company.create!(c: 'test')
email = ForeignKeySpec::Email.create!(compan... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/associations/belongs_to_spec.rb | Ruby | mit | 3,920 | master | 5,743 | # frozen_string_literal: true
require 'spec_helper'
require 'support/feature_sandbox'
require_relative '../../mongoid/association/referenced/has_one_models'
def quarantine(context, polymorphic:, dept_aliases:, team_aliases:)
state = {}
context.before(:context) do
state[:quarantine] = FeatureSandbox.start_qu... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/associations/embeds_one_spec.rb | Ruby | mit | 3,920 | master | 1,519 | # frozen_string_literal: true
require 'spec_helper'
describe 'embeds_one associations' do
context 'when re-associating the same object' do
context 'with dependent: destroy' do
let(:canvas) do
Canvas.create!(palette: Palette.new)
end
let!(:palette) { canvas.palette }
it 'does no... |
github | mongodb/mongoid | https://github.com/mongodb/mongoid | spec/integration/associations/nested_attributes_assignment_spec.rb | Ruby | mit | 3,920 | master | 3,177 | # frozen_string_literal: true
require 'spec_helper'
describe 'nested attributes assignment' do
context 'when creating parent document' do
context 'when setting deeply nested attributes' do
context 'embeds_many' do
let(:truck) { Truck.new }
it 'persists all documents' do
truck.at... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.