Skip to content

Commit

Permalink
Merge pull request #94 from inaka/ferigis.91.get_path
Browse files Browse the repository at this point in the history
[#91] sr_state:path/1 created
  • Loading branch information
Euen authored May 24, 2017
2 parents cde617b + b54e232 commit 7e1a494
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/sr_state.erl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
, entity/2
, module/1
, opts/1
, path/1
]).

%% functions to work with user opts
Expand Down Expand Up @@ -72,6 +73,10 @@ module(#{module := Module}) ->
opts(#{opts := Opts}) ->
Opts.

-spec path(state()) -> string().
path(#{opts := #{path := Path}}) ->
Path.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% User opts Functions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down
4 changes: 3 additions & 1 deletion test/sr_state_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ all() -> sr_test_utils:all(?MODULE).
state(_Config) ->
ct:comment("Testing sr_state functions"),
Module = fake_module_name,
Opts = #{model => value1, path => "/path"},
Path = "/path",
Opts = #{model => value1, path => Path},
SrState = sr_state:new(Opts, Module),
Module = sr_state:module(SrState),
Path = sr_state:path(SrState),
Opts = sr_state:opts(SrState),
undefined = sr_state:id(SrState),
Id = <<"myId">>,
Expand Down

0 comments on commit 7e1a494

Please sign in to comment.