Update #22
Conversation
spec/device_client_spec.rb
Outdated
require_relative '../log/log' | ||
|
||
RSpec.describe 'DeviceClient' do | ||
it 'it registers new device' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls describe the method that is under test, and drop the it
from the test case description, the subject will be the method you described.
describe '.ensure_test_devices' do
it 'registers new device' do
...
allow(fake_portal_client).to receive(:all).and_return(nil) | ||
allow(fake_portal_client).to receive(:create!).and_return(fake_portal_device) | ||
|
||
Portal::DeviceClient.ensure_test_devices([device], fake_portal_client) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's our expectation here? Only that no error will be raised?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yepp, this test failes if you revert this line change: https://github.com/bitrise-steplib/steps-ios-auto-provision/pull/22/files#diff-a8717d4d6fa7414f7c105f8c475b9971R29
spec/project_helper_spec.rb
Outdated
project | ||
end | ||
|
||
it 'new Xcode project uses auto signing' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using the describe block and contexts here too and DRYing up the tests with one-liners.
RSpec.describe 'ProjectHelper' do
let(:project_with_target_attributes) do
path = File.join(test_project_dir, 'foo.xcodeproj')
project = Xcodeproj::Project.open(path)
recreate_shared_schemes(project)
project
end
let(:project_without_target_attributes) do
project = project_with_target_attributes
project.root_object.attributes['TargetAttributes'] = nil
project.save
project
end
describe '#uses_xcode_auto_codesigning?' do
subject { ProjectHelper.new(project.path, 'foo', '').uses_xcode_auto_codesigning? }
context 'when new Xcode project uses auto signing with TargetAttributes' do
let(:project) { project_with_target_attributes }
it { is_expected.to eq true }
end
context 'when new Xcode project uses auto signing without TargetAttributes' do
let(:project) { project_without_target_attributes }
it { is_expected.to eq true }
end
end
end
@@ -51,8 +51,8 @@ def uses_xcode_auto_codesigning? | |||
target_id = main_target.uuid | |||
|
|||
project = Xcodeproj::Project.open(@targets_container_project_path) | |||
attributes = project.root_object.attributes['TargetAttributes'] | |||
target_attributes = attributes[target_id] | |||
attributes = project.root_object.attributes['TargetAttributes'] || {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests still pass without using the hash as a fallback, I think, they shouldn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚜 👍
* rspec, fix if TargetAttributes missing * fix registering device * do not force enable device * fixed provided an older version log * check if managed profile contains the provided cert * fix * check if profile expired * DateTime Time comparation fix * pr fixes * PR fixes
No description provided.