Skip to content

Commit

Permalink
[gym] Gym::DetectValues test date fix (#16181)
Browse files Browse the repository at this point in the history
* [gym] Tests: Fix date checks within detect_values_spec when running tests at midnight. (#15987)

* [gym] Fix code formatting in tests.

* Mock day to ensure exact value

* Added comments and removed comments

Co-authored-by: Kyle Hammond <kyle.hammond@snowmintcs.com>
Co-authored-by: Josh Holtz <josh@rokkincat.com>
  • Loading branch information
3 people authored Apr 3, 2020
1 parent 373921c commit 11a5168
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions gym/spec/detect_values_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
describe Gym do
describe Gym::DetectValues do
day = Time.now.strftime("%F")

describe 'Xcode config handling', :stuff, requires_xcodebuild: true do
now = Time.now
day = now.strftime("%F")

before do
# These tests can take some time to run
# Mocking Time.now to ensure test pass when running between two days
expect(Time).to receive(:now).and_return(now).once
end

it "fetches the custom build path from the Xcode config" do
expect(Gym::DetectValues).to receive(:has_xcode_preferences_plist?).and_return(true)
expect(Gym::DetectValues).to receive(:xcode_preferences_dictionary).and_return({ "IDECustomDistributionArchivesLocation" => "/test/path" })
Expand Down

0 comments on commit 11a5168

Please sign in to comment.