1 %%%-------------------------------------------------------------------
2 %%% @copyright (C) 2011, Erlware, LLC.
4 %%% Test the ability to generate an app.src
6 %%% Created : 5 Sep 2011 by Eric Merritt <ericbmerritt@gmail.com>
7 %%%-------------------------------------------------------------------
8 -module(sint_gen_app_src
).
10 -include_lib("eunit/include/eunit.hrl").
12 -export([given
/3, 'when'/3, then
/3]).
14 % Step definitions for the sample calculator Addition feature.
16 given([an
, empty
, temp
, directory
, with
, no
, project
], _State
,
18 BaseDir
= ec_file:mkdtemp(),
21 'when'([the
, sinan
, gen
, task
, is
, called
], BaseDir
, _
) ->
22 ProjectName
= "super_foo",
24 sint_test_project_gen:single_app_project(BaseDir
, ProjectName
),
25 {ok
, {ProjectDir
, ProjectName
}};
26 'when'([a
, build
, is
, run
],
27 {ProjectDir
, ProjectName
}, _
) ->
28 Ret
= sinan:run_sinan(["-s", ProjectDir
, "build"]),
29 {ok
, {ProjectDir
, ProjectName
, Ret
}}.
32 then([sinan
, should
, generate
, an
, 'app.src',
33 into
, the
, src
, directory
],
34 State
= {ProjectDir
, ProjectName
, _
}, _
) ->
35 Path
= filename:join([ProjectDir
, "src",
36 ProjectName
++ ".app.src"]),
39 sin_utils:file_exists(sin_state:new(), Path
)),
42 then([build
, the
, project
, normally
],
43 State
= {ProjectDir
, ProjectName
, BuildState
}, _
) ->
44 ?
assertMatch({ok
, _
}, BuildState
),
45 sint_test_project_gen:validate_single_app_project(ProjectDir
,