forked from fastlane/fastlane
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_spec.rb
97 lines (91 loc) · 4.51 KB
/
setup_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
require 'deliver/setup'
describe Deliver do
describe Deliver::Setup do
it "properly downloads existing metadata" do
# app = "app"
# version = "version"
# allow(Spaceship::Application).to receive(:find).and_return(app)
# expect(app).to receive(:latest_version).and_return(version)
# expect(version).to receive(:name).and_return("name")
# options = {
# app_identifier: "tools.fastlane.app",
# username: "[email protected]",
# }
# Deliver::Runner.new(options) # to login
# Deliver::Setup.new.run(options)
end
describe '#generate_metadata_files' do
context 'with review_information' do
let(:version) do
double('version',
review_first_name: 'John',
review_last_name: 'Smith',
review_phone_number: '+819012345678',
review_email: '[email protected]',
review_demo_user: 'user',
review_demo_password: 'password',
review_notes: 'This is a note')
end
let(:application) { double('application') }
let(:setup) { Deliver::Setup.new }
let(:tempdir) { Dir.mktmpdir }
before do
allow(version).to receive_message_chain('application.details').and_return(application)
allow(version).to receive_message_chain('description.languages').and_return([])
allow(version).to receive_message_chain('large_app_icon.asset_token').and_return(nil)
allow(version).to receive_message_chain('watch_app_icon.asset_token').and_return(nil)
stub_const('Deliver::UploadMetadata::NON_LOCALISED_VERSION_VALUES', [])
stub_const('Deliver::UploadMetadata::NON_LOCALISED_APP_VALUES', [])
stub_const('Deliver::UploadMetadata::TRADE_REPRESENTATIVE_CONTACT_INFORMATION_VALUES', {})
end
it 'generates review information' do
setup.generate_metadata_files(version, tempdir)
base_dir = File.join(tempdir, 'review_information')
%w(first_name last_name phone_number email_address demo_user demo_password notes).each do |filename|
expect(File.exist?(File.join(base_dir, "#{filename}.txt"))).to be_truthy
end
end
after do
FileUtils.remove_entry_secure(tempdir)
end
end
context 'with trade_representative_contact_information' do
let (:version) do
double('version',
trade_representative_trade_name: 'John Smith',
trade_representative_first_name: 'John',
trade_representative_last_name: 'Smith',
trade_representative_address_line_1: '1 Infinite Loop',
trade_representative_address_line_2: '',
trade_representative_address_line_3: '',
trade_representative_city_name: 'Cupertino',
trade_representative_state: 'California',
trade_representative_country: 'United States',
trade_representative_postal_code: '95014',
trade_representative_phone_number: '+819012345678',
trade_representative_email: '[email protected]',
trade_representative_is_displayed_on_app_store: 'false')
end
let(:application) { double('application') }
let(:setup) { Deliver::Setup.new }
let(:tempdir) { Dir.mktmpdir }
before do
allow(version).to receive_message_chain('application.details').and_return(application)
allow(version).to receive_message_chain('description.languages').and_return([])
allow(version).to receive_message_chain('large_app_icon.asset_token').and_return(nil)
allow(version).to receive_message_chain('watch_app_icon.asset_token').and_return(nil)
stub_const('Deliver::UploadMetadata::NON_LOCALISED_VERSION_VALUES', [])
stub_const('Deliver::UploadMetadata::NON_LOCALISED_APP_VALUES', [])
stub_const('Deliver::UploadMetadata::REVIEW_INFORMATION_VALUES', {})
end
it 'generates trade representative contact information' do
setup.generate_metadata_files(version, tempdir)
base_dir = File.join(tempdir, 'trade_representative_contact_information')
%w(trade_name first_name last_name address_line1 city_name state country postal_code phone_number email_address is_displayed_on_app_store).each do |filename|
expect(File.exist?(File.join(base_dir, "#{filename}.txt"))).to be_truthy
end
end
end
end
end
end