octokit 1.25.0 → 2.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +10 -7
- data/lib/octokit.rb +22 -15
- data/lib/octokit/arguments.rb +14 -0
- data/lib/octokit/authentication.rb +48 -25
- data/lib/octokit/client.rb +245 -44
- data/lib/octokit/client/authorizations.rb +36 -10
- data/lib/octokit/client/commit_comments.rb +96 -0
- data/lib/octokit/client/commits.rb +152 -94
- data/lib/octokit/client/contents.rb +32 -24
- data/lib/octokit/client/downloads.rb +11 -7
- data/lib/octokit/client/emojis.rb +3 -1
- data/lib/octokit/client/events.rb +62 -18
- data/lib/octokit/client/gists.rb +27 -26
- data/lib/octokit/client/gitignore.rb +7 -3
- data/lib/octokit/client/issues.rb +43 -71
- data/lib/octokit/client/labels.rb +24 -20
- data/lib/octokit/client/legacy_search.rb +78 -0
- data/lib/octokit/client/markdown.rb +6 -1
- data/lib/octokit/client/meta.rb +21 -0
- data/lib/octokit/client/milestones.rb +13 -9
- data/lib/octokit/client/notifications.rb +24 -64
- data/lib/octokit/client/objects.rb +17 -12
- data/lib/octokit/client/organizations.rb +43 -52
- data/lib/octokit/client/pub_sub_hubbub.rb +68 -8
- data/lib/octokit/client/{pulls.rb → pull_requests.rb} +65 -41
- data/lib/octokit/client/rate_limit.rb +42 -8
- data/lib/octokit/client/refs.rb +16 -10
- data/lib/octokit/client/repositories.rb +73 -124
- data/lib/octokit/client/say.rb +7 -1
- data/lib/octokit/client/service_status.rb +39 -0
- data/lib/octokit/client/stats.rb +12 -6
- data/lib/octokit/client/statuses.rb +8 -29
- data/lib/octokit/client/users.rb +56 -75
- data/lib/octokit/configurable.rb +117 -0
- data/lib/octokit/default.rb +140 -0
- data/lib/octokit/error.rb +6 -5
- data/lib/octokit/gist.rb +11 -0
- data/lib/octokit/rate_limit.rb +22 -0
- data/lib/octokit/repo_arguments.rb +19 -0
- data/lib/octokit/repository.rb +11 -4
- data/lib/octokit/response/raise_error.rb +35 -0
- data/lib/octokit/version.rb +5 -1
- data/octokit.gemspec +4 -9
- data/spec/cassettes/Octokit_Client/_get/handles_query_params.json +1 -0
- data/spec/cassettes/Octokit_Client/_head/handles_query_params.json +1 -0
- data/spec/cassettes/Octokit_Client/_last_response/caches_the_last_agent_response.json +1 -0
- data/spec/cassettes/Octokit_Client/authentication/when_token_authenticated/fetches_and_memoizes_login.json +1 -0
- data/spec/cassettes/Octokit_Client/auto_pagination/fetches_all_the_pages.json +1 -0
- data/spec/cassettes/Octokit_Client/error_handling/raises_on_404.json +1 -0
- data/spec/cassettes/Octokit_Client_Authorizations/_authorization/returns_a_single_authorization.json +1 -0
- data/spec/cassettes/Octokit_Client_Authorizations/_authorizations/lists_existing_authorizations.json +1 -0
- data/spec/cassettes/Octokit_Client_Authorizations/_create_authorization/creates_a_new_authorization_with_options.json +1 -0
- data/spec/cassettes/Octokit_Client_Authorizations/_create_authorization/creates_an_API_authorization.json +1 -0
- data/spec/cassettes/Octokit_Client_Authorizations/_scopes/checks_the_scopes_on_a_one-off_token.json +1 -0
- data/spec/cassettes/Octokit_Client_Authorizations/_scopes/checks_the_scopes_on_the_current_token.json +1 -0
- data/spec/cassettes/Octokit_Client_Authorizations/_update_authorization/updates_and_existing_authorization.json +1 -0
- data/spec/cassettes/Octokit_Client_CommitComments/_commit_comment/returns_a_single_commit_comment.json +1 -0
- data/spec/cassettes/Octokit_Client_CommitComments/_commit_comments/returns_a_list_of_comments_for_a_specific_commit.json +1 -0
- data/spec/cassettes/Octokit_Client_CommitComments/_create_commit_comment/creates_a_commit_comment.json +1 -0
- data/spec/cassettes/Octokit_Client_CommitComments/_delete_commit_comment/deletes_a_commit_comment.json +1 -0
- data/spec/cassettes/Octokit_Client_CommitComments/_list_commit_comments/returns_a_list_of_all_commit_comments.json +1 -0
- data/spec/cassettes/Octokit_Client_CommitComments/_update_commit_comment/updates_a_commit_comment.json +1 -0
- data/spec/cassettes/Octokit_Client_Commits/_commit/returns_a_commit.json +1 -0
- data/spec/cassettes/Octokit_Client_Commits/_commits/handles_branch_or_sha_argument.json +1 -0
- data/spec/cassettes/Octokit_Client_Commits/_commits/handles_the_sha_option.json +1 -0
- data/spec/cassettes/Octokit_Client_Commits/_commits/returns_all_commits.json +1 -0
- data/spec/cassettes/Octokit_Client_Commits/_commits_before/handles_branch_or_sha_argument.json +1 -0
- data/spec/cassettes/Octokit_Client_Commits/_commits_before/handles_the_sha_option.json +1 -0
- data/spec/cassettes/Octokit_Client_Commits/_commits_before/returns_all_commits_until_the_specified_date.json +1 -0
- data/spec/cassettes/Octokit_Client_Commits/_commits_between/handles_branch_or_sha_argument.json +1 -0
- data/spec/cassettes/Octokit_Client_Commits/_commits_between/handles_the_sha_option.json +1 -0
- data/spec/cassettes/Octokit_Client_Commits/_commits_between/returns_all_commits_until_the_specified_date.json +1 -0
- data/spec/cassettes/Octokit_Client_Commits/_commits_on/handles_branch_or_sha_argument.json +1 -0
- data/spec/cassettes/Octokit_Client_Commits/_commits_on/handles_the_sha_option.json +1 -0
- data/spec/cassettes/Octokit_Client_Commits/_commits_on/returns_all_commits_on_the_specified_date.json +1 -0
- data/spec/cassettes/Octokit_Client_Commits/_commits_since/handles_branch_or_sha_argument.json +1 -0
- data/spec/cassettes/Octokit_Client_Commits/_commits_since/handles_the_sha_option.json +1 -0
- data/spec/cassettes/Octokit_Client_Commits/_commits_since/returns_all_commits_since_the_specified_date.json +1 -0
- data/spec/cassettes/Octokit_Client_Commits/_compare/returns_a_comparison.json +1 -0
- data/spec/cassettes/Octokit_Client_Commits/_create_commit/creates_a_commit.json +1 -0
- data/spec/cassettes/Octokit_Client_Commits/_merge/merges_a_branch_into_another.json +1 -0
- data/spec/cassettes/Octokit_Client_Contents/_archive_link/returns_the_headers_of_the_request.json +1 -0
- data/spec/cassettes/Octokit_Client_Contents/_contents/returns_the_contents_of_a_file.json +1 -0
- data/spec/cassettes/Octokit_Client_Contents/_create_contents/creates_contents_from_File_object.json +1 -0
- data/spec/cassettes/Octokit_Client_Contents/_create_contents/creates_contents_from_file_path.json +1 -0
- data/spec/cassettes/Octokit_Client_Contents/_create_contents/creates_repository_contents_at_a_path.json +1 -0
- data/spec/cassettes/Octokit_Client_Contents/_delete_contents/deletes_repository_contents_at_a_path.json +1 -0
- data/spec/cassettes/Octokit_Client_Contents/_readme/returns_the_default_readme.json +1 -0
- data/spec/cassettes/Octokit_Client_Contents/_update_contents/updates_repository_contents_at_a_path.json +1 -0
- data/spec/cassettes/Octokit_Client_Downloads/_download/gets_a_single_download.json +1 -0
- data/spec/cassettes/Octokit_Client_Downloads/_downloads/lists_available_downloads.json +1 -0
- data/spec/cassettes/Octokit_Client_Downloads/methods_that_require_a_download/_create_download/creates_a_download_resource.json +1 -0
- data/spec/cassettes/Octokit_Client_Downloads/methods_that_require_a_download/_create_download/posts_to_an_S3_url.json +1 -0
- data/spec/cassettes/Octokit_Client_Downloads/methods_that_require_a_download/_delete_download/deletes_a_download.json +1 -0
- data/spec/cassettes/Octokit_Client_Emojis/_emojis/returns_all_github_emojis.json +1 -0
- data/spec/cassettes/Octokit_Client_Events/_issue_event/lists_issue_events_for_a_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Events/_issue_events/lists_issue_events_for_a_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Events/_organization_events/returns_all_events_for_an_organization.json +1 -0
- data/spec/cassettes/Octokit_Client_Events/_organization_public_events/returns_an_organization_s_public_events.json +1 -0
- data/spec/cassettes/Octokit_Client_Events/_public_events/returns_all_public_events.json +1 -0
- data/spec/cassettes/Octokit_Client_Events/_received_events/returns_all_user_received_events.json +1 -0
- data/spec/cassettes/Octokit_Client_Events/_received_public_events/returns_public_user_received_events.json +1 -0
- data/spec/cassettes/Octokit_Client_Events/_repo_issue_events/lists_issue_events_for_a_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Events/_repository_events/returns_events_for_a_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Events/_repository_network_events/returns_events_for_a_repository_s_network.json +1 -0
- data/spec/cassettes/Octokit_Client_Events/_user_events/returns_all_user_events.json +1 -0
- data/spec/cassettes/Octokit_Client_Events/_user_public_events/returns_public_events_performed_by_a_user.json +1 -0
- data/spec/cassettes/Octokit_Client_Gists/unauthenticated/_gist/returns_the_gist_by_ID.json +1 -0
- data/spec/cassettes/Octokit_Client_Gists/unauthenticated/_gists/with_username_passed/returns_a_list_of_gists.json +1 -0
- data/spec/cassettes/Octokit_Client_Gists/unauthenticated/_gists/without_a_username_passed/returns_a_list_of_gists.json +1 -0
- data/spec/cassettes/Octokit_Client_Gists/unauthenticated/_public_gists/returns_public_gists.json +1 -0
- data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_create_gist/creates_a_new_gist.json +1 -0
- data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_create_gist_comment/creates_a_gist_comment.json +1 -0
- data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_delete_gist/deletes_an_existing_gist.json +1 -0
- data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_delete_gist_comment/deletes_a_gist_comment.json +1 -0
- data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_edit_gist/edit_an_existing_gist.json +1 -0
- data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_fork_gist/forks_an_existing_gist.json +1 -0
- data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_gist_comment/returns_a_gist_comment.json +1 -0
- data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_gist_comments/returns_the_list_of_gist_comments.json +1 -0
- data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_gist_starred_/is_not_starred.json +1 -0
- data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_gist_starred_/is_starred.json +1 -0
- data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_gists/returns_a_list_of_gists.json +1 -0
- data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_star_gist/stars_an_existing_gist.json +1 -0
- data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_starred_gists/returns_the_user_s_starred_gists.json +1 -0
- data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_unstar_gist/unstars_an_existing_gist.json +1 -0
- data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_update_gist_comment/updates_a_gist_comment.json +1 -0
- data/spec/cassettes/Octokit_Client_Gitignore/_gitignore_template/returns_the_ruby_gitignore_template.json +1 -0
- data/spec/cassettes/Octokit_Client_Gitignore/_gitignore_templates/returns_all_gitignore_templates.json +1 -0
- data/spec/cassettes/Octokit_Client_Issues/_create_issue/creates_an_issue.json +1 -0
- data/spec/cassettes/Octokit_Client_Issues/_create_issue/creates_an_issue_with_delimited_labels.json +1 -0
- data/spec/cassettes/Octokit_Client_Issues/_create_issue/creates_an_issue_with_labels_array.json +1 -0
- data/spec/cassettes/Octokit_Client_Issues/_issue_comment/returns_a_single_comment_for_an_issue.json +1 -0
- data/spec/cassettes/Octokit_Client_Issues/_issue_comments/returns_comments_for_an_issue.json +1 -0
- data/spec/cassettes/Octokit_Client_Issues/_list_issues/returns_dashboard_issues_for_the_authenticated_user.json +1 -0
- data/spec/cassettes/Octokit_Client_Issues/_list_issues/returns_issues_for_a_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Issues/_org_issues/returns_issues_for_the_organization_for_the_authenticated_user.json +1 -0
- data/spec/cassettes/Octokit_Client_Issues/_repository_issues_comments/returns_comments_for_all_issues_in_a_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Issues/_user_issues/returns_issues_for_the_authenticated_user_for_owned_and_member_repos.json +1 -0
- data/spec/cassettes/Octokit_Client_Issues/methods_requiring_a_new_issue/_add_comment/adds_a_comment.json +1 -0
- data/spec/cassettes/Octokit_Client_Issues/methods_requiring_a_new_issue/_close_issue/closes_an_issue.json +1 -0
- data/spec/cassettes/Octokit_Client_Issues/methods_requiring_a_new_issue/_issue/returns_a_full_issue.json +1 -0
- data/spec/cassettes/Octokit_Client_Issues/methods_requiring_a_new_issue/_issue/returns_an_issue.json +1 -0
- data/spec/cassettes/Octokit_Client_Issues/methods_requiring_a_new_issue/_reopen_issue/reopens_an_issue.json +1 -0
- data/spec/cassettes/Octokit_Client_Issues/methods_requiring_a_new_issue/_update_issue/updates_an_issue.json +1 -0
- data/spec/cassettes/Octokit_Client_Issues/methods_requiring_a_new_issue/methods_requiring_a_new_issue_comment/_delete_comment/deletes_an_existing_comment.json +1 -0
- data/spec/cassettes/Octokit_Client_Issues/methods_requiring_a_new_issue/methods_requiring_a_new_issue_comment/_update_comment/updates_an_existing_comment.json +1 -0
- data/spec/cassettes/Octokit_Client_Labels/_add_label/adds_a_label_with_a_color.json +1 -0
- data/spec/cassettes/Octokit_Client_Labels/_add_label/adds_a_label_with_default_color.json +1 -0
- data/spec/cassettes/Octokit_Client_Labels/_delete_label_/deletes_a_label_from_the_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Labels/_label/returns_a_single_label.json +1 -0
- data/spec/cassettes/Octokit_Client_Labels/_labels/returns_labels.json +1 -0
- data/spec/cassettes/Octokit_Client_Labels/_lables_for_milestone/returns_all_labels_for_a_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Labels/methods_requiring_a_new_issue/_add_labels_to_an_issue/adds_labels_to_a_given_issue.json +1 -0
- data/spec/cassettes/Octokit_Client_Labels/methods_requiring_a_new_issue/_labels_for_issue/returns_all_labels_for_a_given_issue.json +1 -0
- data/spec/cassettes/Octokit_Client_Labels/methods_requiring_a_new_issue/_remove_all_labels/removes_all_labels_from_the_specified_issue.json +1 -0
- data/spec/cassettes/Octokit_Client_Labels/methods_requiring_a_new_issue/_remove_label/removes_a_label_from_the_specified_issue.json +1 -0
- data/spec/cassettes/Octokit_Client_Labels/methods_requiring_a_new_issue/_replace_all_labels/replaces_all_labels_for_an_issue.json +1 -0
- data/spec/cassettes/Octokit_Client_Labels/methods_requiring_a_new_label/_update_label/updates_a_label_with_a_new_color.json +1 -0
- data/spec/cassettes/Octokit_Client_LegacySearch/_legacy_search_issues/returns_matching_issues.json +1 -0
- data/spec/cassettes/Octokit_Client_LegacySearch/_legacy_search_repos/returns_matching_repositories.json +1 -0
- data/spec/cassettes/Octokit_Client_LegacySearch/_legacy_search_users/returns_matching_username.json +1 -0
- data/spec/cassettes/Octokit_Client_Markdown/_markdown/renders_markdown.json +1 -0
- data/spec/cassettes/Octokit_Client_Meta/_github_meta/returns_meta_information_about_github.json +1 -0
- data/spec/cassettes/Octokit_Client_Milestones/_list_milestones/lists_milestones_belonging_to_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Milestones/methods_that_need_a_milestone/_create_milestone/creates_a_milestone.json +1 -0
- data/spec/cassettes/Octokit_Client_Milestones/methods_that_need_a_milestone/_delete_milestone/deletes_a_milestone_from_a_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Milestones/methods_that_need_a_milestone/_milestone/gets_a_single_milestone_belonging_to_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Milestones/methods_that_need_a_milestone/_update_milestone/updates_a_milestone.json +1 -0
- data/spec/cassettes/Octokit_Client_Notifications/_mark_notifications_as_read/returns_true_when_notifications_are_marked_as_read.json +1 -0
- data/spec/cassettes/Octokit_Client_Notifications/_mark_repository_notifications_as_read/returns_true_when_notifications_for_a_repo_are_marked_as_read.json +1 -0
- data/spec/cassettes/Octokit_Client_Notifications/_notifications/lists_the_notifications_for_the_current_user.json +1 -0
- data/spec/cassettes/Octokit_Client_Notifications/_repository_notifications/lists_all_notifications_for_a_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Notifications/methods_that_need_a_thread_context/_delete_thread_subscription/returns_true_with_successful_thread_deletion.json +1 -0
- data/spec/cassettes/Octokit_Client_Notifications/methods_that_need_a_thread_context/_mark_thread_as_read/marks_a_thread_as_read.json +1 -0
- data/spec/cassettes/Octokit_Client_Notifications/methods_that_need_a_thread_context/_thread_notifications/returns_notifications_for_a_specific_thread.json +1 -0
- data/spec/cassettes/Octokit_Client_Notifications/methods_that_need_a_thread_context/_thread_subscription/returns_a_thread_subscription.json +1 -0
- data/spec/cassettes/Octokit_Client_Notifications/methods_that_need_a_thread_context/_update_thread_subscription/updates_a_thread_subscription.json +1 -0
- data/spec/cassettes/Octokit_Client_Objects/_blob/returns_a_blob.json +1 -0
- data/spec/cassettes/Octokit_Client_Objects/_create_blob/creates_a_blob.json +1 -0
- data/spec/cassettes/Octokit_Client_Objects/_create_tag/creates_a_tag.json +1 -0
- data/spec/cassettes/Octokit_Client_Objects/_create_tree/creates_a_tree.json +1 -0
- data/spec/cassettes/Octokit_Client_Objects/_tag/returns_a_tag.json +1 -0
- data/spec/cassettes/Octokit_Client_Objects/_tree/gets_a_tree.json +1 -0
- data/spec/cassettes/Octokit_Client_Objects/_tree/gets_a_tree_recursively.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/_organization/returns_an_organization.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/_organization_member_/checks_organization_membership.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/_organization_members/returns_all_public_members_of_an_organization.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/_organization_public_member_/checks_publicized_org_membership.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/_organization_repositories/returns_all_public_repositories_for_an_organization.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/_organization_teams/returns_all_teams_for_an_organization.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/_organizations/returns_all_organizations_for_a_user.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/_organizations/returns_all_organizations_for_the_authenticated_user.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/_update_organization/updates_an_organization.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_add_team_member/adds_a_team_member.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_add_team_repository/adds_a_team_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_create_team/creates_a_team.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_delete_team/deletes_a_team.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_publicize_membership/publicizes_membership.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_remove_team_member/removes_a_team_member.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_remove_team_repository/removes_a_team_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_team/returns_a_team.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_team_member_/checks_if_a_user_is_member_of_a_team.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_team_members/returns_team_members.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_team_repositories/returns_team_repositories.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_unpublicize_membership/unpublicizes_membership.json +1 -0
- data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_update_team/updates_a_team.json +1 -0
- data/spec/cassettes/Octokit_Client_PubSubHubbub/_subscribe/raises_an_error_when_topic_is_not_recognized.json +1 -0
- data/spec/cassettes/Octokit_Client_PubSubHubbub/_subscribe/subscribes_to_pull_events.json +1 -0
- data/spec/cassettes/Octokit_Client_PubSubHubbub/_subscribe_service_hook/subscribes_to_pull_events_on_specified_topic.json +1 -0
- data/spec/cassettes/Octokit_Client_PubSubHubbub/_unsubscribe/unsubscribes_from_pull_events.json +1 -0
- data/spec/cassettes/Octokit_Client_PubSubHubbub/unsubscribe_service_hook/unsubscribes_to_stop_receiving_events_on_specified_topic.json +1 -0
- data/spec/cassettes/Octokit_Client_PullRequests/_create_pull_request_for_issue/creates_a_pull_request_and_attach_it_to_an_existing_issue.json +1 -0
- data/spec/cassettes/Octokit_Client_PullRequests/_pull_request_comment/returns_a_comment_on_a_pull_request.json +1 -0
- data/spec/cassettes/Octokit_Client_PullRequests/_pull_request_comments/returns_the_comments_for_a_pull_request.json +1 -0
- data/spec/cassettes/Octokit_Client_PullRequests/_pull_request_commits/returns_the_commits_for_a_pull_request.json +1 -0
- data/spec/cassettes/Octokit_Client_PullRequests/_pull_request_files/lists_files_for_a_pull_request.json +1 -0
- data/spec/cassettes/Octokit_Client_PullRequests/_pull_requests/returns_all_pull_requests.json +1 -0
- data/spec/cassettes/Octokit_Client_PullRequests/_pull_requests_comments/returns_all_comments_on_all_pull_requests.json +1 -0
- data/spec/cassettes/Octokit_Client_PullRequests/methods_that_require_a_new_pull/_close_pull_request/closes_a_pull_request.json +1 -0
- data/spec/cassettes/Octokit_Client_PullRequests/methods_that_require_a_new_pull/_create_pull_request/creates_a_pull_request.json +1 -0
- data/spec/cassettes/Octokit_Client_PullRequests/methods_that_require_a_new_pull/_merge_pull_request/merges_the_pull_request.json +1 -0
- data/spec/cassettes/Octokit_Client_PullRequests/methods_that_require_a_new_pull/_pull_merged_/returns_whether_the_pull_request_has_been_merged.json +1 -0
- data/spec/cassettes/Octokit_Client_PullRequests/methods_that_require_a_new_pull/_pull_request/returns_a_pull_request.json +1 -0
- data/spec/cassettes/Octokit_Client_PullRequests/methods_that_require_a_new_pull/_update_pull_request/updates_a_pull_request.json +1 -0
- data/spec/cassettes/Octokit_Client_PullRequests/methods_that_require_a_new_pull/methods_requiring_a_pull_request_comment/_create_pull_request_comment/creates_a_new_comment_on_a_pull_request.json +1 -0
- data/spec/cassettes/Octokit_Client_PullRequests/methods_that_require_a_new_pull/methods_requiring_a_pull_request_comment/_create_pull_request_comment_reply/creates_a_new_reply_to_a_pull_request_comment.json +1 -0
- data/spec/cassettes/Octokit_Client_PullRequests/methods_that_require_a_new_pull/methods_requiring_a_pull_request_comment/_delete_pull_request_comment/deletes_a_pull_request_comment.json +1 -0
- data/spec/cassettes/Octokit_Client_PullRequests/methods_that_require_a_new_pull/methods_requiring_a_pull_request_comment/_update_pull_request_comment/updates_a_pull_request_comment.json +1 -0
- data/spec/cassettes/Octokit_Client_Refs/_ref/returns_a_tags_ref.json +1 -0
- data/spec/cassettes/Octokit_Client_Refs/_refs/returns_all_refs.json +1 -0
- data/spec/cassettes/Octokit_Client_Refs/_refs/returns_all_tag_refs.json +1 -0
- data/spec/cassettes/Octokit_Client_Refs/methods_that_require_a_ref/_create_ref/creates_a_ref.json +1 -0
- data/spec/cassettes/Octokit_Client_Refs/methods_that_require_a_ref/_delete_ref/deletes_an_existing_ref.json +1 -0
- data/spec/cassettes/Octokit_Client_Refs/methods_that_require_a_ref/_update_ref/updates_a_ref.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_all_repositories/returns_all_repositories_on_github.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_assignees/lists_all_the_available_assignees_owner_collaborators_.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_branches/returns_a_repository_s_branches.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_branches/returns_a_single_branch.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_check_assignee/checks_to_see_if_a_particular_user_is_an_assignee_for_a_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_collaborators/returns_a_repository_s_collaborators.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_contributors/returns_repository_contributors.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_contributors/returns_repository_contributors_excluding_anonymous.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_create_repository/creates_a_repository_for_an_organization.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_delete_subscription/returns_true_when_repo_subscription_deleted.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_fork/forks_a_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_languages/returns_a_repository_s_languages.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_network/returns_a_repository_s_network.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_repositories/returns_a_user_s_repositories.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_repositories/returns_authenticated_user_s_repositories.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_repository/returns_the_matching_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_repository_/returns_false_if_the_repository_doesn_t_exist.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_repository_/returns_true_if_the_repository_exists.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_star/stars_a_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_stargazers/returns_all_repository_stargazers.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_subscribers/lists_all_the_users_watching_the_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_subscription/returns_a_repository_subscription.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_tags/returns_a_repository_s_tags.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_unstar/unstars_a_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_unwatch/unwatches_a_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_update_subscription/updates_a_repository_subscription.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_watch/watches_a_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/_watchers/returns_all_repository_watchers.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/_add_collaborator/adds_a_repository_collaborators.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/_create_repository/creates_a_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/_delete_repository/deletes_a_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/_deploy_keys/returns_a_repository_s_deploy_keys.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/_hooks/returns_a_repository_s_hooks.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/_remove_collaborator/removes_a_repository_collaborators.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/_repository_teams/returns_all_repository_teams.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/_update_repository/updates_the_matching_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/methods_requiring_an_existing_deploy_key/_add_deploy_key/adds_a_repository_deploy_keys.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/methods_that_need_an_existing_hook/_create_hook/creates_a_hook.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/methods_that_need_an_existing_hook/_edit_hook/edits_a_hook.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/methods_that_need_an_existing_hook/_hook/returns_a_repository_s_single_hook.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/methods_that_need_an_existing_hook/_remove_hook/removes_a_hook.json +1 -0
- data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/methods_that_need_an_existing_hook/_test_hook/tests_a_hook.json +1 -0
- data/spec/cassettes/Octokit_Client_Say/_say/returns_an_ASCII_octocat.json +1 -0
- data/spec/cassettes/Octokit_Client_Say/_say/returns_an_ASCII_octocat_with_custom_text.json +1 -0
- data/spec/cassettes/Octokit_Client_ServiceStatus/_github_status/returns_the_current_system_status.json +1 -0
- data/spec/cassettes/Octokit_Client_ServiceStatus/_github_status/returns_the_most_recent_status_messages.json +1 -0
- data/spec/cassettes/Octokit_Client_ServiceStatus/_github_status_last_message/returns_the_last_human_message.json +1 -0
- data/spec/cassettes/Octokit_Client_Stats/_code_frequency_stats/returns_the_code_frequency_stats.json +1 -0
- data/spec/cassettes/Octokit_Client_Stats/_commit_activity_stats/returns_the_commit_activity_stats.json +1 -0
- data/spec/cassettes/Octokit_Client_Stats/_contributors_stats/returns_contributors_and_their_contribution_stats.json +1 -0
- data/spec/cassettes/Octokit_Client_Stats/_participation_stats/returns_the_owner_and_contributor_participation_stats.json +1 -0
- data/spec/cassettes/Octokit_Client_Stats/_punch_card_stats/returns_commit_count_by_hour_punch_card_stats.json +1 -0
- data/spec/cassettes/Octokit_Client_Statuses/_create_status/creates_status.json +1 -0
- data/spec/cassettes/Octokit_Client_Statuses/_statuses/lists_commit_statuses.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_add_email/adds_an_email_address.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_all_users/returns_all_GitHub_users.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_emails/returns_email_addresses.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_follow/follows_a_user.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_followers/returns_followers_for_a_user.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_followers/returns_the_authenticated_user_s_followers.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_following/returns_following_for_a_user.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_following/returns_the_authenticated_user_s_following.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_follows_/checks_if_the_authenticated_user_follows_another.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_keys/returns_public_keys_for_the_authenticated_user.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_remove_email/removes_an_email_address.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_starred/returns_starred_repositories_for_a_user.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_starred/returns_starred_repositories_for_the_authenticated_user.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_starred_/checks_if_the_authenticated_user_has_starred_a_repository.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_subscriptions/returns_the_repositories_a_user_watches_for_notifications.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_subscriptions/returns_the_repositories_the_authenticated_user_watches_for_notifications.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_unfollow/unfollows_a_user.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_update_user/updates_a_user_profile.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_user/returns_a_user.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_user/returns_the_authenticated_user.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_user_keys/returns_public_keys_for_another_user.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/_validate_credentials/validates_username_and_password.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/methods_requiring_an_existing_public_key/_add_key/adds_a_public_key.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/methods_requiring_an_existing_public_key/_key/returns_a_public_key.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/methods_requiring_an_existing_public_key/_remove_key/removes_a_public_key.json +1 -0
- data/spec/cassettes/Octokit_Client_Users/methods_requiring_an_existing_public_key/_update_key/updates_a_public_key.json +1 -0
- data/spec/cassettes/delete_authorization.json +1 -0
- data/spec/cassettes/rate_limit.json +1 -0
- data/spec/cassettes/root.json +1 -0
- data/spec/fixtures/user.json +29 -18
- data/spec/fixtures/{user_token.json → web_flow_token.json} +0 -0
- data/spec/helper.rb +49 -22
- data/spec/octokit/client/authorizations_spec.rb +69 -80
- data/spec/octokit/client/commit_comments_spec.rb +62 -0
- data/spec/octokit/client/commits_spec.rb +93 -226
- data/spec/octokit/client/contents_spec.rb +64 -119
- data/spec/octokit/client/downloads_spec.rb +34 -38
- data/spec/octokit/client/emojis_spec.rb +5 -11
- data/spec/octokit/client/events_spec.rb +67 -51
- data/spec/octokit/client/gists_spec.rb +148 -142
- data/spec/octokit/client/gitignore_spec.rb +11 -14
- data/spec/octokit/client/issues_spec.rb +129 -161
- data/spec/octokit/client/labels_spec.rb +81 -114
- data/spec/octokit/client/legacy_search_spec.rb +42 -0
- data/spec/octokit/client/markdown_spec.rb +9 -12
- data/spec/octokit/client/meta_spec.rb +14 -0
- data/spec/octokit/client/milestones_spec.rb +40 -48
- data/spec/octokit/client/notifications_spec.rb +57 -113
- data/spec/octokit/client/objects_spec.rb +36 -74
- data/spec/octokit/client/organizations_spec.rb +140 -262
- data/spec/octokit/client/pub_sub_hubbub_spec.rb +58 -49
- data/spec/octokit/client/pull_requests_spec.rb +186 -0
- data/spec/octokit/client/rate_limit_spec.rb +40 -0
- data/spec/octokit/client/refs_spec.rb +47 -56
- data/spec/octokit/client/repositories_spec.rb +301 -438
- data/spec/octokit/client/say_spec.rb +8 -22
- data/spec/octokit/client/service_status_spec.rb +37 -0
- data/spec/octokit/client/stats_spec.rb +82 -32
- data/spec/octokit/client/statuses_spec.rb +11 -51
- data/spec/octokit/client/users_spec.rb +144 -348
- data/spec/octokit/client_spec.rb +345 -195
- data/spec/octokit/rate_limit_spec.rb +25 -0
- data/spec/octokit_spec.rb +31 -15
- metadata +585 -387
- data/lib/faraday/response/raise_octokit_error.rb +0 -25
- data/lib/octokit/client/github.rb +0 -19
- data/lib/octokit/client/pub_sub_hubbub/service_hooks.rb +0 -37
- data/lib/octokit/configuration.rb +0 -77
- data/lib/octokit/connection.rb +0 -53
- data/lib/octokit/request.rb +0 -110
- data/spec/faraday/response_spec.rb +0 -63
- data/spec/fixtures/all_repositories.json +0 -122
- data/spec/fixtures/all_users.json +0 -34
- data/spec/fixtures/authorization.json +0 -16
- data/spec/fixtures/authorizations.json +0 -66
- data/spec/fixtures/blob.json +0 -7
- data/spec/fixtures/blob_create.json +0 -3
- data/spec/fixtures/branches.json +0 -16
- data/spec/fixtures/code_frequency_stats.json +0 -897
- data/spec/fixtures/collaborators.json +0 -62
- data/spec/fixtures/comment.json +0 -14
- data/spec/fixtures/comments.json +0 -44
- data/spec/fixtures/commit.json +0 -50
- data/spec/fixtures/commit_activity_stats.json +0 -678
- data/spec/fixtures/commit_comment.json +0 -19
- data/spec/fixtures/commit_comment_create.json +0 -19
- data/spec/fixtures/commit_comment_update.json +0 -19
- data/spec/fixtures/commit_comments.json +0 -78
- data/spec/fixtures/commit_create.json +0 -25
- data/spec/fixtures/commits.json +0 -1414
- data/spec/fixtures/compare.json +0 -98
- data/spec/fixtures/contents.json +0 -14
- data/spec/fixtures/contributor_stats.json +0 -2196
- data/spec/fixtures/contributors.json +0 -891
- data/spec/fixtures/create_content.json +0 -44
- data/spec/fixtures/delete_content.json +0 -30
- data/spec/fixtures/download.json +0 -11
- data/spec/fixtures/download_create.json +0 -21
- data/spec/fixtures/downloads.json +0 -35
- data/spec/fixtures/emails.json +0 -4
- data/spec/fixtures/emojis.json +0 -500
- data/spec/fixtures/followers.json +0 -212
- data/spec/fixtures/following.json +0 -209
- data/spec/fixtures/forks.json +0 -872
- data/spec/fixtures/gist.json +0 -51
- data/spec/fixtures/gist_comment.json +0 -19
- data/spec/fixtures/gist_comment_create.json +0 -19
- data/spec/fixtures/gist_comment_update.json +0 -19
- data/spec/fixtures/gist_comments.json +0 -40
- data/spec/fixtures/gists.json +0 -548
- data/spec/fixtures/github_meta.json +0 -9
- data/spec/fixtures/github_status.json +0 -4
- data/spec/fixtures/github_status_last_message.json +0 -5
- data/spec/fixtures/github_status_messages.json +0 -12
- data/spec/fixtures/gitignore_template_ruby.json +0 -4
- data/spec/fixtures/gitignore_templates.json +0 -78
- data/spec/fixtures/hook.json +0 -18
- data/spec/fixtures/hooks.json +0 -70
- data/spec/fixtures/issue.json +0 -35
- data/spec/fixtures/issue_closed.json +0 -35
- data/spec/fixtures/issue_event.json +0 -42
- data/spec/fixtures/issue_events.json +0 -72
- data/spec/fixtures/issue_full.json +0 -38
- data/spec/fixtures/issues.json +0 -1562
- data/spec/fixtures/label.json +0 -5
- data/spec/fixtures/labels.json +0 -17
- data/spec/fixtures/languages.json +0 -5
- data/spec/fixtures/legacy/issues.json +0 -49
- data/spec/fixtures/legacy/repositories.json +0 -173
- data/spec/fixtures/legacy/users.json +0 -24
- data/spec/fixtures/list_commit_comments.json +0 -572
- data/spec/fixtures/markdown_gfm +0 -1
- data/spec/fixtures/merge.json +0 -47
- data/spec/fixtures/milestone.json +0 -11
- data/spec/fixtures/milestones.json +0 -28
- data/spec/fixtures/not_found.json +0 -3
- data/spec/fixtures/notification_thread.json +0 -32
- data/spec/fixtures/notifications.json +0 -32
- data/spec/fixtures/org_issues.json +0 -710
- data/spec/fixtures/organization-repositories.json +0 -4292
- data/spec/fixtures/organization-repository.json +0 -42
- data/spec/fixtures/organization.json +0 -18
- data/spec/fixtures/organization_events.json +0 -61
- data/spec/fixtures/organization_members.json +0 -576
- data/spec/fixtures/organization_public_events.json +0 -61
- data/spec/fixtures/organization_team_members.json +0 -16
- data/spec/fixtures/organization_team_repos.json +0 -62
- data/spec/fixtures/organizations.json +0 -44
- data/spec/fixtures/participation_stats.json +0 -110
- data/spec/fixtures/public_events.json +0 -1104
- data/spec/fixtures/public_gists.json +0 -968
- data/spec/fixtures/public_key.json +0 -5
- data/spec/fixtures/public_key_update.json +0 -5
- data/spec/fixtures/public_keys.json +0 -7
- data/spec/fixtures/pull_created.json +0 -138
- data/spec/fixtures/pull_request.json +0 -138
- data/spec/fixtures/pull_request_comment.json +0 -35
- data/spec/fixtures/pull_request_comment_create.json +0 -35
- data/spec/fixtures/pull_request_comment_reply.json +0 -35
- data/spec/fixtures/pull_request_comment_update.json +0 -35
- data/spec/fixtures/pull_request_comments.json +0 -35
- data/spec/fixtures/pull_request_commits.json +0 -45
- data/spec/fixtures/pull_request_files.json +0 -35
- data/spec/fixtures/pull_request_merged.json +0 -5
- data/spec/fixtures/pull_requests.json +0 -187
- data/spec/fixtures/pull_requests_comments.json +0 -82
- data/spec/fixtures/pull_update.json +0 -138
- data/spec/fixtures/punch_card_stats.json +0 -842
- data/spec/fixtures/readme.json +0 -14
- data/spec/fixtures/ref.json +0 -9
- data/spec/fixtures/ref_create.json +0 -29
- data/spec/fixtures/ref_update.json +0 -11
- data/spec/fixtures/refs.json +0 -38
- data/spec/fixtures/refs_tags.json +0 -29
- data/spec/fixtures/repo_assignees.json +0 -30
- data/spec/fixtures/repo_events.json +0 -1652
- data/spec/fixtures/repo_issues_events.json +0 -128
- data/spec/fixtures/repositories.json +0 -872
- data/spec/fixtures/repository.json +0 -34
- data/spec/fixtures/repository_issues_comments.json +0 -52
- data/spec/fixtures/repository_network_events.json +0 -155
- data/spec/fixtures/repository_notifications.json +0 -32
- data/spec/fixtures/say.txt +0 -22
- data/spec/fixtures/say_custom.txt +0 -22
- data/spec/fixtures/stargazers.json +0 -212
- data/spec/fixtures/starred.json +0 -1114
- data/spec/fixtures/starred_gists.json +0 -30
- data/spec/fixtures/status.json +0 -16
- data/spec/fixtures/statuses.json +0 -34
- data/spec/fixtures/subscribers.json +0 -9
- data/spec/fixtures/subscription.json +0 -8
- data/spec/fixtures/subscription_update.json +0 -8
- data/spec/fixtures/subscriptions.json +0 -39
- data/spec/fixtures/tag.json +0 -16
- data/spec/fixtures/tag_create.json +0 -16
- data/spec/fixtures/tags.json +0 -173
- data/spec/fixtures/team.json +0 -8
- data/spec/fixtures/teams.json +0 -12
- data/spec/fixtures/thread_subscription.json +0 -8
- data/spec/fixtures/thread_subscription_update.json +0 -8
- data/spec/fixtures/tree.json +0 -112
- data/spec/fixtures/tree_create.json +0 -14
- data/spec/fixtures/update_content.json +0 -44
- data/spec/fixtures/user_events.json +0 -101
- data/spec/fixtures/user_issues.json +0 -710
- data/spec/fixtures/user_performed_public_events.json +0 -78
- data/spec/fixtures/user_public_events.json +0 -78
- data/spec/fixtures/validation_failed.json +0 -11
- data/spec/fixtures/watched.json +0 -1022
- data/spec/fixtures/watchers.json +0 -182
- data/spec/octokit/client/github_spec.rb +0 -19
- data/spec/octokit/client/issue_events_spec.rb +0 -30
- data/spec/octokit/client/pub_sub_hubbub/service_hooks_spec.rb +0 -48
- data/spec/octokit/client/pulls_spec.rb +0 -210
@@ -1,543 +1,406 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
require 'helper'
|
3
2
|
|
4
3
|
describe Octokit::Client::Repositories do
|
5
4
|
|
6
5
|
before do
|
7
|
-
|
6
|
+
Octokit.reset!
|
7
|
+
@client = oauth_client
|
8
8
|
end
|
9
9
|
|
10
|
-
describe ".
|
11
|
-
|
12
|
-
it "returns matching repositories" do
|
13
|
-
stub_get("https://api.github.com/legacy/repos/search/One40Proof").
|
14
|
-
to_return(json_response("legacy/repositories.json"))
|
15
|
-
repositories = @client.search_repositories("One40Proof")
|
16
|
-
expect(repositories.first.name).to eq("One40Proof")
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
describe ".repository" do
|
22
|
-
|
10
|
+
describe ".repository", :vcr do
|
23
11
|
it "returns the matching repository" do
|
24
|
-
stub_get("/repos/sferik/rails_admin").
|
25
|
-
to_return(json_response("repository.json"))
|
26
12
|
repository = @client.repository("sferik/rails_admin")
|
27
|
-
expect(repository.name).to eq
|
28
|
-
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
describe ".update_repository" do
|
33
|
-
|
34
|
-
it "updates the matching repository" do
|
35
|
-
description = "RailsAdmin is a Rails 3 engine that provides an easy-to-use interface for managing your data"
|
36
|
-
stub_patch("/repos/sferik/rails_admin").
|
37
|
-
with(:body => {:description => description}).
|
38
|
-
to_return(json_response("repository.json"))
|
39
|
-
repository = @client.edit_repository("sferik/rails_admin", :description => description)
|
40
|
-
expect(repository.description).to eq(description)
|
13
|
+
expect(repository.name).to eq "rails_admin"
|
14
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin")
|
41
15
|
end
|
16
|
+
end # .repository
|
42
17
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
expect(repositories.first.name).to eq("merb-admin")
|
54
|
-
end
|
55
|
-
|
18
|
+
describe ".set_private" do
|
19
|
+
it "sets a repository private" do
|
20
|
+
VCR.turn_off!
|
21
|
+
repo_name = "api-playground/api-sandbox"
|
22
|
+
# Stub this because Padawan is on a free plan
|
23
|
+
request = stub_patch(github_url("/repos/#{repo_name}")).
|
24
|
+
with(:body => {:private => true, :name => "api-sandbox"}.to_json)
|
25
|
+
repository = @client.set_private repo_name
|
26
|
+
assert_requested request
|
27
|
+
VCR.turn_on!
|
56
28
|
end
|
29
|
+
end # .set_private
|
57
30
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
31
|
+
describe ".set_public" do
|
32
|
+
it "sets a repository public" do
|
33
|
+
VCR.turn_off!
|
34
|
+
repo_name = "api-playground/api-sandbox"
|
35
|
+
# Stub this because Padawan is on a free plan
|
36
|
+
request = stub_patch(github_url("/repos/#{repo_name}")).
|
37
|
+
with(:body => {:private => false, :name => "api-sandbox"}.to_json)
|
38
|
+
repository = @client.set_public repo_name
|
39
|
+
assert_requested request
|
40
|
+
VCR.turn_on!
|
41
|
+
end
|
42
|
+
end # .set_public
|
43
|
+
|
44
|
+
describe ".create_repository", :vcr do
|
45
|
+
it "creates a repository for an organization" do
|
46
|
+
repository = @client.create_repository("an-org-repo", :organization => "api-playground")
|
47
|
+
expect(repository.name).to eq "an-org-repo"
|
48
|
+
assert_requested :post, github_url("/orgs/api-playground/repos")
|
49
|
+
|
50
|
+
# cleanup
|
51
|
+
begin
|
52
|
+
@client.delete_repository("api-playground/an-org-repo")
|
53
|
+
rescue Octokit::NotFound
|
65
54
|
end
|
66
|
-
|
67
55
|
end
|
68
|
-
|
69
56
|
end
|
70
57
|
|
71
|
-
describe ".
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
describe ".star" do
|
83
|
-
|
84
|
-
it "stars a repository" do
|
85
|
-
stub_put("/user/starred/sferik/rails_admin").
|
86
|
-
to_return(:status => 204)
|
87
|
-
expect(@client.star("sferik/rails_admin")).to eq(true)
|
58
|
+
describe ".add_deploy_key" do
|
59
|
+
it "adds a repository deploy keys" do
|
60
|
+
VCR.turn_off!
|
61
|
+
repo_name = "api-playground/api-sandbox"
|
62
|
+
request = stub_post(github_url("/repos/#{repo_name}/keys"))
|
63
|
+
public_key = @client.add_deploy_key(repo_name, "Padawan", "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDN/h7Hf5TA6G4p19deF8YS9COfuBd133GPs49tO6AU/DKIt7tlitbnUnttT0VbNZM4fplyinPu5vJl60eusn/Ngq2vDfSHP5SfgHfA9H8cnHGPYG7w6F0CujFB3tjBhHa3L6Je50E3NC4+BGGhZMpUoTClEI5yEzx3qosRfpfJu/2MUp/V2aARCAiHUlUoj5eiB15zC25uDsY7SYxkh1JO0ecKSMISc/OCdg0kwi7it4t7S/qm8Wh9pVGuA5FmVk8w0hvL+hHWB9GT02WPqiesMaS9Sj3t0yuRwgwzLDaudQPKKTKYXi+SjwXxTJ/lei2bZTMC4QxYbqfqYQt66pQB wynn.netherland+api-padawan@gmail.com" )
|
64
|
+
assert_requested request
|
65
|
+
VCR.turn_on!
|
88
66
|
end
|
67
|
+
end # .add_deploy_key
|
89
68
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
69
|
+
describe ".remove_deploy_key" do
|
70
|
+
it "removes a repository deploy keys" do
|
71
|
+
VCR.turn_off!
|
72
|
+
repo_name = "api-playground/api-sandbox"
|
73
|
+
request = stub_delete(github_url("/repos/#{repo_name}/keys/1234"))
|
74
|
+
@client.remove_deploy_key(repo_name, 1234)
|
75
|
+
assert_requested request
|
76
|
+
VCR.turn_on!
|
98
77
|
end
|
78
|
+
end # .remove_deploy_key
|
99
79
|
|
100
|
-
|
101
|
-
|
102
|
-
describe ".watch" do
|
80
|
+
context "methods that require a new @repo" do
|
103
81
|
|
104
|
-
|
105
|
-
|
106
|
-
to_return(:status => 204)
|
107
|
-
expect(@client.watch("sferik/rails_admin")).to eq(true)
|
82
|
+
before(:each) do
|
83
|
+
@repo = @client.create_repository("an-repo")
|
108
84
|
end
|
109
85
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
stub_delete("/user/watched/sferik/rails_admin").
|
116
|
-
to_return(:status => 204)
|
117
|
-
expect(@client.unwatch("sferik/rails_admin")).to eq(true)
|
86
|
+
after(:each) do
|
87
|
+
begin
|
88
|
+
@client.delete_repository(@repo.full_name)
|
89
|
+
rescue Octokit::NotFound
|
90
|
+
end
|
118
91
|
end
|
119
92
|
|
120
|
-
|
121
|
-
|
122
|
-
|
93
|
+
describe ".create_repository", :vcr do
|
94
|
+
it "creates a repository" do
|
95
|
+
expect(@repo.name).to eq "an-repo"
|
96
|
+
assert_requested :post, github_url("/user/repos")
|
97
|
+
end
|
98
|
+
end # .create_repository
|
99
|
+
|
100
|
+
describe ".update_repository", :vcr do
|
101
|
+
it "updates the matching repository" do
|
102
|
+
description = "It's epic"
|
103
|
+
repository = @client.edit_repository(@repo.full_name, :description => description)
|
104
|
+
expect(repository.description).to eq description
|
105
|
+
assert_requested :patch, github_url("/repos/#{@repo.full_name}")
|
106
|
+
end
|
107
|
+
end # .update_repository
|
123
108
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
109
|
+
describe ".deploy_keys", :vcr do
|
110
|
+
it "returns a repository's deploy keys" do
|
111
|
+
public_keys = @client.deploy_keys @repo.full_name
|
112
|
+
expect(public_keys).to be_kind_of Array
|
113
|
+
assert_requested :get, github_url("/repos/#{@repo.full_name}/keys")
|
114
|
+
end
|
115
|
+
end # .deploy_keys
|
116
|
+
|
117
|
+
describe ".add_collaborator", :vcr do
|
118
|
+
it "adds a repository collaborators" do
|
119
|
+
begin
|
120
|
+
@client.remove_collaborator(@repo.full_name, "pengwynn")
|
121
|
+
rescue Octokit::NotFound
|
122
|
+
end
|
123
|
+
result = @client.add_collaborator(@repo.full_name, "pengwynn")
|
124
|
+
assert_requested :put, github_url("/repos/#{@repo.full_name}/collaborators/pengwynn")
|
125
|
+
end
|
126
|
+
end # .add_collaborator
|
130
127
|
|
131
|
-
|
128
|
+
describe ".remove_collaborator", :vcr do
|
129
|
+
it "removes a repository collaborators" do
|
130
|
+
begin
|
131
|
+
@client.add_collaborator(@repo.full_name, "pengwynn")
|
132
|
+
rescue Octokit::UnprocessableEntity
|
133
|
+
end
|
132
134
|
|
133
|
-
|
135
|
+
result = @client.remove_collaborator(@repo.full_name, "pengwynn")
|
136
|
+
assert_requested :delete, github_url("/repos/#{@repo.full_name}/collaborators/pengwynn")
|
137
|
+
end
|
138
|
+
end # .remove_collaborator
|
134
139
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
end
|
140
|
+
describe ".repository_teams", :vcr do
|
141
|
+
it "returns all repository teams" do
|
142
|
+
teams = @client.repository_teams(@repo.full_name)
|
143
|
+
assert_requested :get, github_url("/repos/#{@repo.full_name}/teams")
|
144
|
+
expect(teams).to be_kind_of Array
|
145
|
+
end
|
146
|
+
end # .repository_teams
|
142
147
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
expect(repository.organization.login).to eq("CoMoRichWebGroup")
|
148
|
+
describe ".hooks", :vcr do
|
149
|
+
it "returns a repository's hooks" do
|
150
|
+
hooks = @client.hooks(@repo.full_name)
|
151
|
+
expect(hooks).to be_kind_of Array
|
152
|
+
assert_requested :get, github_url("/repos/#{@repo.full_name}/hooks")
|
153
|
+
end
|
150
154
|
end
|
151
155
|
|
152
|
-
|
156
|
+
context "methods that need an existing hook" do
|
153
157
|
|
154
|
-
|
158
|
+
before(:each) do
|
159
|
+
@hook = @client.create_hook(@repo.full_name, "railsbp", {:railsbp_url => "http://railsbp.com", :token => "xAAQZtJhYHGagsed1kYR"})
|
160
|
+
end
|
155
161
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
result = @client.delete_repository("sferik/rails_admin")
|
160
|
-
expect(result).to eq(true)
|
161
|
-
end
|
162
|
+
after(:each) do
|
163
|
+
@client.remove_hook(@repo.full_name, @hook.id)
|
164
|
+
end
|
162
165
|
|
163
|
-
|
166
|
+
describe ".create_hook", :vcr do
|
167
|
+
it "creates a hook" do
|
168
|
+
assert_requested :post, github_url("/repos/#{@repo.full_name}/hooks")
|
169
|
+
end
|
170
|
+
end # .create_hook
|
171
|
+
|
172
|
+
describe ".hook", :vcr do
|
173
|
+
it "returns a repository's single hook" do
|
174
|
+
@client.hook(@repo.full_name, @hook.id)
|
175
|
+
assert_requested :get, github_url("/repos/#{@repo.full_name}/hooks/#{@hook.id}")
|
176
|
+
end
|
177
|
+
end # .hook
|
178
|
+
|
179
|
+
describe ".edit_hook", :vcr do
|
180
|
+
it "edits a hook" do
|
181
|
+
hook = @client.edit_hook(@repo.full_name, @hook.id, "railsbp", {:railsbp_url => "https://railsbp.com", :token => "xAAQZtJhYHGagsed1kYR"})
|
182
|
+
assert_requested :patch, github_url("/repos/#{@repo.full_name}/hooks/#{@hook.id}")
|
183
|
+
end
|
184
|
+
end # .edit_hook
|
185
|
+
|
186
|
+
describe ".test_hook", :vcr do
|
187
|
+
it "tests a hook" do
|
188
|
+
hook = @client.create_hook(@repo.full_name, "railsbp", {:railsbp_url => "http://railsbp.com", :token => "xAAQZtJhYHGagsed1kYR"})
|
189
|
+
@client.test_hook(@repo.full_name, @hook.id)
|
190
|
+
assert_requested :post, github_url("/repos/#{@repo.full_name}/hooks/#{@hook.id}/tests")
|
191
|
+
end
|
192
|
+
end # .test_hook
|
193
|
+
|
194
|
+
describe ".remove_hook", :vcr do
|
195
|
+
it "removes a hook" do
|
196
|
+
@client.remove_hook(@repo.full_name, @hook.id)
|
197
|
+
assert_requested :delete, github_url("/repos/#{@repo.full_name}/hooks/#{@hook.id}")
|
198
|
+
end
|
199
|
+
end # .remove_hook
|
200
|
+
|
201
|
+
end # hook methods
|
202
|
+
|
203
|
+
describe ".delete_repository", :vcr do
|
204
|
+
it "deletes a repository" do
|
205
|
+
result = @client.delete_repository("#{@repo.full_name}")
|
206
|
+
assert_requested :delete, github_url("/repos/#{@repo.full_name}")
|
207
|
+
end
|
208
|
+
end # .delete_repository
|
164
209
|
|
165
|
-
|
210
|
+
end # @repo methods
|
166
211
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
expect(repository.name).to eq("rails_admin")
|
212
|
+
describe ".repositories", :vcr do
|
213
|
+
it "returns a user's repositories" do
|
214
|
+
repositories = Octokit.repositories("sferik")
|
215
|
+
expect(repositories).to be_kind_of Array
|
216
|
+
assert_requested :get, github_url("/users/sferik/repos")
|
173
217
|
end
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
it "sets a repository public" do
|
180
|
-
stub_patch("/repos/sferik/rails_admin").
|
181
|
-
with({ :name => "rails_admin", :private => true }).
|
182
|
-
to_return(json_response("repository.json"))
|
183
|
-
repository = @client.set_public("sferik/rails_admin")
|
184
|
-
expect(repository.name).to eq("rails_admin")
|
185
|
-
expect(repository.private).to eq(false)
|
218
|
+
it "returns authenticated user's repositories" do
|
219
|
+
repositories = @client.repositories
|
220
|
+
expect(repositories).to be_kind_of Array
|
221
|
+
assert_requested :get, github_url("/user/repos")
|
186
222
|
end
|
223
|
+
end # .repositories
|
187
224
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
stub_get("/repos/sferik/rails_admin/keys").
|
194
|
-
to_return(json_response("public_keys.json"))
|
195
|
-
public_keys = @client.deploy_keys("sferik/rails_admin")
|
196
|
-
expect(public_keys.first.id).to eq(103205)
|
225
|
+
describe ".all_repositories", :vcr do
|
226
|
+
it "returns all repositories on github" do
|
227
|
+
repositories = Octokit.all_repositories
|
228
|
+
expect(repositories).to be_kind_of Array
|
229
|
+
assert_requested :get, github_url("/repositories")
|
197
230
|
end
|
231
|
+
end # .all_repositories
|
198
232
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
stub_post("/repos/sferik/rails_admin/keys").
|
205
|
-
with(:body => { :title => "Moss", :key => "ssh-dss AAAAB3NzaC1kc3MAAACBAJz7HanBa18ad1YsdFzHO5Wy1/WgXd4BV+czbKq7q23jungbfjN3eo2a0SVdxux8GG+RZ9ia90VD/X+PE4s3LV60oXZ7PDAuyPO1CTF0TaDoKf9mPaHcPa6agMJVocMsgBgwviWT1Q9VgN1SccDsYVDtxkIAwuw25YeHZlG6myx1AAAAFQCgW+OvXWUdUJPBGkRJ8ML7uf0VHQAAAIAlP5G96tTss0SKYVSCJCyocn9cyGQdNjxah4/aYuYFTbLI1rxk7sr/AkZfJNIoF2UFyO5STbbratykIQGUPdUBg1a2t72bu31x+4ZYJMngNsG/AkZ2oqLiH6dJKHD7PFx2oSPalogwsUV7iSMIZIYaPa03A9763iFsN0qJjaed+gAAAIBxz3Prxdzt/os4XGXSMNoWcS03AFC/05NOkoDMrXxQnTTpp1wrOgyRqEnKz15qC5dWk1ynzK+LJXHDZGA8lXPfCjHpJO3zrlZ/ivvLhgPdDpt13MAhIJFH06hTal0woxbk/fIdY71P3kbgXC0Ppx/0S7BC+VxqRCA4/wcM+BoDbA== host" }).
|
206
|
-
to_return(json_response("public_key.json"))
|
207
|
-
public_key = @client.add_deploy_key("sferik/rails_admin", "Moss", "ssh-dss AAAAB3NzaC1kc3MAAACBAJz7HanBa18ad1YsdFzHO5Wy1/WgXd4BV+czbKq7q23jungbfjN3eo2a0SVdxux8GG+RZ9ia90VD/X+PE4s3LV60oXZ7PDAuyPO1CTF0TaDoKf9mPaHcPa6agMJVocMsgBgwviWT1Q9VgN1SccDsYVDtxkIAwuw25YeHZlG6myx1AAAAFQCgW+OvXWUdUJPBGkRJ8ML7uf0VHQAAAIAlP5G96tTss0SKYVSCJCyocn9cyGQdNjxah4/aYuYFTbLI1rxk7sr/AkZfJNIoF2UFyO5STbbratykIQGUPdUBg1a2t72bu31x+4ZYJMngNsG/AkZ2oqLiH6dJKHD7PFx2oSPalogwsUV7iSMIZIYaPa03A9763iFsN0qJjaed+gAAAIBxz3Prxdzt/os4XGXSMNoWcS03AFC/05NOkoDMrXxQnTTpp1wrOgyRqEnKz15qC5dWk1ynzK+LJXHDZGA8lXPfCjHpJO3zrlZ/ivvLhgPdDpt13MAhIJFH06hTal0woxbk/fIdY71P3kbgXC0Ppx/0S7BC+VxqRCA4/wcM+BoDbA== host")
|
208
|
-
expect(public_key.id).to eq(103205)
|
233
|
+
describe ".star", :vcr do
|
234
|
+
it "stars a repository" do
|
235
|
+
result = @client.star("sferik/rails_admin")
|
236
|
+
expect(result).to be_true
|
237
|
+
assert_requested :put, github_url("/user/starred/sferik/rails_admin")
|
209
238
|
end
|
239
|
+
end # .star
|
210
240
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
stub_delete("/repos/sferik/rails_admin/keys/#{103205}").
|
217
|
-
to_return(:status => 204)
|
218
|
-
result = @client.remove_deploy_key("sferik/rails_admin", 103205)
|
219
|
-
expect(result).to eq(true)
|
241
|
+
describe ".unstar", :vcr do
|
242
|
+
it "unstars a repository" do
|
243
|
+
result = @client.unstar("sferik/rails_admin")
|
244
|
+
expect(result).to be_true
|
245
|
+
assert_requested :delete, github_url("/user/starred/sferik/rails_admin")
|
220
246
|
end
|
247
|
+
end # .unstar
|
221
248
|
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
stub_get("/repos/sferik/rails_admin/collaborators").
|
228
|
-
to_return(json_response("collaborators.json"))
|
229
|
-
collaborators = @client.collaborators("sferik/rails_admin")
|
230
|
-
expect(collaborators.first.login).to eq("sferik")
|
249
|
+
describe ".watch", :vcr do
|
250
|
+
it "watches a repository" do
|
251
|
+
result = @client.watch("sferik/rails_admin")
|
252
|
+
expect(result).to be_true
|
253
|
+
assert_requested :put, github_url("/user/watched/sferik/rails_admin")
|
231
254
|
end
|
255
|
+
end # .watch
|
232
256
|
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
stub_put("/repos/sferik/rails_admin/collaborators/sferik").
|
239
|
-
to_return(:status => 204)
|
240
|
-
result = @client.add_collaborator("sferik/rails_admin", "sferik")
|
241
|
-
expect(result).to eq(true)
|
257
|
+
describe ".unwatch", :vcr do
|
258
|
+
it "unwatches a repository" do
|
259
|
+
result = @client.unwatch("sferik/rails_admin")
|
260
|
+
expect(result).to be_true
|
261
|
+
assert_requested :delete, github_url("/user/watched/sferik/rails_admin")
|
242
262
|
end
|
263
|
+
end # .unwatch
|
243
264
|
|
244
|
-
|
245
|
-
|
246
|
-
|
265
|
+
describe ".fork", :vcr do
|
266
|
+
it "forks a repository" do
|
267
|
+
repository = @client.fork("sferik/rails_admin")
|
268
|
+
assert_requested :post, github_url("/repos/sferik/rails_admin/forks")
|
247
269
|
|
248
|
-
|
249
|
-
|
250
|
-
to_return(:status => 204)
|
251
|
-
result = @client.remove_collaborator("sferik/rails_admin", "sferik")
|
252
|
-
expect(result).to eq(true)
|
270
|
+
# cleanup
|
271
|
+
@client.delete_repository(repository.full_name)
|
253
272
|
end
|
273
|
+
end # .fork
|
254
274
|
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
stub_get("/repos/codeforamerica/open311/teams").
|
261
|
-
to_return(json_response("teams.json"))
|
262
|
-
teams = @client.repository_teams("codeforamerica/open311")
|
263
|
-
expect(teams.first.name).to eq("Fellows")
|
275
|
+
describe ".collaborators", :vcr do
|
276
|
+
it "returns a repository's collaborators" do
|
277
|
+
collaborators = Octokit.collaborators("sferik/rails_admin")
|
278
|
+
expect(collaborators).to be_kind_of Array
|
279
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/collaborators")
|
264
280
|
end
|
281
|
+
end # .collaborators
|
265
282
|
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
it "returns all repository contributors" do
|
273
|
-
stub_get("/repos/sferik/rails_admin/contributors?anon=true").
|
274
|
-
to_return(json_response("contributors.json"))
|
275
|
-
contributors = @client.contributors("sferik/rails_admin", true)
|
276
|
-
expect(contributors.first.login).to eq("sferik")
|
277
|
-
end
|
278
|
-
|
283
|
+
describe ".contributors", :vcr do
|
284
|
+
it "returns repository contributors" do
|
285
|
+
contributors = Octokit.contributors("sferik/rails_admin", true)
|
286
|
+
expect(contributors).to be_kind_of Array
|
287
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/contributors?anon=1")
|
279
288
|
end
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
stub_get("/repos/sferik/rails_admin/contributors?anon=false").
|
285
|
-
to_return(json_response("contributors.json"))
|
286
|
-
contributors = @client.contributors("sferik/rails_admin")
|
287
|
-
expect(contributors.first.login).to eq("sferik")
|
288
|
-
end
|
289
|
-
|
289
|
+
it "returns repository contributors excluding anonymous" do
|
290
|
+
contributors = Octokit.contributors("sferik/rails_admin")
|
291
|
+
expect(contributors).to be_kind_of Array
|
292
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/contributors")
|
290
293
|
end
|
294
|
+
end # .contributors
|
291
295
|
|
292
|
-
|
293
|
-
|
294
|
-
describe ".stargazers" do
|
295
|
-
|
296
|
+
describe ".stargazers", :vcr do
|
296
297
|
it "returns all repository stargazers" do
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
expect(stargazers.first.login).to eq("sferik")
|
298
|
+
stargazers = Octokit.stargazers("sferik/rails_admin")
|
299
|
+
expect(stargazers).to be_kind_of Array
|
300
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/stargazers")
|
301
301
|
end
|
302
|
+
end # .stargazers
|
302
303
|
|
303
|
-
|
304
|
-
|
305
|
-
describe ".watchers" do
|
306
|
-
|
304
|
+
describe ".watchers", :vcr do
|
307
305
|
it "returns all repository watchers" do
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
expect(watchers.first.login).to eq("sferik")
|
306
|
+
watchers = Octokit.watchers("sferik/rails_admin")
|
307
|
+
expect(watchers).to be_kind_of Array
|
308
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/watchers")
|
312
309
|
end
|
310
|
+
end # .watchers
|
313
311
|
|
314
|
-
|
315
|
-
|
316
|
-
describe ".network" do
|
317
|
-
|
312
|
+
describe ".network", :vcr do
|
318
313
|
it "returns a repository's network" do
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
expect(network.first.owner.login).to eq("digx")
|
314
|
+
network = Octokit.network("sferik/rails_admin")
|
315
|
+
expect(network).to be_kind_of Array
|
316
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/forks")
|
323
317
|
end
|
318
|
+
end # .network
|
324
319
|
|
325
|
-
|
326
|
-
|
327
|
-
describe ".languages" do
|
328
|
-
|
320
|
+
describe ".languages", :vcr do
|
329
321
|
it "returns a repository's languages" do
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
expect(languages["Ruby"]).to eq(345701)
|
322
|
+
languages = Octokit.languages("sferik/rails_admin")
|
323
|
+
expect(languages[:Ruby]).to_not be_nil
|
324
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/languages")
|
334
325
|
end
|
326
|
+
end # .languages
|
335
327
|
|
336
|
-
|
337
|
-
|
338
|
-
describe ".tags" do
|
339
|
-
|
328
|
+
describe ".tags", :vcr do
|
340
329
|
it "returns a repository's tags" do
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
v0_6_4 = tags.find { |tag| tag.name == "v0.6.4" }
|
345
|
-
expect(v0_6_4.commit.sha).to eq("09bcc30e7286eeb1bbde68d0ace7a6b90b1a84a2")
|
330
|
+
tags = Octokit.tags("octokit/octokit.rb")
|
331
|
+
expect(tags).to be_kind_of Array
|
332
|
+
assert_requested :get, github_url("/repos/octokit/octokit.rb/tags")
|
346
333
|
end
|
334
|
+
end # .tags
|
347
335
|
|
348
|
-
|
349
|
-
|
350
|
-
describe ".branches" do
|
351
|
-
|
336
|
+
describe ".branches", :vcr do
|
352
337
|
it "returns a repository's branches" do
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
master = branches.find { |branch| branch.name == "master" }
|
357
|
-
expect(master.commit.sha).to eq("88553a397f7293b3ba176dc27cd1ab6bb93d5d14")
|
338
|
+
branches = Octokit.branches("octokit/octokit.rb")
|
339
|
+
expect(branches).to be_kind_of Array
|
340
|
+
assert_requested :get, github_url("/repos/octokit/octokit.rb/branches")
|
358
341
|
end
|
359
|
-
|
360
342
|
it "returns a single branch" do
|
361
|
-
branch =
|
362
|
-
|
363
|
-
|
364
|
-
branch = @client.branch("pengwynn/octokit", "master")
|
365
|
-
expect(branch.commit.sha).to eq("88553a397f7293b3ba176dc27cd1ab6bb93d5d14")
|
366
|
-
end
|
367
|
-
|
368
|
-
end
|
369
|
-
|
370
|
-
describe ".hooks" do
|
371
|
-
|
372
|
-
it "returns a repository's hooks" do
|
373
|
-
stub_get("/repos/railsbp/railsbp.com/hooks").
|
374
|
-
to_return(json_response("hooks.json"))
|
375
|
-
hooks = @client.hooks("railsbp/railsbp.com")
|
376
|
-
hook = hooks.find { |hook| hook.name == "railsbp" }
|
377
|
-
expect(hook.config.token).to eq("xAAQZtJhYHGagsed1kYR")
|
378
|
-
end
|
379
|
-
|
380
|
-
end
|
381
|
-
|
382
|
-
describe ".hook" do
|
383
|
-
|
384
|
-
it "returns a repository's single hook" do
|
385
|
-
stub_get("/repos/railsbp/railsbp.com/hooks/154284").
|
386
|
-
to_return(json_response("hook.json"))
|
387
|
-
hook = @client.hook("railsbp/railsbp.com", 154284)
|
388
|
-
expect(hook.config.token).to eq("xAAQZtJhYHGagsed1kYR")
|
389
|
-
end
|
390
|
-
|
391
|
-
end
|
392
|
-
|
393
|
-
describe ".create_hook" do
|
394
|
-
|
395
|
-
it "creates a hook" do
|
396
|
-
stub_post("/repos/railsbp/railsbp.com/hooks").
|
397
|
-
with(:body => {:name => "railsbp", :config => {:railsbp_url => "http://railsbp.com", :token => "xAAQZtJhYHGagsed1kYR"}, :events => ["push"], :active => true}).
|
398
|
-
to_return(json_response("hook.json"))
|
399
|
-
hook = @client.create_hook("railsbp/railsbp.com", "railsbp", {:railsbp_url => "http://railsbp.com", :token => "xAAQZtJhYHGagsed1kYR"})
|
400
|
-
expect(hook.id).to eq(154284)
|
343
|
+
branch = Octokit.branch("octokit/octokit.rb", "master")
|
344
|
+
expect(branch.commit.sha).to_not be_nil
|
345
|
+
assert_requested :get, github_url("/repos/octokit/octokit.rb/branches/master")
|
401
346
|
end
|
347
|
+
end # .branches
|
402
348
|
|
403
|
-
|
404
|
-
|
405
|
-
describe ".edit_hook" do
|
406
|
-
|
407
|
-
it "edits a hook" do
|
408
|
-
stub_patch("/repos/railsbp/railsbp.com/hooks/154284").
|
409
|
-
with(:body => {:name => "railsbp", :config => {:railsbp_url => "http://railsbp.com", :token => "xAAQZtJhYHGagsed1kYR"}, :events => ["push"], :active => true}).
|
410
|
-
to_return(json_response("hook.json"))
|
411
|
-
hook = @client.edit_hook("railsbp/railsbp.com", 154284, "railsbp", {:railsbp_url => "http://railsbp.com", :token => "xAAQZtJhYHGagsed1kYR"})
|
412
|
-
expect(hook.id).to eq(154284)
|
413
|
-
expect(hook.config.token).to eq("xAAQZtJhYHGagsed1kYR")
|
414
|
-
end
|
415
|
-
|
416
|
-
end
|
417
|
-
|
418
|
-
describe ".remove_hook" do
|
419
|
-
|
420
|
-
it "removes a hook" do
|
421
|
-
stub_delete("/repos/railsbp/railsbp.com/hooks/154284").
|
422
|
-
to_return(:status => 204)
|
423
|
-
expect(@client.remove_hook("railsbp/railsbp.com", 154284)).to eq(true)
|
424
|
-
end
|
425
|
-
|
426
|
-
end
|
427
|
-
|
428
|
-
describe ".test_hook" do
|
429
|
-
|
430
|
-
it "tests a hook" do
|
431
|
-
stub_post("/repos/railsbp/railsbp.com/hooks/154284/tests").
|
432
|
-
to_return(:status => 204)
|
433
|
-
expect(@client.test_hook("railsbp/railsbp.com", 154284)).to eq(true)
|
434
|
-
end
|
435
|
-
|
436
|
-
end
|
437
|
-
|
438
|
-
describe ".events" do
|
439
|
-
|
440
|
-
it "lists events for all issues in a repository" do
|
441
|
-
stub_get("/repos/pengwynn/octokit/issues/events").
|
442
|
-
to_return(json_response("repo_issues_events.json"))
|
443
|
-
events = @client.repo_issue_events("pengwynn/octokit")
|
444
|
-
expect(events.first.actor.login).to eq("ctshryock")
|
445
|
-
expect(events.first.event).to eq("subscribed")
|
446
|
-
end
|
447
|
-
|
448
|
-
end
|
449
|
-
|
450
|
-
describe ".assignees" do
|
451
|
-
|
349
|
+
describe ".assignees", :vcr do
|
452
350
|
it "lists all the available assignees (owner + collaborators)" do
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
expect(assignees.first.login).to eq("adamstac")
|
351
|
+
assignees = Octokit.repo_assignees("octokit/octokit.rb")
|
352
|
+
expect(assignees).to be_kind_of Array
|
353
|
+
assert_requested :get, github_url("/repos/octokit/octokit.rb/assignees")
|
457
354
|
end
|
355
|
+
end # .assignees
|
458
356
|
|
459
|
-
|
460
|
-
|
461
|
-
describe ".check_assignee" do
|
462
|
-
|
357
|
+
describe ".check_assignee", :vcr do
|
463
358
|
it "checks to see if a particular user is an assignee for a repository" do
|
464
|
-
|
465
|
-
|
466
|
-
is_assignee = @client.check_assignee("pengwynn/octokit", 'andrew')
|
467
|
-
expect(is_assignee).to eq(true)
|
359
|
+
is_assignee = Octokit.check_assignee("octokit/octokit.rb", 'andrew')
|
360
|
+
assert_requested :get, github_url("/repos/octokit/octokit.rb/assignees/andrew")
|
468
361
|
end
|
362
|
+
end # .check_assignee
|
469
363
|
|
470
|
-
|
471
|
-
|
472
|
-
describe ".subscribers" do
|
473
|
-
|
364
|
+
describe ".subscribers", :vcr do
|
474
365
|
it "lists all the users watching the repository" do
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
expect(subscribers.first.id).to eq(865)
|
479
|
-
expect(subscribers.first.login).to eq("pengwynn")
|
366
|
+
subscribers = Octokit.subscribers("octokit/octokit.rb")
|
367
|
+
expect(subscribers).to be_kind_of Array
|
368
|
+
assert_requested :get, github_url("/repos/octokit/octokit.rb/subscribers")
|
480
369
|
end
|
370
|
+
end # .subscribers
|
481
371
|
|
482
|
-
|
483
|
-
|
484
|
-
describe ".subscription" do
|
485
|
-
|
486
|
-
it "returns a repository subscription" do
|
487
|
-
stub_get("/repos/pengwynn/octokit/subscription").
|
488
|
-
to_return(json_response("subscription.json"))
|
489
|
-
subscription = @client.subscription("pengwynn/octokit")
|
490
|
-
expect(subscription.subscribed).to eq(true)
|
491
|
-
end
|
492
|
-
|
493
|
-
end
|
494
|
-
|
495
|
-
describe ".update_subscription" do
|
496
|
-
|
372
|
+
describe ".update_subscription", :vcr do
|
497
373
|
it "updates a repository subscription" do
|
498
|
-
|
499
|
-
|
500
|
-
subscription = @client.update_subscription("pengwynn/octokit", :subscribed => false)
|
501
|
-
expect(subscription.subscribed).to be_false
|
374
|
+
subscription = @client.update_subscription("octokit/octokit.rb", :subscribed => false)
|
375
|
+
assert_requested :put, github_url("/repos/octokit/octokit.rb/subscription")
|
502
376
|
end
|
377
|
+
end # .update_subscription
|
503
378
|
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
it "returns true when repo subscription deleted" do
|
509
|
-
stub_delete("/repos/pengwynn/octokit/subscription").
|
510
|
-
to_return(:status => 204)
|
511
|
-
result = @client.delete_subscription("pengwynn/octokit")
|
512
|
-
expect(result).to eq(true)
|
379
|
+
describe ".subscription", :vcr do
|
380
|
+
it "returns a repository subscription" do
|
381
|
+
subscription = @client.subscription("octokit/octokit.rb")
|
382
|
+
assert_requested :get, github_url("/repos/octokit/octokit.rb/subscription")
|
513
383
|
end
|
384
|
+
end # .subscription
|
514
385
|
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
expect(result).to be_false
|
386
|
+
describe ".delete_subscription", :vcr do
|
387
|
+
it "returns true when repo subscription deleted" do
|
388
|
+
result = @client.delete_subscription("octokit/octokit.rb")
|
389
|
+
assert_requested :delete, github_url("/repos/octokit/octokit.rb/subscription")
|
520
390
|
end
|
391
|
+
end # .delete_subscription
|
521
392
|
|
522
|
-
|
523
|
-
|
524
|
-
describe ".repository?" do
|
525
|
-
|
393
|
+
describe ".repository?", :vcr do
|
526
394
|
it "returns true if the repository exists" do
|
527
|
-
stub_get("/repos/sferik/rails_admin").
|
528
|
-
to_return(json_response("repository.json"))
|
529
|
-
|
530
395
|
result = @client.repository?("sferik/rails_admin")
|
531
396
|
expect(result).to be_true
|
397
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin")
|
532
398
|
end
|
533
|
-
|
534
399
|
it "returns false if the repository doesn't exist" do
|
535
|
-
stub_get("/repos/pengwynn/octokit").
|
536
|
-
to_return(:status => 404)
|
537
|
-
|
538
400
|
result = @client.repository?("pengwynn/octokit")
|
539
401
|
expect(result).to be_false
|
402
|
+
assert_requested :get, github_url("/repos/pengwynn/octokit")
|
540
403
|
end
|
404
|
+
end # .repository?
|
541
405
|
|
542
|
-
end
|
543
406
|
end
|