spec/distribute_spec.rb in xcjobs-0.0.4 vs spec/distribute_spec.rb in xcjobs-0.0.5

- old
+ new

@@ -21,11 +21,11 @@ describe XCJobs::Distribute::TestFlight do describe 'define upload ipa task' do let(:credentials) do { api_token: 'abcde12345efghi67890d543957972cd_MTE3NjUyMjBxMS0wOE0wNiAwMzwzMjoyNy41MTA3MzE', - team_token:'12345ab2692bd1c3093408a3399ee947_NDIzMDYyPDExLGExLTIwIDIxOjM9OjS2LjQxOTgzOA', + team_token: '12345ab2692bd1c3093408a3399ee947_NDIzMDYyPDExLGExLTIwIDIxOjM9OjS2LjQxOTgzOA', } end let(:file) do File.join('build', 'Example.ipa') @@ -34,12 +34,12 @@ let(:notes) { "Uploaded: #{DateTime.now.strftime("%Y/%m/%d %H:%M:%S")}" } let!(:task) do XCJobs::Distribute::TestFlight.new do |t| t.file = file - t.api_token = credentials['api_token'] - t.team_token = credentials['team_token'] + t.api_token = credentials[:api_token] + t.team_token = credentials[:team_token] t.notify = true t.replace = true t.distribution_lists = 'Dev' t.notes = notes end @@ -48,15 +48,15 @@ it 'configures the ipa file path' do expect(task.file).to eq file end it 'configures the api_token' do - expect(task.api_token).to eq credentials['api_token'] + expect(task.api_token).to eq credentials[:api_token] end it 'configures the team_token' do - expect(task.team_token).to eq credentials['team_token'] + expect(task.team_token).to eq credentials[:team_token] end it 'configures the notify' do expect(task.notify).to eq true end @@ -80,10 +80,12 @@ it 'executes the appropriate commands' do subject.invoke expect(@url).to eq 'http://testflightapp.com/api/builds.json' expect(@form_data).to eq({ file: "@#{file}", + api_token: credentials[:api_token], + team_token: credentials[:team_token], notify: true, replace: true, distribution_lists: 'Dev', notes: notes, }) @@ -91,36 +93,116 @@ end end end end + describe XCJobs::Distribute::DeployGate do + describe 'define upload ipa task' do + let(:owner_name) { 'kishikawakatsumi' } + + let(:credentials) do + { token: 'abcde12345efghi67890abcde12345efghi67890', + distribution_key: '12345abcde67890efghi12345abcde67890efghi', + } + end + + let(:file) do + File.join('build', 'Example.ipa') + end + + let(:message) { 'New build uploaded!' } + let(:release_note) { "Uploaded: #{DateTime.now.strftime("%Y/%m/%d %H:%M:%S")}" } + + let!(:task) do + XCJobs::Distribute::DeployGate.new do |t| + t.owner_name = owner_name + t.file = file + t.token = credentials[:token] + t.distribution_key = credentials[:distribution_key] + t.message = message + t.release_note = release_note + t.disable_notify = true + t.visibility = 'public' + end + end + + it 'configures the ipa file path' do + expect(task.file).to eq file + end + + it 'configures the token' do + expect(task.token).to eq credentials[:token] + end + + it 'configures the distribution_key' do + expect(task.distribution_key).to eq credentials[:distribution_key] + end + + it 'configures the message' do + expect(task.message).to eq message + end + + it 'configures the release_note' do + expect(task.release_note).to eq release_note + end + + it 'configures the disable_notify' do + expect(task.disable_notify).to eq true + end + + it 'configures the visibility' do + expect(task.visibility).to eq 'public' + end + + describe 'tasks' do + describe 'distribute:deploygate' do + subject { Rake.application['distribute:deploygate'] } + + it 'executes the appropriate commands' do + subject.invoke + expect(@url).to eq "https://deploygate.com/api/users/#{owner_name}/apps" + expect(@form_data).to eq({ + file: "@#{file}", + token: credentials[:token], + distribution_key: credentials[:distribution_key], + message: message, + release_note: release_note, + disable_notify: 'yes', + visibility: 'public', + }) + end + end + end + end + end + describe XCJobs::Distribute::Crittercism do describe 'define upload dSYMs task' do let(:credentials) do { app_id: '123456789abcdefg12345678', - key:'abcdefghijklmnopqrstuvwxyz123456', + key: 'abcdefghijklmnopqrstuvwxyz123456', } end let(:dsym_file) do File.join('build', 'dSYMs.zip') end let!(:task) do XCJobs::Distribute::Crittercism.new do |t| - t.app_id = credentials['app_id'] - t.key = credentials['key'] + t.app_id = credentials[:app_id] + t.key = credentials[:key] t.dsym = dsym_file end end it 'configures the app_id' do - expect(task.app_id).to eq credentials['app_id'] + expect(task.app_id).to eq credentials[:app_id] end it 'configures the key' do - expect(task.app_id).to eq credentials['key'] + expect(task.key).to eq credentials[:key] end it 'configures the dsym file path' do expect(task.dsym).to eq dsym_file end @@ -129,23 +211,26 @@ describe 'distribute:crittercism' do subject { Rake.application['distribute:crittercism'] } it 'executes the appropriate commands' do subject.invoke - expect(@url).to eq "https://api.crittercism.com/api_beta/dsym/#{credentials['app_id']}" - expect(@form_data).to eq({ dsym: "@#{dsym_file}" }) + expect(@url).to eq "https://api.crittercism.com/api_beta/dsym/#{credentials[:app_id]}" + expect(@form_data).to eq({ + dsym: "@#{dsym_file}", + key: credentials[:key], + }) end end end end end describe XCJobs::Distribute::ITC do describe 'define upload ipa task' do let(:credentials) do { username: 'kishikawakatsumi', - password:'password1234', + password: 'password1234', } end let(:file) do File.join('build', 'Example.ipa') @@ -153,22 +238,22 @@ let(:altool) { '/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool' } let!(:task) do XCJobs::Distribute::ITC.new do |t| - t.username = credentials['username'] - t.password = credentials['password'] + t.username = credentials[:username] + t.password = credentials[:password] t.file = file end end it 'configures the username' do - expect(task.username).to eq credentials['username'] + expect(task.username).to eq credentials[:username] end it 'configures the password' do - expect(task.password).to eq credentials['password'] + expect(task.password).to eq credentials[:password] end it 'configures the file path' do expect(task.file).to eq file end @@ -177,10 +262,10 @@ describe 'distribute:itc' do subject { Rake.application['distribute:itc'] } it 'executes the appropriate commands' do subject.invoke - expect(@commands).to eq [%["#{altool}" --upload-app --file "#{file}" --username #{credentials['username']} --password #{credentials['password']}]] + expect(@commands).to eq [%["#{altool}" --upload-app --file "#{file}" --username #{credentials[:username]} --password #{credentials[:password]}]] end end end end end