github.com/bhameyie/otto@v0.2.1-0.20160406174117-16052efa52ec/builtin/app/ruby/app_acceptance_test.go (about)

     1  package rubyapp
     2  
     3  import (
     4  	"path/filepath"
     5  	"testing"
     6  
     7  	"github.com/hashicorp/otto/helper/vagrant"
     8  	"github.com/hashicorp/otto/otto"
     9  )
    10  
    11  func TestApp_dev(t *testing.T) {
    12  	otto.Test(t, otto.TestCase{
    13  		Core: otto.TestCore(t, &otto.TestCoreOpts{
    14  			Path: filepath.Join("./test-fixtures", "basic", "Appfile"),
    15  			App:  new(App),
    16  		}),
    17  
    18  		Steps: []otto.TestStep{
    19  			&vagrant.DevTestStepInit{},
    20  
    21  			// Verify we have Ruby
    22  			&vagrant.DevTestStepGuestScript{
    23  				Command: "ruby --version | grep '2.2'",
    24  			},
    25  			&vagrant.DevTestStepGuestScript{
    26  				Command: "bundle --version",
    27  			},
    28  
    29  			// Verify everything works
    30  			&vagrant.DevTestStepGuestScript{
    31  				Command: "bundle exec ruby app.rb | grep hello",
    32  			},
    33  		},
    34  
    35  		Teardown: vagrant.DevTestTeardown,
    36  	})
    37  }
    38  
    39  func TestApp_dev_detectGemfile(t *testing.T) {
    40  	otto.Test(t, otto.TestCase{
    41  		Core: otto.TestCore(t, &otto.TestCoreOpts{
    42  			Path: filepath.Join("./test-fixtures", "detect-gemfile", "Appfile"),
    43  			App:  new(App),
    44  		}),
    45  
    46  		Steps: []otto.TestStep{
    47  			&vagrant.DevTestStepInit{},
    48  
    49  			// Verify we have Ruby
    50  			&vagrant.DevTestStepGuestScript{
    51  				Command: "ruby --version | grep '2.1'",
    52  			},
    53  			&vagrant.DevTestStepGuestScript{
    54  				Command: "bundle --version",
    55  			},
    56  
    57  			// Verify everything works
    58  			&vagrant.DevTestStepGuestScript{
    59  				Command: "bundle exec ruby app.rb | grep hello",
    60  			},
    61  		},
    62  
    63  		Teardown: vagrant.DevTestTeardown,
    64  	})
    65  }