-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose packs/rspec/support for easier ecosystem testing (#8)
* add require for pathname * add note * bump version
- Loading branch information
Alex Evanczuk
authored
Dec 29, 2022
1 parent
6f92e09
commit 796976c
Showing
7 changed files
with
78 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
packs (0.0.4) | ||
packs (0.0.5) | ||
sorbet-runtime | ||
|
||
GEM | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
module FixtureHelper | ||
extend T::Sig | ||
|
||
sig { params(path: String, content: String).returns(String) } | ||
def write_file(path, content = '') | ||
pathname = Pathname.pwd.join(path) | ||
FileUtils.mkdir_p(pathname.dirname) | ||
pathname.write(content) | ||
path | ||
end | ||
|
||
sig do | ||
params( | ||
pack_name: String, | ||
config: T::Hash[T.untyped, T.untyped] | ||
).void | ||
end | ||
def write_pack( | ||
pack_name, | ||
config = {} | ||
) | ||
path = Pathname.pwd.join(pack_name).join('package.yml') | ||
write_file(path.to_s, YAML.dump(config)) | ||
end | ||
|
||
sig { params(path: String).void } | ||
def delete_app_file(path) | ||
File.delete(path) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require_relative 'fixture_helper' | ||
|
||
RSpec.configure do |config| | ||
config.include FixtureHelper | ||
|
||
config.before do | ||
# We bust_cache always because each test may write its own packs | ||
Packs.bust_cache! | ||
end | ||
|
||
# Eventually, we could make this opt-in via metadata so someone can use this support without affecting all their tests. | ||
config.around do |example| | ||
prefix = [File.basename($0), Process.pid].join('-') # rubocop:disable Style/SpecialGlobalVars | ||
tmpdir = Dir.mktmpdir(prefix) | ||
Dir.chdir(tmpdir) do | ||
example.run | ||
end | ||
ensure | ||
FileUtils.rm_rf(tmpdir) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Gem::Specification.new do |spec| | ||
spec.name = 'packs' | ||
spec.version = '0.0.4' | ||
spec.version = '0.0.5' | ||
spec.authors = ['Gusto Engineers'] | ||
spec.email = ['[email protected]'] | ||
spec.summary = 'Packs are the specification for gradual modularization in the `rubyatscale` ecosystem.' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters