Skip to content
This repository has been archived by the owner on May 3, 2023. It is now read-only.

Update #22

Merged
merged 10 commits into from Mar 29, 2018
Merged

Update #22

merged 10 commits into from Mar 29, 2018

Conversation

godrei
Copy link
Contributor

@godrei godrei commented Mar 29, 2018

No description provided.

require_relative '../log/log'

RSpec.describe 'DeviceClient' do
it 'it registers new device' do

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)

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

project
end

it 'new Xcode project uses auto signing' do

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'] || {}

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.

Copy link

@gaborszakacs gaborszakacs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚜 👍

@godrei godrei merged commit 058787c into master Mar 29, 2018
@godrei godrei deleted the update branch March 29, 2018 15:12
mividtim pushed a commit to TrueRowing/steps-ios-auto-provision that referenced this pull request Dec 17, 2018
* 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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants