Merge remote-tracking branch 'canonical/next'
[sinan.git] / test / sint_programatic_gen.erl
blobad33043c0bea081efb77d4cd491b9fcfdbf32b51
1 %%%-------------------------------------------------------------------
2 %%% @copyright (C) 2011, Erlware, LLC.
3 %%% @doc
4 %%% Test the ability to generate a project programatically
5 %%% @end
6 %%% Created : 5 Sep 2011 by Eric Merritt <ericbmerritt@gmail.com>
7 %%%-------------------------------------------------------------------
8 -module(sint_programatic_gen).
10 -export([given/3, 'when'/3, then/3]).
12 % Step definitions for the sample calculator Addition feature.
14 given([an, empty, temp, directory, with, no, project], _State,
15 _) ->
16 BaseDir = ec_file:mkdtemp(),
17 {ok, BaseDir}.
19 'when'([gen, is, called, pragmatically, with, out,
20 available, user, input], BaseDir, _) ->
21 ProjectName = "super_foo",
22 {ProjectDir, _} =
23 sint_test_project_gen:single_app_project(BaseDir, ProjectName),
24 {ok, {ProjectDir, ProjectName}};
25 'when'([a, build, is, run], State = {ProjectDir, _ProjectName}, _) ->
26 sinan:run_sinan(["-s", ProjectDir, "build"]),
27 {ok, State}.
29 then([sinan, should, build, the, project, normally],
30 {ProjectDir, ProjectName}, _) ->
31 sint_test_project_gen:validate_single_app_project(ProjectDir, ProjectName).