Skip to content

Commit

Permalink
test: add simple test for story.pull_requests
Browse files Browse the repository at this point in the history
  • Loading branch information
irphilli committed Apr 23, 2021
1 parent 68074e7 commit 1337312
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/story_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -319,4 +319,16 @@
end
end
end

describe '.pull_requests' do
it 'gets all pull requests for the story' do
pull_requests = VCR.use_cassette('get story with pull requests', record: :new_episodes) do
project.story(story_id, fields: ':default,pull_requests').pull_requests
end

_(pull_requests).wont_be_empty
pull_request = pull_requests.first
_(pull_request).must_be_instance_of TrackerApi::Resources::PullRequest
end
end
end
1 change: 1 addition & 0 deletions test/vcr/cassettes/get_story_with_pull_requests.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"http_interactions":[{"request":{"method":"get","uri":"https://www.pivotaltracker.com/services/v5/projects/1027488/stories/66728004?fields=%3Adefault%2Cpull_requests","body":{"encoding":"US-ASCII","string":""},"headers":{"User-Agent":["Ruby/2.7.2 (x86_64-darwin19; ruby) TrackerApi/1.13.0 Faraday/1.4.1"],"X-TrackerToken":["d55c3bc1f74346b843ca84ba340b29bf"],"Accept":["application/json"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Content-Type":["application/json; charset=utf-8"],"Status":["200 OK"],"Cache-Control":["max-age=0, private, must-revalidate"],"X-Tracker-Project-Version":["728"],"X-Request-Id":["e17a5715-671b-487e-b1c2-561cc87c09bd"],"ETag":["W/\"d8502383608d12d511d24d83e41e7948\""],"X-Frame-Options":["SAMEORIGIN"],"X-Runtime":["0.066465"],"X-Content-Type-Options":["nosniff, nosniff"],"Date":["Fri, 23 Apr 2021 21:44:02 GMT"],"X-Powered-By":["Phusion Passenger"],"Server":["nginx + Phusion Passenger"],"Access-Control-Allow-Origin":["*"],"Access-Control-Allow-Credentials":["false"],"Access-Control-Allow-Methods":["GET, POST, PUT, DELETE, OPTIONS"],"Access-Control-Allow-Headers":["X-TrackerToken,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Tracker-Warn-Unless-Project-Version-Is"],"X-Tracker-Client-Pinger-Interval":["20"],"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],"X-XSS-Protection":["1; mode=block"],"Via":["1.1 google"],"Alt-Svc":["clear"]},"body":{"encoding":"ASCII-8BIT","string":"{\"kind\":\"story\",\"id\":66728004,\"created_at\":\"2014-02-17T00:00:00Z\",\"updated_at\":\"2021-04-23T21:23:18Z\",\"story_type\":\"bug\",\"name\":\"Some product photos not scaled properly when browsing products+++++++++++++++++++++++++++\",\"description\":\"++++++++++++++++\",\"current_state\":\"started\",\"requested_by_id\":1266314,\"url\":\"https://www.pivotaltracker.com/story/show/66728004\",\"project_id\":1027488,\"owner_ids\":[1266314,1266316],\"labels\":[{\"id\":11049870,\"project_id\":1027488,\"kind\":\"label\",\"name\":\"label2\",\"created_at\":\"2015-03-07T12:51:39Z\",\"updated_at\":\"2015-03-07T12:51:39Z\"},{\"id\":14060665,\"project_id\":1027488,\"kind\":\"label\",\"name\":\"super-special-label\",\"created_at\":\"2016-02-12T23:45:13Z\",\"updated_at\":\"2016-02-12T23:45:13Z\"}],\"pull_requests\":[{\"id\":1606521,\"kind\":\"pull_request\",\"story_id\":66728004,\"owner\":\"ProductPlan\",\"repo\":\"tracker_api\",\"host_url\":\"https://github.com/\",\"original_url\":\"https://github.com/ProductPlan/tracker_api/pull/148\",\"status\":\"unknown\",\"number\":148,\"created_at\":\"2021-04-23T21:23:18Z\",\"updated_at\":\"2021-04-23T21:23:18Z\"}],\"owned_by_id\":1266314}"}},"recorded_at":"Fri, 23 Apr 2021 21:44:02 GMT"}],"recorded_with":"VCR 6.0.0"}

0 comments on commit 1337312

Please sign in to comment.