Skip to content

Commit

Permalink
fix git repo fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
wr0ngway committed Apr 11, 2018
1 parent 55a9dad commit c463824
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 3 deletions.
158 changes: 158 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
PATH
remote: .
specs:
simplygenius-atmos (0.7.0)
activesupport
aws-sdk-core
aws-sdk-ecr
aws-sdk-ecs
aws-sdk-iam
aws-sdk-organizations
aws-sdk-s3
clamp
climate_control
clipboard
gem_logger
git
hashie
highline
logging
os
rainbow
rotp
rubyzip
sigdump
thor

GEM
remote: https://rubygems.org/
specs:
activesupport (5.2.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
aws-partitions (1.80.0)
aws-sdk-core (3.19.0)
aws-partitions (~> 1.0)
aws-sigv4 (~> 1.0)
jmespath (~> 1.0)
aws-sdk-ecr (1.3.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-ecs (1.12.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-iam (1.4.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-kms (1.5.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-organizations (1.8.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-s3 (1.9.0)
aws-sdk-core (~> 3)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.0)
aws-sigv4 (1.0.2)
byebug (10.0.2)
clamp (1.2.1)
climate_control (0.2.0)
clipboard (1.1.1)
coderay (1.1.2)
concurrent-ruby (1.0.5)
coveralls (0.8.21)
json (>= 1.8, < 3)
simplecov (~> 0.14.1)
term-ansicolor (~> 1.3)
thor (~> 0.19.4)
tins (~> 1.6)
crack (0.4.3)
safe_yaml (~> 1.0.0)
diff-lcs (1.3)
docile (1.1.5)
gem_logger (0.3.0)
activesupport
git (1.3.0)
hashdiff (0.3.7)
hashie (3.5.7)
highline (1.7.10)
i18n (1.0.0)
concurrent-ruby (~> 1.0)
jmespath (1.4.0)
json (2.1.0)
little-plugger (1.1.4)
logging (2.2.2)
little-plugger (~> 1.1)
multi_json (~> 1.10)
method_source (0.9.0)
minitest (5.11.3)
multi_json (1.13.1)
os (1.0.0)
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-byebug (3.6.0)
byebug (~> 10.0)
pry (~> 0.10)
public_suffix (3.0.2)
rainbow (3.0.0)
rake (10.5.0)
rotp (3.3.1)
rspec (3.7.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-core (3.7.1)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-mocks (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-support (3.7.1)
rubyzip (1.2.1)
safe_yaml (1.0.4)
sigdump (0.2.4)
simplecov (0.14.1)
docile (~> 1.1.0)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
term-ansicolor (1.6.0)
tins (~> 1.0)
test_construct (2.0.1)
thor (0.19.4)
thread_safe (0.3.6)
tins (1.16.3)
tzinfo (1.2.5)
thread_safe (~> 0.1)
vcr (4.0.0)
webmock (3.3.0)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 1.14)
coveralls (~> 0.8)
pry
pry-byebug
rake (~> 10.0)
rspec (~> 3.7)
simplecov (~> 0.10)
simplygenius-atmos!
test_construct (~> 2.0.1)
vcr (~> 4.0.0)
webmock (~> 3.3.0)

BUNDLED WITH
1.16.1
1 change: 0 additions & 1 deletion spec/fixtures/template_repo.git
Submodule template_repo.git deleted from e6c35e
Binary file added spec/fixtures/template_repo.git.zip
Binary file not shown.
20 changes: 18 additions & 2 deletions spec/generator_factory_spec.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
require 'atmos/generator_factory'
require 'zip'

describe Atmos::GeneratorFactory do

include TestConstruct::Helpers

let(:gen) { described_class.new([], quiet: true) }

def git_repo_fixture
tmpdir = Dir.mktmpdir("git-repo-fixture-")
at_exit { FileUtils.remove_entry(tmpdir) }
open("#{fixture_dir}/template_repo.git.zip", 'rb') do |io|
Zip::File.open_buffer(io) do |zip_file|
zip_file.each do |f|
fpath = File.join(tmpdir, f.name)
f.extract(fpath)
end
end
end
return "#{tmpdir}/template_repo.git"
end

describe "expand_sourcepaths", :vcr do

Expand All @@ -27,14 +41,16 @@
end

it "expands a git archive locally" do
expanded = described_class.expand_sourcepaths(["#{fixture_dir}/template_repo.git"])
repo_dir = git_repo_fixture
expanded = described_class.expand_sourcepaths([repo_dir])
expect(expanded.size).to eq(1)
expect(expanded.first).to match(/^\/.*/)
expect(Dir.exist?(expanded.first)).to be true
end

it "uses subdir from a git archive" do
expanded = described_class.expand_sourcepaths(["#{fixture_dir}/template_repo.git#subdir"])
repo_dir = git_repo_fixture
expanded = described_class.expand_sourcepaths(["#{repo_dir}#subdir"])
expect(expanded.size).to eq(1)
expect(expanded.first).to match(/^\/.*/)
expect(expanded.first).to match(/subdir$/)
Expand Down

0 comments on commit c463824

Please sign in to comment.