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
File without changes
|
data/spec/helper.rb
CHANGED
@@ -14,29 +14,42 @@ require 'webmock/rspec'
|
|
14
14
|
WebMock.disable_net_connect!(:allow => 'coveralls.io')
|
15
15
|
|
16
16
|
RSpec.configure do |config|
|
17
|
-
config.
|
18
|
-
c.syntax = :expect
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def a_delete(url)
|
23
|
-
a_request(:delete, github_url(url))
|
17
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
24
18
|
end
|
25
19
|
|
26
|
-
|
27
|
-
|
20
|
+
require 'vcr'
|
21
|
+
VCR.configure do |c|
|
22
|
+
c.configure_rspec_metadata!
|
23
|
+
c.filter_sensitive_data("<GITHUB_LOGIN>") do
|
24
|
+
ENV['OCTOKIT_TEST_GITHUB_LOGIN']
|
25
|
+
end
|
26
|
+
c.filter_sensitive_data("<GITHUB_PASSWORD>") do
|
27
|
+
ENV['OCTOKIT_TEST_GITHUB_PASSWORD']
|
28
|
+
end
|
29
|
+
c.filter_sensitive_data("<<ACCESS_TOKEN>>") do
|
30
|
+
ENV['OCTOKIT_TEST_GITHUB_TOKEN']
|
31
|
+
end
|
32
|
+
c.default_cassette_options = {
|
33
|
+
:serialize_with => :json,
|
34
|
+
# TODO: Track down UTF-8 issue and remove
|
35
|
+
:preserve_exact_body_bytes => true,
|
36
|
+
:decode_compressed_response => true,
|
37
|
+
:record => ENV['TRAVIS'] ? :none : :once
|
38
|
+
}
|
39
|
+
c.cassette_library_dir = 'spec/cassettes'
|
40
|
+
c.hook_into :webmock
|
28
41
|
end
|
29
42
|
|
30
|
-
def
|
31
|
-
|
43
|
+
def test_github_login
|
44
|
+
ENV.fetch 'OCTOKIT_TEST_GITHUB_LOGIN'
|
32
45
|
end
|
33
46
|
|
34
|
-
def
|
35
|
-
|
47
|
+
def test_github_password
|
48
|
+
ENV.fetch 'OCTOKIT_TEST_GITHUB_PASSWORD'
|
36
49
|
end
|
37
50
|
|
38
|
-
def
|
39
|
-
|
51
|
+
def test_github_token
|
52
|
+
ENV.fetch 'OCTOKIT_TEST_GITHUB_TOKEN'
|
40
53
|
end
|
41
54
|
|
42
55
|
def stub_delete(url)
|
@@ -81,11 +94,25 @@ def json_response(file)
|
|
81
94
|
end
|
82
95
|
|
83
96
|
def github_url(url)
|
84
|
-
|
85
|
-
url
|
86
|
-
elsif @client && @client.authenticated?
|
87
|
-
"https://#{@client.login}:#{@client.password}@api.github.com#{url}"
|
88
|
-
else
|
89
|
-
"https://api.github.com#{url}"
|
90
|
-
end
|
97
|
+
url =~ /^http/ ? url : "https://api.github.com#{url}"
|
91
98
|
end
|
99
|
+
|
100
|
+
def basic_github_url(path, options = {})
|
101
|
+
login = options.fetch(:login, test_github_login)
|
102
|
+
password = options.fetch(:password, test_github_password)
|
103
|
+
|
104
|
+
"https://#{login}:#{password}@api.github.com#{path}"
|
105
|
+
end
|
106
|
+
|
107
|
+
def basic_auth_client(login = test_github_login, password = test_github_password )
|
108
|
+
client = Octokit.client
|
109
|
+
client.login = test_github_login
|
110
|
+
client.password = test_github_password
|
111
|
+
|
112
|
+
client
|
113
|
+
end
|
114
|
+
|
115
|
+
def oauth_client
|
116
|
+
Octokit::Client.new(:access_token => ENV.fetch('OCTOKIT_TEST_GITHUB_TOKEN'))
|
117
|
+
end
|
118
|
+
|
@@ -1,96 +1,85 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
require 'helper'
|
3
2
|
|
4
3
|
describe Octokit::Client::Authorizations do
|
5
4
|
|
6
5
|
before do
|
7
|
-
|
6
|
+
Octokit.reset!
|
7
|
+
@client = basic_auth_client
|
8
8
|
end
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
expect(authorizations.first.app.name).to eq("Calendar About Nothing" )
|
16
|
-
end
|
17
|
-
|
18
|
-
it "returns a single authorization" do
|
19
|
-
stub_get("/authorizations/999999").
|
20
|
-
to_return(json_response("authorization.json"))
|
21
|
-
authorization = @client.authorization(999999)
|
22
|
-
expect(authorization.app.name).to eq("Travis" )
|
23
|
-
end
|
24
|
-
|
25
|
-
it "creates a new default authorization" do
|
26
|
-
stub_post('/authorizations').
|
27
|
-
with(:body => {"scopes" => ""},
|
28
|
-
:headers => {'Content-Type'=>'application/json'}).
|
29
|
-
to_return(json_response("authorization.json"))
|
30
|
-
authorization = @client.create_authorization
|
31
|
-
expect(authorization.app.name).to eq("Travis" )
|
32
|
-
end
|
33
|
-
|
34
|
-
it "creates a new authorization with options" do
|
35
|
-
stub_post('/authorizations').
|
36
|
-
with(:body => {"scopes" => ["public_repo"],"note" => "admin script", "note_url" => "https://github.com/pengwynn/octokit"},
|
37
|
-
:headers => {'Content-Type'=>'application/json'}).
|
38
|
-
to_return(json_response("authorization.json"))
|
39
|
-
authorization = @client.create_authorization({:scopes => ["public_repo"], :note => "admin script", :note_url => "https://github.com/pengwynn/octokit"})
|
40
|
-
expect(authorization.scopes).to include("public_repo")
|
41
|
-
end
|
42
|
-
|
43
|
-
it "updates and existing authorization" do
|
44
|
-
stub_patch('/authorizations/999999').
|
45
|
-
with(:body => {"scopes"=>"", "add_scopes" => ["public_repo", "gist"]},
|
46
|
-
:headers => {'Content-Type'=>'application/json'}).
|
47
|
-
to_return(json_response("authorization.json"))
|
48
|
-
authorization = @client.update_authorization(999999, {:add_scopes => ['public_repo', 'gist']})
|
49
|
-
expect(authorization.scopes).to include("public_repo")
|
50
|
-
end
|
51
|
-
|
52
|
-
it "deletes an existing authorization" do
|
53
|
-
stub_delete('/authorizations/999999').
|
54
|
-
to_return(:status => 204)
|
55
|
-
result = @client.delete_authorization(999999)
|
56
|
-
expect(result).to eq(true)
|
57
|
-
end
|
58
|
-
|
59
|
-
context "when working with tokens" do
|
60
|
-
before(:each) do
|
61
|
-
Octokit.reset
|
10
|
+
describe ".create_authorization", :vcr do
|
11
|
+
it "creates an API authorization" do
|
12
|
+
authorization = @client.create_authorization
|
13
|
+
expect(authorization.app.name).to_not be_nil
|
14
|
+
assert_requested :post, basic_github_url("/authorizations")
|
62
15
|
end
|
16
|
+
it "creates a new authorization with options" do
|
17
|
+
info = {
|
18
|
+
:scopes => ["gist"],
|
19
|
+
}
|
20
|
+
authorization = @client.create_authorization info
|
21
|
+
expect(authorization.scopes).to be_kind_of Array
|
22
|
+
assert_requested :post, basic_github_url("/authorizations")
|
23
|
+
end
|
24
|
+
end # .create_authorization
|
63
25
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
:headers => {
|
70
|
-
:content_type => 'application/json; charset=utf-8',
|
71
|
-
:x_oauth_scopes => 'user, gist'
|
72
|
-
}
|
73
|
-
|
74
|
-
client = Octokit::Client.new :oauth_token => 'abcdabcdabcdabcdabcdabcdabcdabcdabcd'
|
75
|
-
scopes = Octokit.scopes
|
76
|
-
expect(scopes).to eq(['gist', 'user'])
|
26
|
+
describe ".authorizations", :vcr do
|
27
|
+
it "lists existing authorizations" do
|
28
|
+
authorizations = @client.authorizations
|
29
|
+
expect(authorizations).to be_kind_of Array
|
30
|
+
assert_requested :get, basic_github_url("/authorizations")
|
77
31
|
end
|
32
|
+
end # .authorizations
|
78
33
|
|
34
|
+
describe ".authorization", :vcr do
|
35
|
+
it "returns a single authorization" do
|
36
|
+
authorization = @client.create_authorization
|
37
|
+
fetched = @client.authorization(authorization['id'])
|
38
|
+
assert_requested :get, basic_github_url("/authorizations/#{authorization.id}")
|
39
|
+
end
|
40
|
+
end # .authorization
|
41
|
+
|
42
|
+
describe ".update_authorization", :vcr do
|
43
|
+
it "updates and existing authorization" do
|
44
|
+
authorization = @client.create_authorization
|
45
|
+
updated = @client.update_authorization(authorization.id, :add_scopes => ['repo:status'])
|
46
|
+
expect(updated.scopes).to include 'repo:status'
|
47
|
+
assert_requested :patch, basic_github_url("/authorizations/#{authorization.id}")
|
48
|
+
end
|
49
|
+
end # .update_authorization
|
50
|
+
|
51
|
+
describe ".scopes", :vcr do
|
52
|
+
it "checks the scopes on the current token" do
|
53
|
+
authorization = @client.create_authorization
|
54
|
+
token_client = Octokit::Client.new(:access_token => authorization.token)
|
55
|
+
expect(token_client.scopes).to be_kind_of Array
|
56
|
+
assert_requested :get, github_url("/user")
|
57
|
+
end
|
79
58
|
it "checks the scopes on a one-off token" do
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
59
|
+
authorization = @client.create_authorization
|
60
|
+
Octokit.reset!
|
61
|
+
expect(Octokit.scopes(authorization.token)).to be_kind_of Array
|
62
|
+
assert_requested :get, github_url("/user")
|
63
|
+
end
|
64
|
+
end # .scopes
|
65
|
+
|
66
|
+
describe ".delete_authorization", :vcr do
|
67
|
+
it "deletes an existing authorization" do
|
68
|
+
VCR.eject_cassette
|
69
|
+
VCR.use_cassette 'delete_authorization' do
|
70
|
+
authorization = @client.create_authorization
|
71
|
+
result = @client.delete_authorization(authorization.id)
|
72
|
+
expect(result).to eq true
|
73
|
+
assert_requested :delete, basic_github_url("/authorizations/#{authorization.id}")
|
74
|
+
end
|
92
75
|
end
|
76
|
+
end # .delete_authorization
|
93
77
|
|
94
|
-
|
78
|
+
describe '.authorize_url' do
|
79
|
+
it "returns the authorize_url" do
|
80
|
+
url = Octokit.authorize_url('id_here', 'secret_here')
|
81
|
+
expect(url).to eq('https://github.com/login/oauth/authorize?client_id=id_here&client_secret=secret_here')
|
82
|
+
end
|
83
|
+
end # .authorize_url
|
95
84
|
|
96
85
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Octokit::Client::CommitComments do
|
4
|
+
|
5
|
+
before do
|
6
|
+
Octokit.reset!
|
7
|
+
@client = oauth_client
|
8
|
+
@commit = @client.commits('api-playground/api-sandbox').last.rels[:self].get.data
|
9
|
+
@commit_comment = @client.create_commit_comment \
|
10
|
+
"api-playground/api-sandbox",
|
11
|
+
@commit.sha, ":metal:\n:sparkles:\n:cake:",
|
12
|
+
@commit.files.last.filename
|
13
|
+
end
|
14
|
+
|
15
|
+
describe ".list_commit_comments", :vcr do
|
16
|
+
it "returns a list of all commit comments" do
|
17
|
+
commit_comments = @client.list_commit_comments("sferik/rails_admin")
|
18
|
+
expect(commit_comments.first.user.login).to eq("sferik")
|
19
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/comments")
|
20
|
+
end
|
21
|
+
end # .list_commit_comments
|
22
|
+
|
23
|
+
describe ".commit_comments", :vcr do
|
24
|
+
it "returns a list of comments for a specific commit" do
|
25
|
+
commit_comments = @client.commit_comments("sferik/rails_admin", "629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3")
|
26
|
+
expect(commit_comments.first.user.login).to eq("bbenezech")
|
27
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/commits/629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3/comments")
|
28
|
+
end
|
29
|
+
end # .commit_comments
|
30
|
+
|
31
|
+
describe ".commit_comment", :vcr do
|
32
|
+
it "returns a single commit comment" do
|
33
|
+
commit = @client.commit_comment("sferik/rails_admin", "861907")
|
34
|
+
expect(commit.user.login).to eq("bbenezech")
|
35
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/comments/861907")
|
36
|
+
end
|
37
|
+
end # .commit_comment
|
38
|
+
|
39
|
+
describe ".create_commit_comment", :vcr do
|
40
|
+
it "creates a commit comment" do
|
41
|
+
expect(@commit_comment.user.login).to eq test_github_login
|
42
|
+
assert_requested :post, github_url("/repos/api-playground/api-sandbox/commits/#{@commit.sha}/comments")
|
43
|
+
end
|
44
|
+
end # .create_commit_comment
|
45
|
+
|
46
|
+
describe ".update_commit_comment", :vcr do
|
47
|
+
it "updates a commit comment" do
|
48
|
+
updated_comment = @client.update_commit_comment("api-playground/api-sandbox", @commit_comment.id, ":penguin:")
|
49
|
+
expect(updated_comment.body).to eq ":penguin:"
|
50
|
+
assert_requested :patch, github_url("/repos/api-playground/api-sandbox/comments/#{@commit_comment.id}")
|
51
|
+
end
|
52
|
+
end # .update_commit_comment
|
53
|
+
|
54
|
+
describe ".delete_commit_comment", :vcr do
|
55
|
+
it "deletes a commit comment" do
|
56
|
+
result = @client.delete_commit_comment("api-playground/api-sandbox", @commit_comment.id)
|
57
|
+
expect(result).to be_true
|
58
|
+
assert_requested :delete, github_url("/repos/api-playground/api-sandbox/comments/#{@commit_comment.id}")
|
59
|
+
end
|
60
|
+
end # .delete_commit_comment
|
61
|
+
|
62
|
+
end
|
@@ -1,272 +1,139 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
require 'helper'
|
3
2
|
|
4
|
-
# need this to filter the data
|
5
|
-
require 'json'
|
6
|
-
require 'date'
|
7
|
-
|
8
3
|
describe Octokit::Client::Commits do
|
9
4
|
|
10
5
|
before do
|
11
|
-
|
6
|
+
Octokit.reset!
|
7
|
+
@client = oauth_client
|
12
8
|
end
|
13
9
|
|
14
|
-
describe ".commits" do
|
15
|
-
|
10
|
+
describe ".commits", :vcr do
|
16
11
|
it "returns all commits" do
|
17
|
-
stub_get("/repos/sferik/rails_admin/commits?per_page=35&sha=master").
|
18
|
-
to_return(json_response("commits.json"))
|
19
12
|
commits = @client.commits("sferik/rails_admin")
|
20
|
-
expect(commits.first.author
|
13
|
+
expect(commits.first.author).to_not be_nil
|
14
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/commits")
|
21
15
|
end
|
16
|
+
it "handles branch or sha argument" do
|
17
|
+
commits = @client.commits("sferik/rails_admin", "master")
|
18
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/commits?sha=master")
|
19
|
+
end
|
20
|
+
it "handles the sha option" do
|
21
|
+
commits = @client.commits("sferik/rails_admin", :sha => "master")
|
22
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/commits?sha=master")
|
23
|
+
end
|
24
|
+
end # .commits
|
22
25
|
|
23
|
-
|
24
|
-
|
25
|
-
describe ".commits_on" do
|
26
|
-
|
26
|
+
describe ".commits_on", :vcr do
|
27
27
|
it "returns all commits on the specified date" do
|
28
|
-
stub_http_request(:get, "https://api.github.com/repos/sferik/rails_admin/commits").
|
29
|
-
with(:query=>{"per_page" => 35, "sha" => "master",
|
30
|
-
"since" => "2011-01-20T00:00:00+00:00", "until" => "2011-01-21T00:00:00+00:00"}).
|
31
|
-
to_return json_response('commits.json')
|
32
28
|
commits = @client.commits_on("sferik/rails_admin", "2011-01-20")
|
33
|
-
expect(commits).to
|
29
|
+
expect(commits).to be_kind_of Array
|
30
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/commits?since=2011-01-20T00:00:00%2B00:00&until=2011-01-21T00:00:00%2B00:00")
|
34
31
|
end
|
35
|
-
|
36
|
-
it "returns an empty array if there are no commits on the specified date" do
|
37
|
-
stub_http_request(:get, "https://api.github.com/repos/sferik/rails_admin/commits").
|
38
|
-
with(:query=>{"per_page" => 35, "sha" => "master",
|
39
|
-
"since" => "2011-01-15T00:00:00+00:00",
|
40
|
-
"until" => "2011-01-16T00:00:00+00:00"}).
|
41
|
-
to_return json_response('commits.json')
|
42
|
-
commits = @client.commits_on("sferik/rails_admin", "2011-01-15")
|
43
|
-
expect(commits).to be_an(Array)
|
44
|
-
end
|
45
|
-
|
46
32
|
it "errors if the date is invalid" do
|
47
|
-
expect {@client.commits_on
|
33
|
+
expect { @client.commits_on "sferik/rails_admin", "A pear" }.to raise_error ArgumentError
|
48
34
|
end
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
describe ".commits_since" do
|
53
|
-
|
54
|
-
it "returns all commits after the specified date" do
|
55
|
-
start_date = Date.parse("2011-01-16T00:00:00+00:00")
|
56
|
-
stub_http_request(:get, "https://api.github.com/repos/sferik/rails_admin/commits").
|
57
|
-
with(:query=>{"per_page" => 35, "sha" => "master",
|
58
|
-
"since" => "2011-01-16T00:00:00+00:00"}).
|
59
|
-
to_return json_response('commits.json')
|
60
|
-
commits = @client.commits_since("sferik/rails_admin", "2011-01-16")
|
61
|
-
expect(commits).to be_an(Array)
|
35
|
+
it "handles branch or sha argument" do
|
36
|
+
commits = @client.commits_on("sferik/rails_admin", "2011-01-15", "master")
|
37
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/commits?sha=master&since=2011-01-15T00:00:00%2B00:00&until=2011-01-16T00:00:00%2B00:00")
|
62
38
|
end
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
stub_http_request(:get, "https://api.github.com/repos/sferik/rails_admin/commits").
|
67
|
-
with(:query=>{"per_page" => 35, "sha" => "master",
|
68
|
-
"since" => "2011-01-22T00:00:00+00:00"}).
|
69
|
-
to_return json_response('commits.json')
|
70
|
-
commits = @client.commits_since("sferik/rails_admin", "2011-01-22")
|
71
|
-
expect(commits).to be_an(Array)
|
39
|
+
it "handles the sha option" do
|
40
|
+
commits = @client.commits_on("sferik/rails_admin", "2011-01-15", :sha => "master")
|
41
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/commits?sha=master&since=2011-01-15T00:00:00%2B00:00&until=2011-01-16T00:00:00%2B00:00")
|
72
42
|
end
|
43
|
+
end # .commits_on
|
73
44
|
|
45
|
+
describe ".commits_since", :vcr do
|
46
|
+
it "returns all commits since the specified date" do
|
47
|
+
commits = @client.commits_since("sferik/rails_admin", "2011-01-20")
|
48
|
+
expect(commits).to be_kind_of Array
|
49
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/commits?since=2011-01-20T00:00:00%2B00:00")
|
50
|
+
end
|
74
51
|
it "errors if the date is invalid" do
|
75
|
-
expect {@client.commits_since
|
52
|
+
expect { @client.commits_since "sferik/rails_admin", "A pear" }.to raise_error ArgumentError
|
76
53
|
end
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
describe ".commits_before" do
|
81
|
-
|
82
|
-
it "returns all commits before the specified date" do
|
83
|
-
end_date = Date.parse("2011-01-17T00:00:00+00:00")
|
84
|
-
stub_http_request(:get, "https://api.github.com/repos/sferik/rails_admin/commits").
|
85
|
-
with(:query=>{"per_page" => 35, "sha" => "master",
|
86
|
-
"until" => "2011-01-17T00:00:00+00:00"}).
|
87
|
-
to_return json_response('commits.json')
|
88
|
-
commits = @client.commits_before("sferik/rails_admin", "2011-01-17")
|
89
|
-
expect(commits).to be_an(Array)
|
54
|
+
it "handles branch or sha argument" do
|
55
|
+
commits = @client.commits_since("sferik/rails_admin", "2011-01-15", "master")
|
56
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/commits?sha=master&since=2011-01-15T00:00:00%2B00:00")
|
90
57
|
end
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
stub_http_request(:get, "https://api.github.com/repos/sferik/rails_admin/commits").
|
95
|
-
with(:query=>{"per_page" => 35, "sha" => "master",
|
96
|
-
"until" => "2011-01-16T00:00:00+00:00"}).
|
97
|
-
to_return json_response('commits.json')
|
98
|
-
commits = @client.commits_before("sferik/rails_admin", "2011-01-16")
|
99
|
-
expect(commits).to be_an(Array)
|
58
|
+
it "handles the sha option" do
|
59
|
+
commits = @client.commits_since("sferik/rails_admin", "2011-01-15", :sha => "master")
|
60
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/commits?sha=master&since=2011-01-15T00:00:00%2B00:00")
|
100
61
|
end
|
62
|
+
end # .commits_since
|
101
63
|
|
64
|
+
describe ".commits_before", :vcr do
|
65
|
+
it "returns all commits until the specified date" do
|
66
|
+
commits = @client.commits_before("sferik/rails_admin", "2011-01-20")
|
67
|
+
expect(commits).to be_kind_of Array
|
68
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/commits?until=2011-01-20T00:00:00%2B00:00")
|
69
|
+
end
|
102
70
|
it "errors if the date is invalid" do
|
103
|
-
expect {@client.commits_before
|
71
|
+
expect { @client.commits_before "sferik/rails_admin", "A pear" }.to raise_error ArgumentError
|
104
72
|
end
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
describe ".commits_between" do
|
109
|
-
|
110
|
-
it "returns all commits between the specified dates" do
|
111
|
-
start_date = DateTime.parse("2011-01-17T00:00:00+00:00")
|
112
|
-
end_date = DateTime.parse("2011-01-20T00:00:00+00:00")
|
113
|
-
stub_http_request(:get, "https://api.github.com/repos/sferik/rails_admin/commits").
|
114
|
-
with(:query=>{"per_page" => 35, "sha" => "master",
|
115
|
-
"since" => "2011-01-17T00:00:00+00:00", "until" => "2011-01-20T00:00:00+00:00"}).
|
116
|
-
to_return json_response('commits.json')
|
117
|
-
commits = @client.commits_between("sferik/rails_admin", "2011-01-17", "2011-01-20")
|
118
|
-
expect(commits).to be_an(Array)
|
73
|
+
it "handles branch or sha argument" do
|
74
|
+
commits = @client.commits_before("sferik/rails_admin", "2011-01-15", "master")
|
75
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/commits?sha=master&until=2011-01-15T00:00:00%2B00:00")
|
119
76
|
end
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
end_date = Date.parse("2011-01-16T00:00:00+00:00")
|
124
|
-
stub_http_request(:get, "https://api.github.com/repos/sferik/rails_admin/commits").
|
125
|
-
with(:query=>{"per_page" => 35, "sha" => "master",
|
126
|
-
"since" => "2011-01-15T00:00:00+00:00", "until" => "2011-01-16T00:00:00+00:00"}).
|
127
|
-
to_return json_response('commits.json')
|
128
|
-
commits = @client.commits_between("sferik/rails_admin", "2011-01-15", "2011-01-16")
|
129
|
-
expect(commits).to be_an(Array)
|
77
|
+
it "handles the sha option" do
|
78
|
+
commits = @client.commits_before("sferik/rails_admin", "2011-01-15", :sha => "master")
|
79
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/commits?sha=master&until=2011-01-15T00:00:00%2B00:00")
|
130
80
|
end
|
81
|
+
end # .commits_before
|
131
82
|
|
132
|
-
|
133
|
-
|
83
|
+
describe ".commits_between", :vcr do
|
84
|
+
it "returns all commits until the specified date" do
|
85
|
+
commits = @client.commits_between("sferik/rails_admin", "2011-01-20", "2013-01-20")
|
86
|
+
expect(commits).to be_kind_of Array
|
87
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/commits?since=2011-01-20T00:00:00%2B00:00&until=2013-01-20T00:00:00%2B00:00")
|
134
88
|
end
|
135
|
-
|
136
|
-
|
137
|
-
expect {@client.commits_between("sferik/rails_admin", "A pear", "2011-01-15")}.to raise_exception(ArgumentError, "A pear is not a valid date")
|
89
|
+
it "errors if the date is invalid" do
|
90
|
+
expect { @client.commits_between "sferik/rails_admin", "A pear" }.to raise_error ArgumentError
|
138
91
|
end
|
139
|
-
|
140
|
-
|
141
|
-
|
92
|
+
it "handles branch or sha argument" do
|
93
|
+
commits = @client.commits_between("sferik/rails_admin", "2011-01-20", "2013-01-20", "master")
|
94
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/commits?sha=master&since=2011-01-20T00:00:00%2B00:00&until=2013-01-20T00:00:00%2B00:00")
|
142
95
|
end
|
96
|
+
it "handles the sha option" do
|
97
|
+
commits = @client.commits_between("sferik/rails_admin", "2011-01-20", "2013-01-20", :sha => "master")
|
98
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/commits?sha=master&since=2011-01-20T00:00:00%2B00:00&until=2013-01-20T00:00:00%2B00:00")
|
99
|
+
end
|
100
|
+
end # .commits_between
|
143
101
|
|
144
|
-
|
145
|
-
|
146
|
-
describe ".commit" do
|
147
|
-
|
102
|
+
describe ".commit", :vcr do
|
148
103
|
it "returns a commit" do
|
149
|
-
stub_get("/repos/sferik/rails_admin/commits/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
|
150
|
-
to_return(json_response("commit.json"))
|
151
104
|
commit = @client.commit("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
|
152
|
-
expect(commit.author.login).to eq
|
105
|
+
expect(commit.author.login).to eq 'caboteria'
|
106
|
+
assert_requested :get, github_url("/repos/sferik/rails_admin/commits/3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
|
153
107
|
end
|
108
|
+
end # .commit
|
154
109
|
|
155
|
-
|
156
|
-
|
157
|
-
describe ".create_commit" do
|
158
|
-
|
110
|
+
describe ".create_commit", :vcr do
|
159
111
|
it "creates a commit" do
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
to_return(json_response("commit_create.json"))
|
164
|
-
commit = @client.create_commit("octocat/Hello-World", "My commit message", "827efc6d56897b048c772eb4087f854f46256132", "7d1b31e74ee336d15cbd21741bc88a537ed063a0")
|
165
|
-
expect(commit.sha).to eq("7638417db6d59f3c431d3e1f261cc637155684cd")
|
166
|
-
expect(commit.message).to eq("My commit message")
|
167
|
-
expect(commit.parents.size).to eq(1)
|
168
|
-
expect(commit.parents.first.sha).to eq("7d1b31e74ee336d15cbd21741bc88a537ed063a0")
|
169
|
-
end
|
170
|
-
|
171
|
-
end
|
172
|
-
|
173
|
-
describe ".list_commit_comments" do
|
174
|
-
|
175
|
-
it "returns a list of all commit comments" do
|
176
|
-
stub_get("/repos/sferik/rails_admin/comments").
|
177
|
-
to_return(json_response("list_commit_comments.json"))
|
178
|
-
commit_comments = @client.list_commit_comments("sferik/rails_admin")
|
179
|
-
expect(commit_comments.first.user.login).to eq("sferik")
|
180
|
-
end
|
181
|
-
|
182
|
-
end
|
183
|
-
|
184
|
-
describe ".commit_comments" do
|
185
|
-
|
186
|
-
it "returns a list of comments for a specific commit" do
|
187
|
-
stub_get("/repos/sferik/rails_admin/commits/629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3/comments").
|
188
|
-
to_return(json_response("commit_comments.json"))
|
189
|
-
commit_comments = @client.commit_comments("sferik/rails_admin", "629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3")
|
190
|
-
expect(commit_comments.first.user.login).to eq("bbenezech")
|
191
|
-
end
|
192
|
-
|
193
|
-
end
|
194
|
-
|
195
|
-
describe ".commit_comment" do
|
196
|
-
|
197
|
-
it "returns a single commit comment" do
|
198
|
-
stub_get("/repos/sferik/rails_admin/comments/861907").
|
199
|
-
to_return(json_response("commit_comment.json"))
|
200
|
-
commit = @client.commit_comment("sferik/rails_admin", "861907")
|
201
|
-
expect(commit.user.login).to eq("bbenezech")
|
202
|
-
end
|
203
|
-
|
204
|
-
end
|
205
|
-
|
206
|
-
describe ".create_commit_comment" do
|
207
|
-
|
208
|
-
it "creates a commit comment" do
|
209
|
-
stub_post("/repos/sferik/rails_admin/commits/629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3/comments").
|
210
|
-
with(:body => { :body => "Hey Eric,\r\n\r\nI think it's a terrible idea: for a number of reasons (dissections, etc.), test suite should stay deterministic IMO.\r\n", :commit_id => "629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3", :line => 1, :path => ".rspec", :position => 4 },
|
211
|
-
:headers => { "Content-Type" => "application/json" }).
|
212
|
-
to_return(json_response("commit_comment_create.json"))
|
213
|
-
commit_comment = @client.create_commit_comment("sferik/rails_admin", "629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3", "Hey Eric,\r\n\r\nI think it's a terrible idea: for a number of reasons (dissections, etc.), test suite should stay deterministic IMO.\r\n", ".rspec", 1, 4)
|
214
|
-
expect(commit_comment.body).to eq("Hey Eric,\r\n\r\nI think it's a terrible idea: for a number of reasons (dissections, etc.), test suite should stay deterministic IMO.\r\n")
|
215
|
-
expect(commit_comment.commit_id).to eq("629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3")
|
216
|
-
expect(commit_comment.path).to eq(".rspec")
|
217
|
-
expect(commit_comment.line).to eq(1)
|
218
|
-
expect(commit_comment.position).to eq(4)
|
219
|
-
end
|
220
|
-
|
221
|
-
end
|
222
|
-
|
223
|
-
describe ".update_commit_comment" do
|
224
|
-
|
225
|
-
it "updates a commit comment" do
|
226
|
-
stub_patch("/repos/sferik/rails_admin/comments/860296").
|
227
|
-
with(:body => { :body => "Hey Eric,\r\n\r\nI think it's a terrible idea. The test suite should stay deterministic IMO.\r\n" },
|
228
|
-
:headers => { "Content-Type" => "application/json" }).
|
229
|
-
to_return(json_response("commit_comment_update.json"))
|
230
|
-
commit_comment = @client.update_commit_comment("sferik/rails_admin", "860296", "Hey Eric,\r\n\r\nI think it's a terrible idea. The test suite should stay deterministic IMO.\r\n")
|
231
|
-
expect(commit_comment.body).to eq("Hey Eric,\r\n\r\nI think it's a terrible idea. The test suite should stay deterministic IMO.\r\n")
|
232
|
-
end
|
233
|
-
|
234
|
-
end
|
235
|
-
|
236
|
-
describe ".delete_commit_comment" do
|
237
|
-
|
238
|
-
it "deletes a commit comment" do
|
239
|
-
stub_delete("/repos/sferik/rails_admin/comments/860296").
|
240
|
-
to_return(:status => 204, :body => "")
|
241
|
-
commit_comment = @client.delete_commit_comment("sferik/rails_admin", "860296")
|
242
|
-
expect(commit_comment).to eq(true)
|
112
|
+
last_commit = @client.commits('api-playground/api-sandbox').last
|
113
|
+
commit = @client.create_commit("api-playground/api-sandbox", "My commit message", last_commit.commit.tree.sha, last_commit.sha)
|
114
|
+
assert_requested :post, github_url("/repos/api-playground/api-sandbox/git/commits")
|
243
115
|
end
|
116
|
+
end # .create_commit
|
244
117
|
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
118
|
+
describe ".merge", :vcr do
|
119
|
+
it "merges a branch into another" do
|
120
|
+
begin
|
121
|
+
@client.delete_ref("api-playground/api-sandbox", "heads/branch-to-merge")
|
122
|
+
rescue Octokit::UnprocessableEntity
|
123
|
+
end
|
124
|
+
last_commit = @client.commits('api-playground/api-sandbox').last
|
125
|
+
branch = @client.create_ref("api-playground/api-sandbox", "heads/branch-to-merge", last_commit.sha)
|
126
|
+
merge = @client.merge("api-playground/api-sandbox", "master", "branch-to-merge", :commit_message => "Testing the merge API")
|
127
|
+
assert_requested :post, github_url("/repos/api-playground/api-sandbox/merges")
|
128
|
+
end
|
129
|
+
end # .merge
|
130
|
+
|
131
|
+
describe ".compare", :vcr do
|
249
132
|
it "returns a comparison" do
|
250
|
-
stub_get("/repos/gvaughn/octokit/compare/0e0d7ae299514da692eb1cab741562c253d44188...b7b37f75a80b8e84061cd45b246232ad958158f5").
|
251
|
-
to_return(json_response("compare.json"))
|
252
133
|
comparison = @client.compare("gvaughn/octokit", '0e0d7ae299514da692eb1cab741562c253d44188', 'b7b37f75a80b8e84061cd45b246232ad958158f5')
|
253
134
|
expect(comparison.base_commit.sha).to eq('0e0d7ae299514da692eb1cab741562c253d44188')
|
254
135
|
expect(comparison.merge_base_commit.sha).to eq('b7b37f75a80b8e84061cd45b246232ad958158f5')
|
136
|
+
assert_requested :get, github_url("/repos/gvaughn/octokit/compare/0e0d7ae299514da692eb1cab741562c253d44188...b7b37f75a80b8e84061cd45b246232ad958158f5")
|
255
137
|
end
|
256
|
-
end
|
257
|
-
|
258
|
-
describe ".merge" do
|
259
|
-
|
260
|
-
before do
|
261
|
-
stub_post("/repos/pengwynn/api-sandbox/merges").
|
262
|
-
to_return(json_response("merge.json"))
|
263
|
-
end
|
264
|
-
|
265
|
-
it "merges a branch into another" do
|
266
|
-
merge = @client.merge("pengwynn/api-sandbox", "master", "new-branch", :commit_message => "Testing the merge API")
|
267
|
-
expect(merge.sha).to eq('4298c8499e0a7a160975adefdecdf9d8a5437095')
|
268
|
-
expect(merge.commit.message).to eq('Testing the merge API')
|
269
|
-
end
|
270
|
-
|
271
|
-
end
|
138
|
+
end # .compare
|
272
139
|
end
|