forked from appelier/bigtuna
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'gemfile-discovery' into development
- Loading branch information
Showing
2 changed files
with
52 additions
and
2 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
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,43 @@ | ||
require 'test_helper' | ||
|
||
class BundlerProjectTest < ActiveSupport::TestCase | ||
def setup | ||
super | ||
create_bundler_test_repo | ||
end | ||
|
||
def teardown | ||
destroy_test_repo | ||
super | ||
end | ||
|
||
test "bundler projects are auto-discovered" do | ||
project = project_with_steps({:name => "bundlerproject", :vcs_source => "test/files/bundler_repo", :vcs_type => "git"}, "env") | ||
project.build! | ||
run_delayed_jobs() | ||
build = project.recent_build | ||
envs = build.parts[0].output[0].stdout | ||
bundle_gemfile_env = envs.map! { |e| e.split("=") }.assoc("BUNDLE_GEMFILE") | ||
assert_equal File.join(build.build_dir, "Gemfile"), bundle_gemfile_env[1] | ||
end | ||
|
||
private | ||
def create_bundler_test_repo | ||
command = <<-CMD.gsub("\n", "; ") | ||
mkdir -p test/files/bundler_repo | ||
cd test/files/bundler_repo | ||
git init | ||
git config user.name git | ||
git config user.email git@example.com | ||
echo "my file" > file | ||
touch Gemfile | ||
git add file Gemfile | ||
git commit -m "bundler project added" | ||
CMD | ||
`#{command}` | ||
end | ||
|
||
def destroy_test_repo | ||
FileUtils.rm_rf 'test/files/bundler_repo' | ||
end | ||
end |