spec/provider/releases_spec.rb in dpl-releases-1.10.2.travis.2979.6 vs spec/provider/releases_spec.rb in dpl-releases-1.10.2.travis.2987.6

- old
+ new

@@ -28,20 +28,20 @@ end describe "#api" do example "With API key" do api = double(:api) - expect(::Octokit::Client).to receive(:new).with(:access_token => '0123445789qwertyuiop0123445789qwertyuiop', :connection_options=>{:request=>{:timeout=>180, :open_timeout=>180}}).and_return(api) + expect(::Octokit::Client).to receive(:new).with(:access_token => '0123445789qwertyuiop0123445789qwertyuiop', :auto_paginate => true, :connection_options=>{:request=>{:timeout=>180, :open_timeout=>180}}).and_return(api) expect(provider.api).to eq(api) end example "With username and password" do api = double(:api) provider.options.update(:user => 'foo') provider.options.update(:password => 'bar') - expect(::Octokit::Client).to receive(:new).with(:login => 'foo', :password => 'bar', :connection_options=>{:request=>{:timeout=>180, :open_timeout=>180}}).and_return(api) + expect(::Octokit::Client).to receive(:new).with(:login => 'foo', :password => 'bar', :auto_paginate => true, :connection_options=>{:request=>{:timeout=>180, :open_timeout=>180}}).and_return(api) expect(provider.api).to eq(api) end end describe "#releases" do @@ -167,14 +167,11 @@ allow(release).to receive(:tag_name).and_return("v0.0.0") allow(release).to receive(:rels).and_return({:self => nil}) allow(release.rels[:self]).to receive(:href) end - allow(provider.api).to receive(:release) - allow(provider.api.release).to receive(:rels).and_return({:assets => nil}) - allow(provider.api.release.rels[:assets]).to receive(:get).and_return({:data => [""]}) - allow(provider.api.release.rels[:assets].get).to receive(:data).and_return([]) + allow(provider.api).to receive(:release_assets).and_return([]) expect(provider.api).to receive(:upload_asset).with(anything, "test/foo.bar", {:name=>"foo.bar", :content_type=>"application/octet-stream"}) expect(provider.api).to receive(:upload_asset).with(anything, "bar.txt", {:name=>"bar.txt", :content_type=>"text/plain"}) expect(provider.api).to receive(:update_release).with(anything, hash_including(:draft => false)) @@ -195,14 +192,11 @@ allow(release).to receive(:tag_name).and_return("v0.0.0") allow(release).to receive(:rels).and_return({:self => nil}) allow(release.rels[:self]).to receive(:href) end - allow(provider.api).to receive(:release) - allow(provider.api.release).to receive(:rels).and_return({:assets => nil}) - allow(provider.api.release.rels[:assets]).to receive(:get).and_return({:data => [""]}) - allow(provider.api.release.rels[:assets].get).to receive(:data).and_return([double(:name => "foo.bar", :url => 'foo-bar-url'), double(:name => "foo.foo", :url => 'foo-foo-url')]) + allow(provider.api).to receive(:release_assets).and_return([double(:name => "foo.bar", :url => 'foo-bar-url'), double(:name => "foo.foo", :url => 'foo-foo-url')]) expect(provider.api).to receive(:upload_asset).with(anything, "bar.txt", {:name=>"bar.txt", :content_type=>"text/plain"}) expect(provider).to receive(:log).with("foo.bar already exists, skipping.") expect(provider.api).to receive(:update_release).with(anything, hash_including(:draft => false)) @@ -223,14 +217,11 @@ allow(release).to receive(:tag_name).and_return("v0.0.0") allow(release).to receive(:rels).and_return({:self => nil}) allow(release.rels[:self]).to receive(:href) end - allow(provider.api).to receive(:release) - allow(provider.api.release).to receive(:rels).and_return({:assets => nil}) - allow(provider.api.release.rels[:assets]).to receive(:get).and_return({:data => [""]}) - allow(provider.api.release.rels[:assets].get).to receive(:data).and_return([double(:name => "exists.txt", :url => "release-url")]) + allow(provider.api).to receive(:release_assets).and_return([double(:name => "exists.txt", :url => "release-url")]) expect(provider.api).to receive(:delete_release_asset).with("release-url").and_return(true) expect(provider.api).to receive(:upload_asset).with(anything, "exists.txt", {:name=>"exists.txt", :content_type=>"text/plain"}) expect(provider.api).to receive(:update_release).with(anything, hash_including(:draft => false)) @@ -254,14 +245,11 @@ allow(provider.api).to receive(:create_release) allow(provider.api.create_release).to receive(:rels).and_return({:self => nil}) allow(provider.api.create_release.rels[:slef]).to receive(:href) - allow(provider.api).to receive(:release) - allow(provider.api.release).to receive(:rels).and_return({:assets => nil}) - allow(provider.api.release.rels[:assets]).to receive(:get).and_return({:data => nil}) - allow(provider.api.release.rels[:assets].get).to receive(:data).and_return([]) + allow(provider.api).to receive(:release_assets).and_return([]) expect(provider.api).to receive(:upload_asset).with(anything, "test/foo.bar", {:name=>"foo.bar", :content_type=>"application/octet-stream"}) expect(provider.api).to receive(:upload_asset).with(anything, "bar.txt", {:name=>"bar.txt", :content_type=>"text/plain"}) expect(provider.api).to receive(:update_release).with(anything, hash_including(:draft => false)) @@ -275,14 +263,11 @@ provider.options.update(:release_number => "1234") allow(provider).to receive(:slug).and_return("foo/bar") expect(File).to receive(:file?).with("bar.txt").and_return(true) - allow(provider.api).to receive(:release) - allow(provider.api.release).to receive(:rels).and_return({:assets => nil}) - allow(provider.api.release.rels[:assets]).to receive(:get).and_return({:data => nil}) - allow(provider.api.release.rels[:assets].get).to receive(:data).and_return([]) + allow(provider.api).to receive(:release_assets).and_return([]) expect(provider.api).to receive(:upload_asset).with("https://api.github.com/repos/foo/bar/releases/1234", "bar.txt", {:name=>"bar.txt", :content_type=>"text/plain"}) expect(provider.api).to receive(:update_release).with(anything, hash_including(:draft => false)) provider.push_app @@ -295,14 +280,11 @@ provider.options.update(:release_number => "1234") provider.options.update(:draft => true) allow(provider).to receive(:slug).and_return("foo/bar") expect(File).to receive(:file?).with("bar.txt").and_return(true) - allow(provider.api).to receive(:release) - allow(provider.api.release).to receive(:rels).and_return({:assets => nil}) - allow(provider.api.release.rels[:assets]).to receive(:get).and_return({:data => nil}) - allow(provider.api.release.rels[:assets].get).to receive(:data).and_return([]) + allow(provider.api).to receive(:release_assets).and_return([]) expect(provider.api).to receive(:upload_asset).with("https://api.github.com/repos/foo/bar/releases/1234", "bar.txt", {:name=>"bar.txt", :content_type=>"text/plain"}) expect(provider.api).to receive(:update_release).with(anything, hash_including(:draft => true)) provider.push_app @@ -315,14 +297,11 @@ provider.options.update(:release_number => "1234") provider.options.update(:prerelease => 'true') allow(provider).to receive(:slug).and_return("foo/bar") expect(File).to receive(:file?).with("bar.txt").and_return(true) - allow(provider.api).to receive(:release) - allow(provider.api.release).to receive(:rels).and_return({:assets => nil}) - allow(provider.api.release.rels[:assets]).to receive(:get).and_return({:data => nil}) - allow(provider.api.release.rels[:assets].get).to receive(:data).and_return([]) + allow(provider.api).to receive(:release_assets).and_return([]) expect(provider.api).to receive(:upload_asset).with("https://api.github.com/repos/foo/bar/releases/1234", "bar.txt", {:name=>"bar.txt", :content_type=>"text/plain"}) expect(provider.api).to receive(:update_release).with(anything, hash_including(:prerelease => true)) provider.push_app @@ -336,13 +315,10 @@ provider.options.update(:prerelease => 'true') provider.options.update(:name => 'true') allow(provider).to receive(:slug).and_return("foo/bar") expect(File).to receive(:file?).with("bar.txt").and_return(true) - allow(provider.api).to receive(:release) - allow(provider.api.release).to receive(:rels).and_return({:assets => nil}) - allow(provider.api.release.rels[:assets]).to receive(:get).and_return({:data => nil}) - allow(provider.api.release.rels[:assets].get).to receive(:data).and_return([]) + allow(provider.api).to receive(:release_assets).and_return([]) expect(provider.api).to receive(:upload_asset).with("https://api.github.com/repos/foo/bar/releases/1234", "bar.txt", {:name=>"bar.txt", :content_type=>"text/plain"}) expect(provider.api).to receive(:update_release).with(anything, hash_including(:prerelease => true, :name => 'true')) provider.push_app