From bc42810a53af90da5f4299dd31831272103e8079 Mon Sep 17 00:00:00 2001 From: Lennard Wolf Date: Fri, 1 Apr 2016 16:03:09 +0200 Subject: [PATCH 01/14] updated README to a functioning state. --- README.md | 75 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index bf00f730..775a209e 100644 --- a/README.md +++ b/README.md @@ -4,52 +4,67 @@ This is the app running on https://api.travis-ci.org/ ## Requirements +You will need the following packages to get travis-api to work: + 1. PostgreSQL 9.3 or higher -1. Redis -1. RabbitMQ -1. Nginx *NB: If working on Ubuntu please install Nginx manually from source. [This guide](http://www.rackspace.com/knowledge_center/article/ubuntu-and-debian-installing-nginx-from-source) is helpful but make sure you install the [latest stable version](https://www.nginx.com/resources/wiki/start/topics/tutorials/install/#stable), include the user name on your ubuntu machine when compiling (add `--user=[yourusername]` as an option when running `./configure`), and don't follow any subsequent server configuration steps. Travis-api will start and configure its own nginx server when run locally. +2. Bundler +3. Redis Server +4. *Optional:* RabbitMQ Server +5. Nginx - + *If working in Ubuntu please install nginx manually from source: Download and extract latest nginx version, open a terminal in extracted folder and then run the following:* +```sh-session + $ sudo apt-get install libpcre3 libpcre3-dev + $ auto/configure --user=$USER + $ make + $ sudo make install + $ ln -s /usr/local/nginx/sbin/nginx /bin/nginx +``` ## Installation ### Setup - - $ bundle install - +```sh-session +$ bundle install +``` ### Database setup -NB detail for how `rake` sets up the database can be found in the `Rakefile`. In the `namespace :db` block you will see the database name is configured using the environment variable RAILS_ENV. If you are using a different configuration you will have to make your own adjustments. - -1. `bundle exec rake db:create` -2. for testing 'RAILS_ENV=test bundle exec rake db:create --trace' -1. Clone `travis-logs` and copy the `logs` database (assume the PostgreSQL user is `postgres`): +*You might need to create a role first. For this you should run the following:* ```sh-session -cd .. -git clone https://github.com/travis-ci/travis-logs.git -cd travis-logs -rvm jruby do bundle exec rake db:migrate # `travis-logs` requires JRuby -psql -c "DROP TABLE IF EXISTS logs CASCADE" -U postgres travis_development -pg_dump -t logs travis_logs_development | psql -U postgres travis_development +$ sudo -u postgres psql -c "CREATE USER yourusername WITH SUPERUSER PASSWORD 'yourpassword'" ``` -Repeat the database steps for `RAILS_ENV=test`. +NB detail for how `rake` sets up the database can be found in the `Rakefile`. In the `namespace :db` block you will see the database name is configured using the environment variable RAILS_ENV. If you are using a different configuration you will have to make your own adjustments. ```sh-session -RAILS_ENV=test bundle exec rake db:create -pushd ../travis-logs -RAILS_ENV=test rvm jruby do bundle exec rake db:migrate -psql -c "DROP TABLE IF EXISTS logs CASCADE" -U postgres travis_test -pg_dump -t logs travis_logs_test | psql -U postgres travis_test -popd +$ RAILS_ENV=development bundle exec rake db:create +$ RAILS_ENV=test bundle exec rake db:create +``` +#### Optional +Clone `travis-logs` and copy the `logs` database (assume the PostgreSQL user is `postgres`): +```sh-session +$ cd .. +$ git clone https://github.com/travis-ci/travis-logs.git +$ cd travis-logs +$ rvm jruby do bundle exec rake db:migrate # `travis-logs` requires JRuby +$ psql -c "DROP TABLE IF EXISTS logs CASCADE" -U postgres travis_development +$ pg_dump -t logs travis_logs_development | psql -U postgres travis_development + +$ RAILS_ENV=test bundle exec rake db:create +$ pushd ../travis-logs +$ RAILS_ENV=test rvm jruby do bundle exec rake db:migrate +$ psql -c "DROP TABLE IF EXISTS logs CASCADE" -U postgres travis_test +$ pg_dump -t logs travis_logs_test | psql -U postgres travis_test +$ popd ``` ### Run tests - - $ rake spec - +```sh-session +$ bundle exec rspec +``` ### Run the server - - $ bundle exec script/server - +```sh-session +$ bundle exec script/server +``` ## Contributing 1. Fork it From c49819ca5274d14d19eea3c97b152faa717b66ee Mon Sep 17 00:00:00 2001 From: Steffen Date: Fri, 1 Apr 2016 16:22:29 +0200 Subject: [PATCH 02/14] add missing sudo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 775a209e..890a583d 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ You will need the following packages to get travis-api to work: $ auto/configure --user=$USER $ make $ sudo make install - $ ln -s /usr/local/nginx/sbin/nginx /bin/nginx + $ sudo ln -s /usr/local/nginx/sbin/nginx /bin/nginx ``` ## Installation From 407d2abea152c769f37589156fe3c57dd95418bb Mon Sep 17 00:00:00 2001 From: Ana Rosas Date: Tue, 5 Apr 2016 15:27:11 +0200 Subject: [PATCH 03/14] Use Travis.config to retrieve default values for api_builds_rate_limit --- lib/travis/api/v3/services/requests/create.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/travis/api/v3/services/requests/create.rb b/lib/travis/api/v3/services/requests/create.rb index 1d4d0978..5eee314f 100644 --- a/lib/travis/api/v3/services/requests/create.rb +++ b/lib/travis/api/v3/services/requests/create.rb @@ -1,8 +1,7 @@ module Travis::API::V3 class Services::Requests::Create < Service TIME_FRAME = 1.hour - LIMIT = 10 - private_constant :TIME_FRAME, :LIMIT + private_constant :TIME_FRAME result_type :request params "request", "user", :config, :message, :branch, :token @@ -24,9 +23,9 @@ module Travis::API::V3 def limit(repository) if repository.settings.nil? - LIMIT + Travis.config.requests_create_api_limit else - repository.settings["api_builds_rate_limit"] || Travis.config.requests_create_api_limit || LIMIT + repository.settings["api_builds_rate_limit"] || Travis.config.requests_create_api_limit end end From 679bbd79017ff4e10b8947c834d7459d5ad375c1 Mon Sep 17 00:00:00 2001 From: Ana Rosas Date: Tue, 5 Apr 2016 16:27:01 +0200 Subject: [PATCH 04/14] Use LIMIT constant as a backup limit number --- Gemfile | 2 +- Gemfile.lock | 6 ++---- lib/travis/api/v3/services/requests/create.rb | 7 ++++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Gemfile b/Gemfile index da99c923..fc31b22e 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ ruby '2.1.7' if ENV.key?('DYNO') gem 's3', github: 'travis-ci/s3' -gem 'travis-core', github: 'travis-ci/travis-core' +gem 'travis-core', github: 'travis-ci/travis-core', branch: 'cd-ar-rate-limit-on-travis-config' gem 'travis-support', github: 'travis-ci/travis-support' gem 'travis-amqp', github: 'travis-ci/travis-amqp' gem 'travis-config', '~> 0.1.0' diff --git a/Gemfile.lock b/Gemfile.lock index 563536fb..d425f462 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,7 +48,8 @@ GIT GIT remote: git://github.com/travis-ci/travis-core.git - revision: 9978518236afb520c8fff68bebe7beb62f8ad776 + revision: 76ddca556f0eb9f40daa50789223db9e18174d46 + branch: cd-ar-rate-limit-on-travis-config specs: travis-core (0.0.1) actionmailer (~> 3.2.19) @@ -388,6 +389,3 @@ DEPENDENCIES travis-yaml! unicorn yard-sinatra! - -BUNDLED WITH - 1.12.0.pre.1 diff --git a/lib/travis/api/v3/services/requests/create.rb b/lib/travis/api/v3/services/requests/create.rb index 5eee314f..ea3827de 100644 --- a/lib/travis/api/v3/services/requests/create.rb +++ b/lib/travis/api/v3/services/requests/create.rb @@ -1,7 +1,8 @@ module Travis::API::V3 class Services::Requests::Create < Service TIME_FRAME = 1.hour - private_constant :TIME_FRAME + LIMIT = 10 + private_constant :TIME_FRAME, :LIMIT result_type :request params "request", "user", :config, :message, :branch, :token @@ -23,9 +24,9 @@ module Travis::API::V3 def limit(repository) if repository.settings.nil? - Travis.config.requests_create_api_limit + Travis.config.requests_create_api_limit || LIMIT else - repository.settings["api_builds_rate_limit"] || Travis.config.requests_create_api_limit + repository.settings["api_builds_rate_limit"] || Travis.config.requests_create_api_limit || LIMIT end end From 11ceaed333042d65872b31f877f9169aa36594ff Mon Sep 17 00:00:00 2001 From: Ana Rosas Date: Tue, 5 Apr 2016 16:47:33 +0200 Subject: [PATCH 05/14] Test default limit --- lib/travis/api/v3/services/requests/create.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/travis/api/v3/services/requests/create.rb b/lib/travis/api/v3/services/requests/create.rb index ea3827de..372b299e 100644 --- a/lib/travis/api/v3/services/requests/create.rb +++ b/lib/travis/api/v3/services/requests/create.rb @@ -24,9 +24,9 @@ module Travis::API::V3 def limit(repository) if repository.settings.nil? - Travis.config.requests_create_api_limit || LIMIT + Travis.config.requests_create_api_limit || 50 else - repository.settings["api_builds_rate_limit"] || Travis.config.requests_create_api_limit || LIMIT + repository.settings["api_builds_rate_limit"] || Travis.config.requests_create_api_limit || 50 end end From 228b594237368d7f4f901f9f44e3dba95ce0db40 Mon Sep 17 00:00:00 2001 From: Ana Rosas Date: Tue, 5 Apr 2016 17:09:48 +0200 Subject: [PATCH 06/14] Return LIMIT if everything else fails --- lib/travis/api/v3/services/requests/create.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/travis/api/v3/services/requests/create.rb b/lib/travis/api/v3/services/requests/create.rb index 372b299e..ea3827de 100644 --- a/lib/travis/api/v3/services/requests/create.rb +++ b/lib/travis/api/v3/services/requests/create.rb @@ -24,9 +24,9 @@ module Travis::API::V3 def limit(repository) if repository.settings.nil? - Travis.config.requests_create_api_limit || 50 + Travis.config.requests_create_api_limit || LIMIT else - repository.settings["api_builds_rate_limit"] || Travis.config.requests_create_api_limit || 50 + repository.settings["api_builds_rate_limit"] || Travis.config.requests_create_api_limit || LIMIT end end From 03e992885ea15acd3df358cfc9c10fe94e373468 Mon Sep 17 00:00:00 2001 From: Ana Rosas Date: Tue, 5 Apr 2016 17:28:00 +0200 Subject: [PATCH 07/14] Bump travis-core --- Gemfile | 2 +- Gemfile.lock | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index fc31b22e..da99c923 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ ruby '2.1.7' if ENV.key?('DYNO') gem 's3', github: 'travis-ci/s3' -gem 'travis-core', github: 'travis-ci/travis-core', branch: 'cd-ar-rate-limit-on-travis-config' +gem 'travis-core', github: 'travis-ci/travis-core' gem 'travis-support', github: 'travis-ci/travis-support' gem 'travis-amqp', github: 'travis-ci/travis-amqp' gem 'travis-config', '~> 0.1.0' diff --git a/Gemfile.lock b/Gemfile.lock index d425f462..0a19a797 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,8 +48,7 @@ GIT GIT remote: git://github.com/travis-ci/travis-core.git - revision: 76ddca556f0eb9f40daa50789223db9e18174d46 - branch: cd-ar-rate-limit-on-travis-config + revision: e5740f49f18f826a2d4a246647e5e7f1a26494eb specs: travis-core (0.0.1) actionmailer (~> 3.2.19) From 1f0d26a01c91626b21214f79ac6091e125272966 Mon Sep 17 00:00:00 2001 From: Hiro Asari Date: Tue, 5 Apr 2016 08:27:34 -1000 Subject: [PATCH 08/14] Update travis-core In particular, to include https://github.com/travis-ci/travis-core/pull/530 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0a19a797..04ae6146 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,7 +48,7 @@ GIT GIT remote: git://github.com/travis-ci/travis-core.git - revision: e5740f49f18f826a2d4a246647e5e7f1a26494eb + revision: 3a68fc4955cd5efb361ba283d49c6779edc7d4a3 specs: travis-core (0.0.1) actionmailer (~> 3.2.19) From 482f037438e2adfea89d7dffb1480b592d1c4df1 Mon Sep 17 00:00:00 2001 From: carlad Date: Wed, 6 Apr 2016 15:03:12 +0200 Subject: [PATCH 09/14] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5ed8b817..2dfb69bf 100644 --- a/README.md +++ b/README.md @@ -43,11 +43,13 @@ popd ### Run tests - $ rake spec + $ bundle exec spec ### Run the server $ bundle exec script/server + + If you have problems with Nginx because the websocket is already in use, try restarting your computer. ## Contributing From dc4d6f0208e1202dd696cddf34f361873cc5df84 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Thu, 7 Apr 2016 11:40:44 +0200 Subject: [PATCH 10/14] Bump travis-core --- Gemfile.lock | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 04ae6146..eb285248 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,7 +48,7 @@ GIT GIT remote: git://github.com/travis-ci/travis-core.git - revision: 3a68fc4955cd5efb361ba283d49c6779edc7d4a3 + revision: b559376003609cd8e13ff619d61844cae876912f specs: travis-core (0.0.1) actionmailer (~> 3.2.19) @@ -388,3 +388,6 @@ DEPENDENCIES travis-yaml! unicorn yard-sinatra! + +BUNDLED WITH + 1.11.2 From efe26b03a1d8141ab32ee551d80a57f9aa898996 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Thu, 7 Apr 2016 11:43:46 +0200 Subject: [PATCH 11/14] Bump travis-core --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index eb285248..f7765800 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,7 +48,7 @@ GIT GIT remote: git://github.com/travis-ci/travis-core.git - revision: b559376003609cd8e13ff619d61844cae876912f + revision: a66c345d44fd9c28884d694acfff3b1a0fbc5232 specs: travis-core (0.0.1) actionmailer (~> 3.2.19) From 1b9b422753dbc3df29d16b594840cb1ddd72dd8b Mon Sep 17 00:00:00 2001 From: Steffen Date: Fri, 8 Apr 2016 09:55:32 +0200 Subject: [PATCH 12/14] remove text from code block --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 56e8af0c..4388b241 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ $ bundle exec rspec ```sh-session $ bundle exec script/server ``` - If you have problems with Nginx because the websocket is already in use, try restarting your computer. +If you have problems with Nginx because the websocket is already in use, try restarting your computer. ## Contributing From 93bc69dc9df5b7515440d4b935ac06d8491c1209 Mon Sep 17 00:00:00 2001 From: Hiro Asari Date: Thu, 14 Apr 2016 08:11:57 -1000 Subject: [PATCH 13/14] Update travis-core and thor In particular, include https://github.com/travis-ci/travis-core/pull/538 to fetch GCS caches --- Gemfile.lock | 45 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index f7765800..3bd6b288 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,7 +48,7 @@ GIT GIT remote: git://github.com/travis-ci/travis-core.git - revision: a66c345d44fd9c28884d694acfff3b1a0fbc5232 + revision: f1d4c3246ea7a5434076fdc7026aa11a2c90bdac specs: travis-core (0.0.1) actionmailer (~> 3.2.19) @@ -56,6 +56,7 @@ GIT coder (~> 0.4.0) data_migrations (~> 0.0.1) gh + google-api-client (~> 0.9.4) hashr metriks (~> 0.9.7) multi_json @@ -66,7 +67,7 @@ GIT rollout (~> 1.1.0) s3 (~> 0.3) simple_states (~> 1.0.0) - thor (~> 0.14.6) + thor travis-config (~> 0.1.0) virtus (~> 1.0.0) @@ -191,6 +192,24 @@ GEM multi_json (~> 1.0) net-http-persistent (>= 2.7) net-http-pipeline + google-api-client (0.9.4) + addressable (~> 2.3) + googleauth (~> 0.5) + httpclient (~> 2.7) + hurley (~> 0.1) + memoist (~> 0.11) + mime-types (>= 1.6) + representable (~> 2.3.0) + retriable (~> 2.0) + thor (~> 0.19) + googleauth (0.5.1) + faraday (~> 0.9) + jwt (~> 1.4) + logging (~> 2.0) + memoist (~> 0.12) + multi_json (~> 1.11) + os (~> 0.9) + signet (~> 0.7) hashr (0.0.22) hike (1.2.3) hitimes (1.2.3) @@ -198,20 +217,27 @@ GEM multi_json (~> 1.0) multi_xml (>= 0.5.2) httpclient (2.7.1) + hurley (0.2) i18n (0.7.0) ice_nine (0.11.2) jemalloc (1.0.1) journey (1.0.4) json (1.8.3) + jwt (1.5.4) kgio (2.9.2) listen (1.0.3) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) rb-kqueue (>= 0.2) + little-plugger (1.1.4) + logging (2.1.0) + little-plugger (~> 1.1) + multi_json (~> 1.10) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) memcachier (0.0.2) + memoist (0.14.0) metaclass (0.0.4) method_source (0.8.2) metriks (0.9.9.6) @@ -229,6 +255,7 @@ GEM multipart-post (2.0.0) net-http-persistent (2.9.4) net-http-pipeline (1.0.1) + os (0.9.6) pg (0.18.2) polyglot (0.3.5) proxies (0.2.1) @@ -270,8 +297,11 @@ GEM redis (3.2.2) redis-namespace (1.5.1) redis (~> 3.0, >= 3.0.4) + representable (2.3.0) + uber (~> 0.0.7) rerun (0.8.2) listen (~> 1.0.3) + retriable (2.1.0) rollout (1.1.0) rspec (2.99.0) rspec-core (~> 2.99.0) @@ -292,6 +322,11 @@ GEM json redis (>= 3.0.6) redis-namespace (>= 1.3.1) + signet (0.7.2) + addressable (~> 2.3) + faraday (~> 0.9) + jwt (~> 1.5) + multi_json (~> 1.10) simple_states (1.0.1) activesupport hashr (~> 0.0.10) @@ -320,7 +355,7 @@ GEM rack (~> 1.0) tilt (~> 1.1, != 1.3.0) stackprof (0.2.7) - thor (0.14.6) + thor (0.19.1) thread_safe (0.3.5) tilt (1.4.1) timers (4.0.1) @@ -332,6 +367,7 @@ GEM polyglot polyglot (>= 0.3.1) tzinfo (0.3.48) + uber (0.0.15) unicorn (4.8.3) kgio (~> 2.6) rack @@ -388,6 +424,3 @@ DEPENDENCIES travis-yaml! unicorn yard-sinatra! - -BUNDLED WITH - 1.11.2 From 00aaf32b1e6d15fcab21582300c64760a01769da Mon Sep 17 00:00:00 2001 From: carlad Date: Fri, 15 Apr 2016 17:22:41 +0200 Subject: [PATCH 14/14] add branch_name for request --- lib/travis/api/v3/models/request.rb | 10 +++++ lib/travis/api/v3/renderer/request.rb | 2 +- spec/v3/services/requests/find_spec.rb | 60 ++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 spec/v3/services/requests/find_spec.rb diff --git a/lib/travis/api/v3/models/request.rb b/lib/travis/api/v3/models/request.rb index fd1387a8..1baec65c 100644 --- a/lib/travis/api/v3/models/request.rb +++ b/lib/travis/api/v3/models/request.rb @@ -1,10 +1,20 @@ module Travis::API::V3 class Models::Request < Model + BRANCH_REF = %r{refs/heads/(.*?)$} + belongs_to :commit belongs_to :repository belongs_to :owner, polymorphic: true has_many :builds serialize :config serialize :payload + + def branch_name + ref =~ BRANCH_REF and $1 + end + + def ref + payload['ref'] if payload + end end end diff --git a/lib/travis/api/v3/renderer/request.rb b/lib/travis/api/v3/renderer/request.rb index 356a74fe..112315fc 100644 --- a/lib/travis/api/v3/renderer/request.rb +++ b/lib/travis/api/v3/renderer/request.rb @@ -3,6 +3,6 @@ require 'travis/api/v3/renderer/model_renderer' module Travis::API::V3 class Renderer::Request < Renderer::ModelRenderer representation(:minimal, :id) - representation(:standard, :id, :repository, :commit, :owner, :created_at, :result, :message, :event_type) + representation(:standard, :id, :repository, :branch_name, :commit, :owner, :created_at, :result, :message, :event_type) end end diff --git a/spec/v3/services/requests/find_spec.rb b/spec/v3/services/requests/find_spec.rb new file mode 100644 index 00000000..f6a8bd7c --- /dev/null +++ b/spec/v3/services/requests/find_spec.rb @@ -0,0 +1,60 @@ +require 'spec_helper' + +describe Travis::API::V3::Services::Requests::Find do + let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } + let(:request) { repo.requests.first } + + describe "fetching requests on a public repository" do + before { get("/v3/repo/#{repo.id}/requests") } + example { expect(last_response).to be_ok } + example { expect(JSON.load(body).to_s).to include( + "@type", + "requests", + "/v3/repo/#{repo.id}/requests", + "repository", + "commit", + "message", + "the commit message", + "branch_name", + "representation", + "@pagination", + "owner", + "created_at", + "result", + "sha", + "svenfuchs/minimal", + "event_type", + "push") + } + end + + describe "fetching requests on private repository, private API, authenticated as user with access" do + let(:token) { Travis::Api::App::AccessToken.create(user: repo.owner, app_id: 1) } + let(:headers) {{ 'HTTP_AUTHORIZATION' => "token #{token}" }} + before { Travis::API::V3::Models::Permission.create(repository: repo, user: repo.owner, pull: true) } + before { repo.update_attribute(:private, true) } + before { get("/v3/repo/#{repo.id}/requests", {}, headers) } + after { repo.update_attribute(:private, false) } + example { expect(last_response).to be_ok } + example { expect(JSON.load(body).to_s).to include( + "@type", + "requests", + "/v3/repo/#{repo.id}/requests", + "repository", + "commit", + "message", + "the commit message", + "branch_name", + "representation", + "@pagination", + "owner", + "created_at", + "result", + "sha", + "svenfuchs/minimal", + "event_type", + "push") + } + + end +end