Skip to content

Commit

Permalink
rename subcontext to import_steps_from
Browse files Browse the repository at this point in the history
  • Loading branch information
steve.brazier committed Dec 18, 2016
1 parent 22c9421 commit 443b170
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- The context behaviour is extended to require ```callback get_scenario_timeout(Feature.t, Scenario.t) :: number``` any contexts not ```use```ing ```WhiteBread.Context``` will need to add the function.
- The *_starting_state and *_finalize functions in the context behaviour have been standardised so a pair each for feature and scenario.
- `tags` and `context` are no longer supported on the command line. Tags will be reintroduced in a later release. Context will not as everything will now require a suite configuration. [#77]
- `subcontext` macro renamed to `import_steps_from` to make intent clearer.

## V2.8.1 (2016-09-29)

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ end
After following the getting started steps you may find your default context starts to get a bit large.
There are two ways this can be broken apart:

1. By composing your default suite out of subcontexts.
1. By composing your default suite out of subcontexts using the `import_steps_from` macro.
2. By splitting your features into different suites each starting with a different context.

## Subcontexts
Expand All @@ -154,7 +154,7 @@ will be available.
defmodule WhiteBread.Example.DefaultContext do
use WhiteBread.Context

subcontext WhiteBread.Example.SharedContext
import_steps_from WhiteBread.Example.SharedContext

# Rest of the context here as usual
#...
Expand Down
2 changes: 1 addition & 1 deletion features/contexts/alternate_context.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule WhiteBread.Example.AlternateContext do
use WhiteBread.Context

subcontext WhiteBread.Example.AnythingGoesContext
import_steps_from WhiteBread.Example.AnythingGoesContext

feature_starting_state fn ->
%{feature_state_loaded: :yes}
Expand Down
10 changes: 5 additions & 5 deletions features/contexts/default_context.exs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
defmodule WhiteBread.Example.DefaultContext do
use WhiteBread.Context

subcontext WhiteBread.Example.DocStringContext
subcontext WhiteBread.Example.CoffeeContext
subcontext WhiteBread.Example.SongContext
subcontext WhiteBread.Example.TableContext
subcontext WhiteBread.Example.DefaultContext.LoafContext
import_steps_from WhiteBread.Example.DocStringContext
import_steps_from WhiteBread.Example.CoffeeContext
import_steps_from WhiteBread.Example.SongContext
import_steps_from WhiteBread.Example.TableContext
import_steps_from WhiteBread.Example.DefaultContext.LoafContext

feature_starting_state fn ->
%{feature_state_loaded: :yes}
Expand Down
2 changes: 1 addition & 1 deletion features/contexts/my_other_feature_b_context.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule WhiteBread.TestContextPerFeature.MyOtherFeatureBContext do
use WhiteBread.Context

subcontext WhiteBread.TestContextPerFeature.OtherFeatureContext
import_steps_from WhiteBread.TestContextPerFeature.OtherFeatureContext

feature_starting_state fn ->
%{feature_state_loaded: :yes}
Expand Down
4 changes: 2 additions & 2 deletions features/contexts/outline_context.exs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
defmodule WhiteBread.Example.OutlineContext do
use WhiteBread.Context

subcontext WhiteBread.Example.OutlineContext.AdditionalStateSteps
subcontext WhiteBread.Example.OutlineContext.StringSteps
import_steps_from WhiteBread.Example.OutlineContext.AdditionalStateSteps
import_steps_from WhiteBread.Example.OutlineContext.StringSteps

feature_starting_state fn ->
%{feature_state_loaded: :yes}
Expand Down
2 changes: 1 addition & 1 deletion lib/white_bread/context.ex
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ defmodule WhiteBread.Context do
end
end

defmacro subcontext(context_module) do
defmacro import_steps_from(context_module) do
quote do
@sub_context_modules [unquote(context_module) | @sub_context_modules]
end
Expand Down
4 changes: 2 additions & 2 deletions test/sub_context_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ end
defmodule WhiteBread.SubContextTest.ExampleContext do
use WhiteBread.Context

subcontext WhiteBread.SubContextTest.SubExampleContext.One
subcontext WhiteBread.SubContextTest.SubExampleContext.Two
import_steps_from WhiteBread.SubContextTest.SubExampleContext.One
import_steps_from WhiteBread.SubContextTest.SubExampleContext.Two

end

Expand Down

0 comments on commit 443b170

Please sign in to comment.