added VCR and specs for original fetcher
This commit is contained in:
parent
df64ab5ba1
commit
8277aa4319
1
Gemfile
1
Gemfile
|
@ -15,6 +15,7 @@ group :development do
|
|||
end
|
||||
|
||||
group :test do
|
||||
gem "vcr"
|
||||
gem "coveralls", "~>0.8", require: false
|
||||
gem "simplecov", "~>0.10", require: false
|
||||
gem "codeclimate-test-reporter", "~>0.4"
|
||||
|
|
|
@ -220,7 +220,7 @@ Make sure, that you push tags to remote repo via 'git push --tags'"
|
|||
# Fetch commit for specified event
|
||||
# @return [Hash]
|
||||
def fetch_commit(event)
|
||||
@github.git_data.commits.get @options[:user], @options[:project], event[:commit_id]
|
||||
@github.git_data.commits.get @options[:user], @options[:project], event['commit_id']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
require "codeclimate-test-reporter"
|
||||
require "simplecov"
|
||||
require "coveralls"
|
||||
require "vcr"
|
||||
|
||||
# This module is only used to check the environment is currently a testing env
|
||||
module SpecHelper
|
||||
|
@ -36,6 +37,15 @@ end
|
|||
require "github_changelog_generator"
|
||||
require "github_changelog_generator/task"
|
||||
|
||||
|
||||
VCR.configure do |c|
|
||||
c.allow_http_connections_when_no_cassette = true
|
||||
c.cassette_library_dir = 'spec/vcr'
|
||||
c.ignore_localhost = true
|
||||
c.default_cassette_options = { :record => :new_episodes }
|
||||
c.hook_into :faraday
|
||||
end
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.expect_with :rspec do |expectations|
|
||||
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
||||
|
@ -55,4 +65,8 @@ RSpec.configure do |config|
|
|||
config.order = :random
|
||||
|
||||
Kernel.srand config.seed
|
||||
|
||||
config.extend VCR::RSpec::Macros
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -2,59 +2,230 @@
|
|||
VALID_TOKEN = "0123456789abcdef"
|
||||
INVALID_TOKEN = "0000000000000000"
|
||||
|
||||
DEFAULT_OPTIONS = { user: "skywinder",
|
||||
project: "changelog_test" }
|
||||
|
||||
def options_with_invalid_token
|
||||
options = DEFAULT_OPTIONS
|
||||
options[:token] = INVALID_TOKEN
|
||||
options
|
||||
end
|
||||
|
||||
describe GitHubChangelogGenerator::Fetcher do
|
||||
before(:all) do
|
||||
@fetcher = GitHubChangelogGenerator::Fetcher.new
|
||||
let(:options) do
|
||||
{
|
||||
:user => "skywinder",
|
||||
:project => "changelog_test",
|
||||
}
|
||||
end
|
||||
|
||||
let(:fetcher) { GitHubChangelogGenerator::Fetcher.new(options) }
|
||||
|
||||
|
||||
describe "#fetch_github_token" do
|
||||
token = GitHubChangelogGenerator::Fetcher::CHANGELOG_GITHUB_TOKEN
|
||||
context "when token in ENV exist" do
|
||||
before { stub_const("ENV", ENV.to_hash.merge(token => VALID_TOKEN)) }
|
||||
subject { @fetcher.fetch_github_token }
|
||||
subject { fetcher.fetch_github_token }
|
||||
it { is_expected.to eq(VALID_TOKEN) }
|
||||
end
|
||||
|
||||
context "when token in ENV is nil" do
|
||||
before { stub_const("ENV", ENV.to_hash.merge(token => nil)) }
|
||||
subject { @fetcher.fetch_github_token }
|
||||
subject { fetcher.fetch_github_token }
|
||||
it { is_expected.to be_nil }
|
||||
end
|
||||
|
||||
context "when token in options and ENV is nil" do
|
||||
let(:options) { { :token => VALID_TOKEN } }
|
||||
|
||||
before do
|
||||
stub_const("ENV", ENV.to_hash.merge(token => nil))
|
||||
@fetcher = GitHubChangelogGenerator::Fetcher.new(token: VALID_TOKEN)
|
||||
end
|
||||
subject { @fetcher.fetch_github_token }
|
||||
|
||||
subject { fetcher.fetch_github_token }
|
||||
it { is_expected.to eq(VALID_TOKEN) }
|
||||
end
|
||||
|
||||
context "when token in options and ENV specified" do
|
||||
let(:options) { { :token => VALID_TOKEN } }
|
||||
|
||||
before do
|
||||
stub_const("ENV", ENV.to_hash.merge(token => "no_matter_what"))
|
||||
@fetcher = GitHubChangelogGenerator::Fetcher.new(token: VALID_TOKEN)
|
||||
end
|
||||
subject { @fetcher.fetch_github_token }
|
||||
|
||||
subject { fetcher.fetch_github_token }
|
||||
it { is_expected.to eq(VALID_TOKEN) }
|
||||
end
|
||||
end
|
||||
|
||||
describe "#get_all_tags" do
|
||||
context "when github_fetch_tags returns tags" do
|
||||
it "returns tags" do
|
||||
mock_tags = ['tag']
|
||||
allow(fetcher).to receive(:github_fetch_tags).and_return(mock_tags)
|
||||
expect(fetcher.get_all_tags).to eq(mock_tags)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#github_fetch_tags" do
|
||||
context "when wrong token provided" do
|
||||
before do
|
||||
options = options_with_invalid_token
|
||||
@fetcher = GitHubChangelogGenerator::Fetcher.new(options)
|
||||
use_vcr_cassette
|
||||
|
||||
let(:options) do
|
||||
{
|
||||
:user => "skywinder",
|
||||
:project => "changelog_test",
|
||||
:token => INVALID_TOKEN
|
||||
}
|
||||
end
|
||||
|
||||
it "should raise Unauthorized error" do
|
||||
expect { @fetcher.github_fetch_tags }.to raise_error Github::Error::Unauthorized
|
||||
expect { fetcher.github_fetch_tags }.to raise_error Github::Error::Unauthorized
|
||||
end
|
||||
end
|
||||
|
||||
context "when API call is valid" do
|
||||
use_vcr_cassette
|
||||
|
||||
it "should return tags" do
|
||||
expected_tags = [{"name"=>"v0.0.3", "zipball_url"=>"https://api.github.com/repos/skywinder/changelog_test/zipball/v0.0.3", "tarball_url"=>"https://api.github.com/repos/skywinder/changelog_test/tarball/v0.0.3", "commit"=>{"sha"=>"a0cba2b1a1ea9011ab07ee1ac140ba5a5eb8bd90", "url"=>"https://api.github.com/repos/skywinder/changelog_test/commits/a0cba2b1a1ea9011ab07ee1ac140ba5a5eb8bd90"}}, {"name"=>"v0.0.2", "zipball_url"=>"https://api.github.com/repos/skywinder/changelog_test/zipball/v0.0.2", "tarball_url"=>"https://api.github.com/repos/skywinder/changelog_test/tarball/v0.0.2", "commit"=>{"sha"=>"9b35bb13dcd15b68e7bcbf10cde5eb937a54f710", "url"=>"https://api.github.com/repos/skywinder/changelog_test/commits/9b35bb13dcd15b68e7bcbf10cde5eb937a54f710"}}, {"name"=>"v0.0.1", "zipball_url"=>"https://api.github.com/repos/skywinder/changelog_test/zipball/v0.0.1", "tarball_url"=>"https://api.github.com/repos/skywinder/changelog_test/tarball/v0.0.1", "commit"=>{"sha"=>"4c2d6d1ed58bdb24b870dcb5d9f2ceed0283d69d", "url"=>"https://api.github.com/repos/skywinder/changelog_test/commits/4c2d6d1ed58bdb24b870dcb5d9f2ceed0283d69d"}}, {"name"=>"0.0.4", "zipball_url"=>"https://api.github.com/repos/skywinder/changelog_test/zipball/0.0.4", "tarball_url"=>"https://api.github.com/repos/skywinder/changelog_test/tarball/0.0.4", "commit"=>{"sha"=>"ece0c3ab7142b21064b885061c55ede00ef6ce94", "url"=>"https://api.github.com/repos/skywinder/changelog_test/commits/ece0c3ab7142b21064b885061c55ede00ef6ce94"}}]
|
||||
|
||||
expect(fetcher.github_fetch_tags).to eq(expected_tags)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe "#fetch_closed_issues_and_pr" do
|
||||
context "when API call is valid" do
|
||||
use_vcr_cassette
|
||||
|
||||
|
||||
it "returns issues" do
|
||||
issues, pull_requests = fetcher.fetch_closed_issues_and_pr
|
||||
expect(issues.size).to eq(7)
|
||||
expect(pull_requests.size).to eq(14)
|
||||
end
|
||||
|
||||
it "returns issue with proper key/values" do
|
||||
issues, pull_requests = fetcher.fetch_closed_issues_and_pr
|
||||
expected_issue = {"url"=>"https://api.github.com/repos/skywinder/changelog_test/issues/14", "repository_url"=>"https://api.github.com/repos/skywinder/changelog_test", "labels_url"=>"https://api.github.com/repos/skywinder/changelog_test/issues/14/labels{/name}", "comments_url"=>"https://api.github.com/repos/skywinder/changelog_test/issues/14/comments", "events_url"=>"https://api.github.com/repos/skywinder/changelog_test/issues/14/events", "html_url"=>"https://github.com/skywinder/changelog_test/issues/14", "id"=>95419412, "number"=>14, "title"=>"Issue closed from commit from PR", "user"=>{"login"=>"skywinder", "id"=>3356474, "avatar_url"=>"https://avatars.githubusercontent.com/u/3356474?v=3", "gravatar_id"=>"", "url"=>"https://api.github.com/users/skywinder", "html_url"=>"https://github.com/skywinder", "followers_url"=>"https://api.github.com/users/skywinder/followers", "following_url"=>"https://api.github.com/users/skywinder/following{/other_user}", "gists_url"=>"https://api.github.com/users/skywinder/gists{/gist_id}", "starred_url"=>"https://api.github.com/users/skywinder/starred{/owner}{/repo}", "subscriptions_url"=>"https://api.github.com/users/skywinder/subscriptions", "organizations_url"=>"https://api.github.com/users/skywinder/orgs", "repos_url"=>"https://api.github.com/users/skywinder/repos", "events_url"=>"https://api.github.com/users/skywinder/events{/privacy}", "received_events_url"=>"https://api.github.com/users/skywinder/received_events", "type"=>"User", "site_admin"=>false}, "labels"=>[], "state"=>"closed", "locked"=>false, "assignee"=>nil, "milestone"=>nil, "comments"=>0, "created_at"=>"2015-07-16T12:06:08Z", "updated_at"=>"2015-07-16T12:21:42Z", "closed_at"=>"2015-07-16T12:21:42Z", "body"=>""}
|
||||
expect(issues.first).to eq(expected_issue)
|
||||
end
|
||||
|
||||
it "returns pull request with proper key/values" do
|
||||
issues, pull_requests = fetcher.fetch_closed_issues_and_pr
|
||||
expected_pr = {"url"=>"https://api.github.com/repos/skywinder/changelog_test/issues/21", "repository_url"=>"https://api.github.com/repos/skywinder/changelog_test", "labels_url"=>"https://api.github.com/repos/skywinder/changelog_test/issues/21/labels{/name}", "comments_url"=>"https://api.github.com/repos/skywinder/changelog_test/issues/21/comments", "events_url"=>"https://api.github.com/repos/skywinder/changelog_test/issues/21/events", "html_url"=>"https://github.com/skywinder/changelog_test/pull/21", "id"=>124925759, "number"=>21, "title"=>"Merged br (should appear in change log with #20)", "user"=>{"login"=>"skywinder", "id"=>3356474, "avatar_url"=>"https://avatars.githubusercontent.com/u/3356474?v=3", "gravatar_id"=>"", "url"=>"https://api.github.com/users/skywinder", "html_url"=>"https://github.com/skywinder", "followers_url"=>"https://api.github.com/users/skywinder/followers", "following_url"=>"https://api.github.com/users/skywinder/following{/other_user}", "gists_url"=>"https://api.github.com/users/skywinder/gists{/gist_id}", "starred_url"=>"https://api.github.com/users/skywinder/starred{/owner}{/repo}", "subscriptions_url"=>"https://api.github.com/users/skywinder/subscriptions", "organizations_url"=>"https://api.github.com/users/skywinder/orgs", "repos_url"=>"https://api.github.com/users/skywinder/repos", "events_url"=>"https://api.github.com/users/skywinder/events{/privacy}", "received_events_url"=>"https://api.github.com/users/skywinder/received_events", "type"=>"User", "site_admin"=>false}, "labels"=>[], "state"=>"closed", "locked"=>false, "assignee"=>nil, "milestone"=>nil, "comments"=>0, "created_at"=>"2016-01-05T09:24:08Z", "updated_at"=>"2016-01-05T09:26:53Z", "closed_at"=>"2016-01-05T09:24:27Z", "pull_request"=>{"url"=>"https://api.github.com/repos/skywinder/changelog_test/pulls/21", "html_url"=>"https://github.com/skywinder/changelog_test/pull/21", "diff_url"=>"https://github.com/skywinder/changelog_test/pull/21.diff", "patch_url"=>"https://github.com/skywinder/changelog_test/pull/21.patch"}, "body"=>"to test https://github.com/skywinder/github-changelog-generator/pull/305\r\nshould appear in change log with #20"}
|
||||
expect(pull_requests.first).to eq(expected_pr)
|
||||
end
|
||||
|
||||
|
||||
it "returns issues with labels" do
|
||||
issues, pull_requests = fetcher.fetch_closed_issues_and_pr
|
||||
expected = [[], [], ["Bug"], [], ["enhancement"], ["some label"], []]
|
||||
expect(issues.map{|i| i.labels.map(&:name) }).to eq(expected)
|
||||
end
|
||||
|
||||
it "returns pull_requests with labels" do
|
||||
issues, pull_requests = fetcher.fetch_closed_issues_and_pr
|
||||
expected = [[], [], [], [], [], ["enhancement"], [], [], ["invalid"], [], [], [], [], ["invalid"]]
|
||||
expect(pull_requests.map{|i| i.labels.map(&:name) }).to eq(expected)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#fetch_closed_pull_requests" do
|
||||
context "when API call is valid" do
|
||||
use_vcr_cassette
|
||||
|
||||
it "returns pull requests" do
|
||||
pull_requests = fetcher.fetch_closed_pull_requests
|
||||
expect(pull_requests.size).to eq(14)
|
||||
end
|
||||
|
||||
it "returns correct pull request keys" do
|
||||
pull_requests = fetcher.fetch_closed_pull_requests
|
||||
|
||||
pr = pull_requests.first
|
||||
expect(pr.keys).to eq(["url", "id", "html_url", "diff_url", "patch_url", "issue_url", "number", "state", "locked", "title", "user", "body", "created_at", "updated_at", "closed_at", "merged_at", "merge_commit_sha", "assignee", "milestone", "commits_url", "review_comments_url", "review_comment_url", "comments_url", "statuses_url", "head", "base", "_links"])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe "#fetch_events_async" do
|
||||
context "when API call is valid" do
|
||||
use_vcr_cassette
|
||||
|
||||
it "populates issues" do
|
||||
issues = [{"url"=>"https://api.github.com/repos/skywinder/changelog_test/issues/14", "repository_url"=>"https://api.github.com/repos/skywinder/changelog_test", "labels_url"=>"https://api.github.com/repos/skywinder/changelog_test/issues/14/labels{/name}", "comments_url"=>"https://api.github.com/repos/skywinder/changelog_test/issues/14/comments", "events_url"=>"https://api.github.com/repos/skywinder/changelog_test/issues/14/events", "html_url"=>"https://github.com/skywinder/changelog_test/issues/14", "id"=>95419412, "number"=>14, "title"=>"Issue closed from commit from PR", "user"=>{"login"=>"skywinder", "id"=>3356474, "avatar_url"=>"https://avatars.githubusercontent.com/u/3356474?v=3", "gravatar_id"=>"", "url"=>"https://api.github.com/users/skywinder", "html_url"=>"https://github.com/skywinder", "followers_url"=>"https://api.github.com/users/skywinder/followers", "following_url"=>"https://api.github.com/users/skywinder/following{/other_user}", "gists_url"=>"https://api.github.com/users/skywinder/gists{/gist_id}", "starred_url"=>"https://api.github.com/users/skywinder/starred{/owner}{/repo}", "subscriptions_url"=>"https://api.github.com/users/skywinder/subscriptions", "organizations_url"=>"https://api.github.com/users/skywinder/orgs", "repos_url"=>"https://api.github.com/users/skywinder/repos", "events_url"=>"https://api.github.com/users/skywinder/events{/privacy}", "received_events_url"=>"https://api.github.com/users/skywinder/received_events", "type"=>"User", "site_admin"=>false}, "labels"=>[], "state"=>"closed", "locked"=>false, "assignee"=>nil, "milestone"=>nil, "comments"=>0, "created_at"=>"2015-07-16T12:06:08Z", "updated_at"=>"2015-07-16T12:21:42Z", "closed_at"=>"2015-07-16T12:21:42Z", "body"=>""}]
|
||||
|
||||
# Check that they are blank to begin with
|
||||
expect(issues.first[:events]).to be_nil
|
||||
|
||||
fetcher.fetch_events_async(issues)
|
||||
issue_events = issues.first[:events]
|
||||
|
||||
expected_events = [{"id"=>357462189, "url"=>"https://api.github.com/repos/skywinder/changelog_test/issues/events/357462189", "actor"=>{"login"=>"skywinder", "id"=>3356474, "avatar_url"=>"https://avatars.githubusercontent.com/u/3356474?v=3", "gravatar_id"=>"", "url"=>"https://api.github.com/users/skywinder", "html_url"=>"https://github.com/skywinder", "followers_url"=>"https://api.github.com/users/skywinder/followers", "following_url"=>"https://api.github.com/users/skywinder/following{/other_user}", "gists_url"=>"https://api.github.com/users/skywinder/gists{/gist_id}", "starred_url"=>"https://api.github.com/users/skywinder/starred{/owner}{/repo}", "subscriptions_url"=>"https://api.github.com/users/skywinder/subscriptions", "organizations_url"=>"https://api.github.com/users/skywinder/orgs", "repos_url"=>"https://api.github.com/users/skywinder/repos", "events_url"=>"https://api.github.com/users/skywinder/events{/privacy}", "received_events_url"=>"https://api.github.com/users/skywinder/received_events", "type"=>"User", "site_admin"=>false}, "event"=>"referenced", "commit_id"=>"decfe840d1a1b86e0c28700de5362d3365a29555", "commit_url"=>"https://api.github.com/repos/skywinder/changelog_test/commits/decfe840d1a1b86e0c28700de5362d3365a29555", "created_at"=>"2015-07-16T12:21:16Z"}, {"id"=>357462542, "url"=>"https://api.github.com/repos/skywinder/changelog_test/issues/events/357462542", "actor"=>{"login"=>"skywinder", "id"=>3356474, "avatar_url"=>"https://avatars.githubusercontent.com/u/3356474?v=3", "gravatar_id"=>"", "url"=>"https://api.github.com/users/skywinder", "html_url"=>"https://github.com/skywinder", "followers_url"=>"https://api.github.com/users/skywinder/followers", "following_url"=>"https://api.github.com/users/skywinder/following{/other_user}", "gists_url"=>"https://api.github.com/users/skywinder/gists{/gist_id}", "starred_url"=>"https://api.github.com/users/skywinder/starred{/owner}{/repo}", "subscriptions_url"=>"https://api.github.com/users/skywinder/subscriptions", "organizations_url"=>"https://api.github.com/users/skywinder/orgs", "repos_url"=>"https://api.github.com/users/skywinder/repos", "events_url"=>"https://api.github.com/users/skywinder/events{/privacy}", "received_events_url"=>"https://api.github.com/users/skywinder/received_events", "type"=>"User", "site_admin"=>false}, "event"=>"closed", "commit_id"=>"decfe840d1a1b86e0c28700de5362d3365a29555", "commit_url"=>"https://api.github.com/repos/skywinder/changelog_test/commits/decfe840d1a1b86e0c28700de5362d3365a29555", "created_at"=>"2015-07-16T12:21:42Z"}]
|
||||
expect(issue_events).to eq(expected_events)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe "#fetch_date_of_tag" do
|
||||
context "when API call is valid" do
|
||||
use_vcr_cassette
|
||||
|
||||
it "returns date" do
|
||||
tag = {"name"=>"v0.0.3", "zipball_url"=>"https://api.github.com/repos/skywinder/changelog_test/zipball/v0.0.3", "tarball_url"=>"https://api.github.com/repos/skywinder/changelog_test/tarball/v0.0.3", "commit"=>{"sha"=>"a0cba2b1a1ea9011ab07ee1ac140ba5a5eb8bd90", "url"=>"https://api.github.com/repos/skywinder/changelog_test/commits/a0cba2b1a1ea9011ab07ee1ac140ba5a5eb8bd90"}}
|
||||
dt = fetcher.fetch_date_of_tag(tag)
|
||||
expect(dt).to eq(Time.parse("2015-03-04 19:01:48 UTC"))
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe "#fetch_commit" do
|
||||
context "when API call is valid" do
|
||||
use_vcr_cassette
|
||||
|
||||
it "returns commit" do
|
||||
event = {"id"=>357462189, "url"=>"https://api.github.com/repos/skywinder/changelog_test/issues/events/357462189", "actor"=>{"login"=>"skywinder", "id"=>3356474, "avatar_url"=>"https://avatars.githubusercontent.com/u/3356474?v=3", "gravatar_id"=>"", "url"=>"https://api.github.com/users/skywinder", "html_url"=>"https://github.com/skywinder", "followers_url"=>"https://api.github.com/users/skywinder/followers", "following_url"=>"https://api.github.com/users/skywinder/following{/other_user}", "gists_url"=>"https://api.github.com/users/skywinder/gists{/gist_id}", "starred_url"=>"https://api.github.com/users/skywinder/starred{/owner}{/repo}", "subscriptions_url"=>"https://api.github.com/users/skywinder/subscriptions", "organizations_url"=>"https://api.github.com/users/skywinder/orgs", "repos_url"=>"https://api.github.com/users/skywinder/repos", "events_url"=>"https://api.github.com/users/skywinder/events{/privacy}", "received_events_url"=>"https://api.github.com/users/skywinder/received_events", "type"=>"User", "site_admin"=>false}, "event"=>"referenced", "commit_id"=>"decfe840d1a1b86e0c28700de5362d3365a29555", "commit_url"=>"https://api.github.com/repos/skywinder/changelog_test/commits/decfe840d1a1b86e0c28700de5362d3365a29555", "created_at"=>"2015-07-16T12:21:16Z"}
|
||||
commit = fetcher.fetch_commit(event)
|
||||
|
||||
expectations = [
|
||||
["sha", "decfe840d1a1b86e0c28700de5362d3365a29555"],
|
||||
["url",
|
||||
"https://api.github.com/repos/skywinder/changelog_test/git/commits/decfe840d1a1b86e0c28700de5362d3365a29555"],
|
||||
["html_url",
|
||||
"https://github.com/skywinder/changelog_test/commit/decfe840d1a1b86e0c28700de5362d3365a29555"],
|
||||
["author",
|
||||
{"name"=>"Petr Korolev",
|
||||
"email"=>"sky4winder@gmail.com",
|
||||
"date"=>"2015-07-16T12:11:01Z"}],
|
||||
["committer",
|
||||
{"name"=>"Petr Korolev",
|
||||
"email"=>"sky4winder@gmail.com",
|
||||
"date"=>"2015-07-16T12:11:01Z"}],
|
||||
["tree",
|
||||
{"sha"=>"0699c15258a7c2b2e157051fe19851d4f705cac8",
|
||||
"url"=>
|
||||
"https://api.github.com/repos/skywinder/changelog_test/git/trees/0699c15258a7c2b2e157051fe19851d4f705cac8"}],
|
||||
["message", "fix #14"],
|
||||
["parents",
|
||||
[{"sha"=>"7ec095e5e3caceacedabf44d0b9b10da17c92e51",
|
||||
"url"=>
|
||||
"https://api.github.com/repos/skywinder/changelog_test/git/commits/7ec095e5e3caceacedabf44d0b9b10da17c92e51",
|
||||
"html_url"=>
|
||||
"https://github.com/skywinder/changelog_test/commit/7ec095e5e3caceacedabf44d0b9b10da17c92e51"}]
|
||||
]
|
||||
]
|
||||
|
||||
expectations.each do |property, val|
|
||||
expect(commit.send(property)).to eq(val)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,76 @@
|
|||
---
|
||||
http_interactions:
|
||||
- request:
|
||||
method: get
|
||||
uri: https://api.github.com/repos/skywinder/changelog_test/git/commits/decfe840d1a1b86e0c28700de5362d3365a29555
|
||||
body:
|
||||
encoding: US-ASCII
|
||||
string: ''
|
||||
headers:
|
||||
Accept:
|
||||
- application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1
|
||||
Accept-Charset:
|
||||
- utf-8
|
||||
User-Agent:
|
||||
- Github API Ruby Gem 0.13.1
|
||||
response:
|
||||
status:
|
||||
code: 200
|
||||
message:
|
||||
headers:
|
||||
server:
|
||||
- GitHub.com
|
||||
date:
|
||||
- Thu, 19 May 2016 19:00:27 GMT
|
||||
content-type:
|
||||
- application/json; charset=utf-8
|
||||
transfer-encoding:
|
||||
- chunked
|
||||
connection:
|
||||
- close
|
||||
status:
|
||||
- 200 OK
|
||||
x-ratelimit-limit:
|
||||
- '60'
|
||||
x-ratelimit-remaining:
|
||||
- '43'
|
||||
x-ratelimit-reset:
|
||||
- '1463684440'
|
||||
cache-control:
|
||||
- public, max-age=60, s-maxage=60
|
||||
vary:
|
||||
- Accept, Accept-Encoding
|
||||
etag:
|
||||
- W/"391047306d50dcb964a83bc94e45c33d"
|
||||
last-modified:
|
||||
- Thu, 16 Jul 2015 12:11:01 GMT
|
||||
x-github-media-type:
|
||||
- github.v3; format=json
|
||||
access-control-expose-headers:
|
||||
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
||||
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
||||
access-control-allow-origin:
|
||||
- "*"
|
||||
content-security-policy:
|
||||
- default-src 'none'
|
||||
strict-transport-security:
|
||||
- max-age=31536000; includeSubdomains; preload
|
||||
x-content-type-options:
|
||||
- nosniff
|
||||
x-frame-options:
|
||||
- deny
|
||||
x-xss-protection:
|
||||
- 1; mode=block
|
||||
x-served-by:
|
||||
- ef96c2e493b28ffea49b891b085ed2dd
|
||||
x-github-request-id:
|
||||
- 6C2F0F69:7F90:A1B77F1:573E0D4B
|
||||
body:
|
||||
encoding: ASCII-8BIT
|
||||
string: '{"sha":"decfe840d1a1b86e0c28700de5362d3365a29555","url":"https://api.github.com/repos/skywinder/changelog_test/git/commits/decfe840d1a1b86e0c28700de5362d3365a29555","html_url":"https://github.com/skywinder/changelog_test/commit/decfe840d1a1b86e0c28700de5362d3365a29555","author":{"name":"Petr
|
||||
Korolev","email":"sky4winder@gmail.com","date":"2015-07-16T12:11:01Z"},"committer":{"name":"Petr
|
||||
Korolev","email":"sky4winder@gmail.com","date":"2015-07-16T12:11:01Z"},"tree":{"sha":"0699c15258a7c2b2e157051fe19851d4f705cac8","url":"https://api.github.com/repos/skywinder/changelog_test/git/trees/0699c15258a7c2b2e157051fe19851d4f705cac8"},"message":"fix
|
||||
#14","parents":[{"sha":"7ec095e5e3caceacedabf44d0b9b10da17c92e51","url":"https://api.github.com/repos/skywinder/changelog_test/git/commits/7ec095e5e3caceacedabf44d0b9b10da17c92e51","html_url":"https://github.com/skywinder/changelog_test/commit/7ec095e5e3caceacedabf44d0b9b10da17c92e51"}]}'
|
||||
http_version:
|
||||
recorded_at: Thu, 19 May 2016 19:00:30 GMT
|
||||
recorded_with: VCR 3.0.1
|
|
@ -0,0 +1,76 @@
|
|||
---
|
||||
http_interactions:
|
||||
- request:
|
||||
method: get
|
||||
uri: https://api.github.com/repos/skywinder/changelog_test/git/commits/a0cba2b1a1ea9011ab07ee1ac140ba5a5eb8bd90
|
||||
body:
|
||||
encoding: US-ASCII
|
||||
string: ''
|
||||
headers:
|
||||
Accept:
|
||||
- application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1
|
||||
Accept-Charset:
|
||||
- utf-8
|
||||
User-Agent:
|
||||
- Github API Ruby Gem 0.13.1
|
||||
response:
|
||||
status:
|
||||
code: 200
|
||||
message:
|
||||
headers:
|
||||
server:
|
||||
- GitHub.com
|
||||
date:
|
||||
- Thu, 19 May 2016 18:25:19 GMT
|
||||
content-type:
|
||||
- application/json; charset=utf-8
|
||||
transfer-encoding:
|
||||
- chunked
|
||||
connection:
|
||||
- close
|
||||
status:
|
||||
- 200 OK
|
||||
x-ratelimit-limit:
|
||||
- '60'
|
||||
x-ratelimit-remaining:
|
||||
- '44'
|
||||
x-ratelimit-reset:
|
||||
- '1463684440'
|
||||
cache-control:
|
||||
- public, max-age=60, s-maxage=60
|
||||
vary:
|
||||
- Accept, Accept-Encoding
|
||||
etag:
|
||||
- W/"70e24649f6eca2e822b32129a2e73312"
|
||||
last-modified:
|
||||
- Wed, 04 Mar 2015 19:01:48 GMT
|
||||
x-github-media-type:
|
||||
- github.v3; format=json
|
||||
access-control-expose-headers:
|
||||
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
||||
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
||||
access-control-allow-origin:
|
||||
- "*"
|
||||
content-security-policy:
|
||||
- default-src 'none'
|
||||
strict-transport-security:
|
||||
- max-age=31536000; includeSubdomains; preload
|
||||
x-content-type-options:
|
||||
- nosniff
|
||||
x-frame-options:
|
||||
- deny
|
||||
x-xss-protection:
|
||||
- 1; mode=block
|
||||
x-served-by:
|
||||
- cee4c0729c8e9147e7abcb45b9d69689
|
||||
x-github-request-id:
|
||||
- 6C2F0F69:7F8E:5B42511:573E050F
|
||||
body:
|
||||
encoding: ASCII-8BIT
|
||||
string: '{"sha":"a0cba2b1a1ea9011ab07ee1ac140ba5a5eb8bd90","url":"https://api.github.com/repos/skywinder/changelog_test/git/commits/a0cba2b1a1ea9011ab07ee1ac140ba5a5eb8bd90","html_url":"https://github.com/skywinder/changelog_test/commit/a0cba2b1a1ea9011ab07ee1ac140ba5a5eb8bd90","author":{"name":"Petr
|
||||
Korolev","email":"sky4winder@gmail.com","date":"2015-03-04T19:01:48Z"},"committer":{"name":"Petr
|
||||
Korolev","email":"sky4winder@gmail.com","date":"2015-03-04T19:01:48Z"},"tree":{"sha":"1ff276df2dcd58d90a1267ff219ced923acc3da8","url":"https://api.github.com/repos/skywinder/changelog_test/git/trees/1ff276df2dcd58d90a1267ff219ced923acc3da8"},"message":"Merge
|
||||
branch ''hotfix/fix-3''","parents":[{"sha":"6a28f64bbe783d7ac171c38cefcb109e1b8e0911","url":"https://api.github.com/repos/skywinder/changelog_test/git/commits/6a28f64bbe783d7ac171c38cefcb109e1b8e0911","html_url":"https://github.com/skywinder/changelog_test/commit/6a28f64bbe783d7ac171c38cefcb109e1b8e0911"},{"sha":"68445f5d2bd8df612e25b37058aea7f123439fa1","url":"https://api.github.com/repos/skywinder/changelog_test/git/commits/68445f5d2bd8df612e25b37058aea7f123439fa1","html_url":"https://github.com/skywinder/changelog_test/commit/68445f5d2bd8df612e25b37058aea7f123439fa1"}]}'
|
||||
http_version:
|
||||
recorded_at: Thu, 19 May 2016 18:25:23 GMT
|
||||
recorded_with: VCR 3.0.1
|
|
@ -0,0 +1,71 @@
|
|||
---
|
||||
http_interactions:
|
||||
- request:
|
||||
method: get
|
||||
uri: https://api.github.com/repos/skywinder/changelog_test/issues/14/events
|
||||
body:
|
||||
encoding: US-ASCII
|
||||
string: ''
|
||||
headers:
|
||||
Accept:
|
||||
- application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1
|
||||
Accept-Charset:
|
||||
- utf-8
|
||||
User-Agent:
|
||||
- Github API Ruby Gem 0.13.1
|
||||
response:
|
||||
status:
|
||||
code: 200
|
||||
message:
|
||||
headers:
|
||||
server:
|
||||
- GitHub.com
|
||||
date:
|
||||
- Thu, 19 May 2016 18:19:40 GMT
|
||||
content-type:
|
||||
- application/json; charset=utf-8
|
||||
transfer-encoding:
|
||||
- chunked
|
||||
connection:
|
||||
- close
|
||||
status:
|
||||
- 200 OK
|
||||
x-ratelimit-limit:
|
||||
- '60'
|
||||
x-ratelimit-remaining:
|
||||
- '45'
|
||||
x-ratelimit-reset:
|
||||
- '1463684440'
|
||||
cache-control:
|
||||
- public, max-age=60, s-maxage=60
|
||||
vary:
|
||||
- Accept, Accept-Encoding
|
||||
etag:
|
||||
- W/"9e001bcf4bf22abb6602f57d114ce205"
|
||||
x-github-media-type:
|
||||
- github.v3; format=json
|
||||
access-control-expose-headers:
|
||||
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
||||
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
||||
access-control-allow-origin:
|
||||
- "*"
|
||||
content-security-policy:
|
||||
- default-src 'none'
|
||||
strict-transport-security:
|
||||
- max-age=31536000; includeSubdomains; preload
|
||||
x-content-type-options:
|
||||
- nosniff
|
||||
x-frame-options:
|
||||
- deny
|
||||
x-xss-protection:
|
||||
- 1; mode=block
|
||||
x-served-by:
|
||||
- bae57931a6fe678a3dffe9be8e7819c8
|
||||
x-github-request-id:
|
||||
- 6C2F0F69:7F91:BA87215:573E03BC
|
||||
body:
|
||||
encoding: ASCII-8BIT
|
||||
string: '[{"id":357462189,"url":"https://api.github.com/repos/skywinder/changelog_test/issues/events/357462189","actor":{"login":"skywinder","id":3356474,"avatar_url":"https://avatars.githubusercontent.com/u/3356474?v=3","gravatar_id":"","url":"https://api.github.com/users/skywinder","html_url":"https://github.com/skywinder","followers_url":"https://api.github.com/users/skywinder/followers","following_url":"https://api.github.com/users/skywinder/following{/other_user}","gists_url":"https://api.github.com/users/skywinder/gists{/gist_id}","starred_url":"https://api.github.com/users/skywinder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skywinder/subscriptions","organizations_url":"https://api.github.com/users/skywinder/orgs","repos_url":"https://api.github.com/users/skywinder/repos","events_url":"https://api.github.com/users/skywinder/events{/privacy}","received_events_url":"https://api.github.com/users/skywinder/received_events","type":"User","site_admin":false},"event":"referenced","commit_id":"decfe840d1a1b86e0c28700de5362d3365a29555","commit_url":"https://api.github.com/repos/skywinder/changelog_test/commits/decfe840d1a1b86e0c28700de5362d3365a29555","created_at":"2015-07-16T12:21:16Z"},{"id":357462542,"url":"https://api.github.com/repos/skywinder/changelog_test/issues/events/357462542","actor":{"login":"skywinder","id":3356474,"avatar_url":"https://avatars.githubusercontent.com/u/3356474?v=3","gravatar_id":"","url":"https://api.github.com/users/skywinder","html_url":"https://github.com/skywinder","followers_url":"https://api.github.com/users/skywinder/followers","following_url":"https://api.github.com/users/skywinder/following{/other_user}","gists_url":"https://api.github.com/users/skywinder/gists{/gist_id}","starred_url":"https://api.github.com/users/skywinder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skywinder/subscriptions","organizations_url":"https://api.github.com/users/skywinder/orgs","repos_url":"https://api.github.com/users/skywinder/repos","events_url":"https://api.github.com/users/skywinder/events{/privacy}","received_events_url":"https://api.github.com/users/skywinder/received_events","type":"User","site_admin":false},"event":"closed","commit_id":"decfe840d1a1b86e0c28700de5362d3365a29555","commit_url":"https://api.github.com/repos/skywinder/changelog_test/commits/decfe840d1a1b86e0c28700de5362d3365a29555","created_at":"2015-07-16T12:21:42Z"}]'
|
||||
http_version:
|
||||
recorded_at: Thu, 19 May 2016 18:19:43 GMT
|
||||
recorded_with: VCR 3.0.1
|
|
@ -0,0 +1,73 @@
|
|||
---
|
||||
http_interactions:
|
||||
- request:
|
||||
method: get
|
||||
uri: https://api.github.com/repos/skywinder/changelog_test/tags
|
||||
body:
|
||||
encoding: US-ASCII
|
||||
string: ''
|
||||
headers:
|
||||
Accept:
|
||||
- application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1
|
||||
Accept-Charset:
|
||||
- utf-8
|
||||
User-Agent:
|
||||
- Github API Ruby Gem 0.13.1
|
||||
response:
|
||||
status:
|
||||
code: 200
|
||||
message:
|
||||
headers:
|
||||
server:
|
||||
- GitHub.com
|
||||
date:
|
||||
- Thu, 19 May 2016 18:14:27 GMT
|
||||
content-type:
|
||||
- application/json; charset=utf-8
|
||||
transfer-encoding:
|
||||
- chunked
|
||||
connection:
|
||||
- close
|
||||
status:
|
||||
- 200 OK
|
||||
x-ratelimit-limit:
|
||||
- '60'
|
||||
x-ratelimit-remaining:
|
||||
- '49'
|
||||
x-ratelimit-reset:
|
||||
- '1463684440'
|
||||
cache-control:
|
||||
- public, max-age=60, s-maxage=60
|
||||
vary:
|
||||
- Accept, Accept-Encoding
|
||||
etag:
|
||||
- W/"012a78339961d33825609e388f651a3e"
|
||||
last-modified:
|
||||
- Thu, 05 Mar 2015 10:27:55 GMT
|
||||
x-github-media-type:
|
||||
- github.v3; format=json
|
||||
access-control-expose-headers:
|
||||
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
||||
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
||||
access-control-allow-origin:
|
||||
- "*"
|
||||
content-security-policy:
|
||||
- default-src 'none'
|
||||
strict-transport-security:
|
||||
- max-age=31536000; includeSubdomains; preload
|
||||
x-content-type-options:
|
||||
- nosniff
|
||||
x-frame-options:
|
||||
- deny
|
||||
x-xss-protection:
|
||||
- 1; mode=block
|
||||
x-served-by:
|
||||
- a7f8a126c9ed3f1c4715a34c0ddc7290
|
||||
x-github-request-id:
|
||||
- 6C2F0F69:1C0C4:91D639E:573E0283
|
||||
body:
|
||||
encoding: ASCII-8BIT
|
||||
string: '[{"name":"v0.0.3","zipball_url":"https://api.github.com/repos/skywinder/changelog_test/zipball/v0.0.3","tarball_url":"https://api.github.com/repos/skywinder/changelog_test/tarball/v0.0.3","commit":{"sha":"a0cba2b1a1ea9011ab07ee1ac140ba5a5eb8bd90","url":"https://api.github.com/repos/skywinder/changelog_test/commits/a0cba2b1a1ea9011ab07ee1ac140ba5a5eb8bd90"}},{"name":"v0.0.2","zipball_url":"https://api.github.com/repos/skywinder/changelog_test/zipball/v0.0.2","tarball_url":"https://api.github.com/repos/skywinder/changelog_test/tarball/v0.0.2","commit":{"sha":"9b35bb13dcd15b68e7bcbf10cde5eb937a54f710","url":"https://api.github.com/repos/skywinder/changelog_test/commits/9b35bb13dcd15b68e7bcbf10cde5eb937a54f710"}},{"name":"v0.0.1","zipball_url":"https://api.github.com/repos/skywinder/changelog_test/zipball/v0.0.1","tarball_url":"https://api.github.com/repos/skywinder/changelog_test/tarball/v0.0.1","commit":{"sha":"4c2d6d1ed58bdb24b870dcb5d9f2ceed0283d69d","url":"https://api.github.com/repos/skywinder/changelog_test/commits/4c2d6d1ed58bdb24b870dcb5d9f2ceed0283d69d"}},{"name":"0.0.4","zipball_url":"https://api.github.com/repos/skywinder/changelog_test/zipball/0.0.4","tarball_url":"https://api.github.com/repos/skywinder/changelog_test/tarball/0.0.4","commit":{"sha":"ece0c3ab7142b21064b885061c55ede00ef6ce94","url":"https://api.github.com/repos/skywinder/changelog_test/commits/ece0c3ab7142b21064b885061c55ede00ef6ce94"}}]'
|
||||
http_version:
|
||||
recorded_at: Thu, 19 May 2016 18:14:31 GMT
|
||||
recorded_with: VCR 3.0.1
|
|
@ -0,0 +1,65 @@
|
|||
---
|
||||
http_interactions:
|
||||
- request:
|
||||
method: get
|
||||
uri: https://api.github.com/repos/skywinder/changelog_test/tags?access_token=0000000000000000
|
||||
body:
|
||||
encoding: US-ASCII
|
||||
string: ''
|
||||
headers:
|
||||
Accept:
|
||||
- application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1
|
||||
Accept-Charset:
|
||||
- utf-8
|
||||
User-Agent:
|
||||
- Github API Ruby Gem 0.13.1
|
||||
Authorization:
|
||||
- token 0000000000000000
|
||||
response:
|
||||
status:
|
||||
code: 401
|
||||
message:
|
||||
headers:
|
||||
server:
|
||||
- GitHub.com
|
||||
date:
|
||||
- Thu, 19 May 2016 18:14:28 GMT
|
||||
content-type:
|
||||
- application/json; charset=utf-8
|
||||
content-length:
|
||||
- '83'
|
||||
connection:
|
||||
- close
|
||||
status:
|
||||
- 401 Unauthorized
|
||||
x-github-media-type:
|
||||
- github.v3; format=json
|
||||
x-ratelimit-limit:
|
||||
- '60'
|
||||
x-ratelimit-remaining:
|
||||
- '48'
|
||||
x-ratelimit-reset:
|
||||
- '1463684440'
|
||||
access-control-expose-headers:
|
||||
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
||||
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
||||
access-control-allow-origin:
|
||||
- "*"
|
||||
content-security-policy:
|
||||
- default-src 'none'
|
||||
strict-transport-security:
|
||||
- max-age=31536000; includeSubdomains; preload
|
||||
x-content-type-options:
|
||||
- nosniff
|
||||
x-frame-options:
|
||||
- deny
|
||||
x-xss-protection:
|
||||
- 1; mode=block
|
||||
x-github-request-id:
|
||||
- 6C2F0F69:1C0C3:706D8F5:573E0284
|
||||
body:
|
||||
encoding: UTF-8
|
||||
string: '{"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}'
|
||||
http_version:
|
||||
recorded_at: Thu, 19 May 2016 18:14:31 GMT
|
||||
recorded_with: VCR 3.0.1
|
Loading…
Reference in New Issue
Block a user