Skip to content

Commit

Permalink
Added new versions of partner and metadata WSDL files (version 56.0).…
Browse files Browse the repository at this point in the history
… Also, fixes a number of unit test failures caused by upgrades of Ruby, rspec, rubyzip, etc. Still some test failures (9 out of 85 fail) that need more investigation to resolve.
  • Loading branch information
tfuda committed Dec 1, 2022
1 parent 2de406a commit cb74383
Show file tree
Hide file tree
Showing 15 changed files with 29,332 additions and 32 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ deploy.zip
retrieve.zip
test.rb
.metaforce.yml
Vagrantfile
.vagrant
.idea
1 change: 1 addition & 0 deletions lib/metaforce.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'savon'
require 'hashie'
require 'active_support'
require 'active_support/core_ext'

require 'metaforce/version'
Expand Down
2 changes: 1 addition & 1 deletion lib/metaforce/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def initialize
end

def api_version
@api_version ||= '26.0'
@api_version ||= '56.0'
end

def host
Expand Down
1 change: 1 addition & 0 deletions lib/metaforce/manifest.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'nokogiri'
require 'active_support'
require 'active_support/core_ext'

module Metaforce
Expand Down
11 changes: 6 additions & 5 deletions metaforce.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ EOL
s.require_paths = ['lib']

s.add_dependency 'savon', '~> 1.2.0'
s.add_dependency 'rubyzip'
s.add_dependency 'rubyzip', '~> 2.3.2'
s.add_dependency 'activesupport'
s.add_dependency 'hashie'
s.add_dependency 'thor'
s.add_dependency 'listen'
s.add_dependency 'rb-fsevent'
s.add_dependency 'hashie', '~> 5.0.0'
s.add_dependency 'thor', '~> 1.2.1'
s.add_dependency 'listen', '~> 3.7.1'
s.add_dependency 'rb-fsevent', '~> 0.11.2'

s.add_development_dependency 'rake'
s.add_development_dependency 'rspec'
s.add_development_dependency 'rspec-its'
s.add_development_dependency 'webmock'
s.add_development_dependency 'savon_spec'
end
2 changes: 1 addition & 1 deletion spec/fixtures/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
<members>Assets</members>
<name>StaticResource</name>
</types>
<version>26.0</version>
<version>56.0</version>
</Package>
8 changes: 4 additions & 4 deletions spec/lib/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
describe Metaforce do
describe '.configuration' do
subject { Metaforce.configuration }
it { should set_default(:api_version).to('26.0') }
it { should set_default(:api_version).to('56.0') }
it { should set_default(:host).to('login.salesforce.com') }
it { should set_default(:endpoint).to('https://login.salesforce.com/services/Soap/u/26.0') }
it { should set_default(:partner_wsdl).to(File.expand_path('../../../wsdl/26.0/partner.xml', __FILE__)) }
it { should set_default(:metadata_wsdl).to(File.expand_path('../../../wsdl/26.0/metadata.xml', __FILE__)) }
it { should set_default(:endpoint).to('https://login.salesforce.com/services/Soap/u/56.0') }
it { should set_default(:partner_wsdl).to(File.expand_path('../../../wsdl/56.0/partner.xml', __FILE__)) }
it { should set_default(:metadata_wsdl).to(File.expand_path('../../../wsdl/56.0/metadata.xml', __FILE__)) }
end
end
6 changes: 3 additions & 3 deletions spec/lib/job/deploy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
context 'when the path is a file' do
before do
client.should_receive(:_deploy).with(/^UEsDBA.*/, {}).and_return(Hashie::Mash.new(id: '1234'))
client.should_receive(:status).any_number_of_times.and_return(Hashie::Mash.new(done: true, state: 'Completed'))
client.should_receive(:status).at_least(1).times.and_return(Hashie::Mash.new(done: true, state: 'Completed'))
end

it { should eq job }
Expand All @@ -21,7 +21,7 @@
context 'when the path is a directory' do
before do
client.should_receive(:_deploy).with(/.*1stwAAAJI.*/, {}).and_return(Hashie::Mash.new(id: '1234'))
client.should_receive(:status).any_number_of_times.and_return(Hashie::Mash.new(done: true, state: 'Completed'))
client.should_receive(:status).at_least(1).times.and_return(Hashie::Mash.new(done: true, state: 'Completed'))
end

let(:path) { File.expand_path('../../../fixtures', __FILE__) }
Expand Down Expand Up @@ -49,6 +49,6 @@
end

subject { job.success? }
it { should be_true }
it { should be true }
end
end
2 changes: 1 addition & 1 deletion spec/lib/job/retrieve_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
end

subject { job.zip_file.bytes }
it { should eq [126, 138, 27] }
it { should eq [126, 138, 27, 106] }
end
end
20 changes: 10 additions & 10 deletions spec/lib/job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,33 @@
job.instance_variable_set(:@id, '1234')
end

it { should be_true }
it { should be true }
end

context 'when .perform has not been called and no @id has been set' do
it { should be_false }
it { should be false }
end
end

describe '.on_complete' do
it 'allows the user to register an on_complete callback' do
client.should_receive(:status).any_number_of_times.and_return(Hashie::Mash.new(done: true, state: 'Completed'))
client.should_receive(:status).at_least(1).times.and_return(Hashie::Mash.new(done: true, state: 'Completed'))
called = false
block = lambda { |job| called = true }
job.on_complete &block
job.perform
expect(called).to be_true
expect(called).to be true
end
end

describe '.on_error' do
it 'allows the user to register an on_error callback' do
client.should_receive(:status).any_number_of_times.and_return(Hashie::Mash.new(done: true, state: 'Error'))
client.should_receive(:status).at_least(1).times.and_return(Hashie::Mash.new(done: true, state: 'Error'))
called = false
block = lambda { |job| called = true }
job.on_error &block
job.perform
expect(called).to be_true
expect(called).to be true
end
end

Expand All @@ -66,15 +66,15 @@
client.should_receive(:status).and_return(Hashie::Mash.new(done: true))
end

it { should be_true }
it { should be true }
end

context 'when not done' do
before do
client.should_receive(:status).and_return(Hashie::Mash.new(done: false))
end

it { should be_false }
it { should be false }
end
end

Expand All @@ -94,7 +94,7 @@
client.should_receive(:status).once.and_return(Hashie::Mash.new(done: false))
end

it { should be_false }
it { should be nil }
end
end

Expand All @@ -105,7 +105,7 @@
end

subject { job.send(:"#{state.underscore}?") }
it { should be_true }
it { should be true }
end
end
end
8 changes: 4 additions & 4 deletions spec/lib/reporters/base_reporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,25 @@
subject { reporter.problems? }

context 'when there are no problems' do
it { should be_false }
it { should be false }
end

context 'when there are problems' do
let(:results) { Hashie::Mash.new(success: true, messages: { problem: 'Problem', file_name: 'path/file', line_number: '10' }) }
it { should be_true }
it { should be true }
end
end

describe '.issues?' do
subject { reporter.issues? }

context 'when there are no problems' do
it { should be_false }
it { should be false }
end

context 'when there are problems' do
let(:results) { Hashie::Mash.new(success: true, messages: { problem: 'Problem', file_name: 'path/file', line_number: '10' }) }
it { should be_true }
it { should be true }
end
end
end
5 changes: 2 additions & 3 deletions spec/lib/reporters/deploy_reporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
it 'prints the failure' do
reporter.should_receive(:say).with(' stack trace:', :red)
reporter.should_receive(:say).with(' message')
reporter.should_receive(:say).with
reporter.failed(failure)
end
end
Expand Down Expand Up @@ -113,12 +112,12 @@

context 'when there are failures' do
let(:num_failures) { '5' }
it { should be_true }
it { should be true }
end

context 'when there are no failures' do
let(:num_failures) { '0' }
it { should be_false }
it { should be false }
end
end
end
8 changes: 8 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@
end

Savon::Spec::Fixture.path = File.join(File.dirname(__FILE__), 'fixtures/requests')

# Monkey patch the old URI.escape method that was removed in Ruby 3.
# It is called by the old version of wasabi that is required to metaforce.
module URI
def URI.escape(url)
CGI.escape(url)
end
end
Loading

0 comments on commit cb74383

Please sign in to comment.