lib/CLIntegracon/adapter/bacon.rb in clintegracon-0.4.1 vs lib/CLIntegracon/adapter/bacon.rb in clintegracon-0.5.0
- old
+ new
@@ -26,26 +26,26 @@
@subject ||= CLIntegracon::shared_config.subject.dup
return @subject if block.nil?
instance_exec(@subject, &block)
end
- # Get or configure the current context
+ # Get or configure the current context for FileTreeSpecs
#
# @note On first call this will create a new context on base of the
- # shared configuration and store it in the ivar `@context`.
+ # shared configuration and store it in the ivar `@file_tree_spec_context`.
#
# @param [Block<(FileTreeSpecContext) -> ()>]
# This block, if given, will be evaluated on the caller.
# It receives as first argument the context itself.
#
# @return [FileTreeSpecContext]
# the spec context, will be lazily created if not already present.
#
- def context &block
- @context ||= CLIntegracon.shared_config.context.dup
- return @context if block.nil?
- instance_exec(@context, &block)
+ def file_tree_spec_context &block
+ @file_tree_spec_context ||= CLIntegracon.shared_config.file_tree_spec_context.dup
+ return @file_tree_spec_context if block.nil?
+ instance_exec(@file_tree_spec_context, &block)
end
# Works like `behaves_like`, but takes arguments for the shared example
#
# @param [String] name
@@ -61,12 +61,12 @@
# Ad-hoc defines a set of shared expectations to be consumed directly by `behaves_like`.
# See the following example for usage:
#
# behaves_like cli_spec('my_spec_dir', 'install --verbose')
#
- # @note This expects that a method `context` is defined, which is returning an
- # instance of {FileTreeSpecContext}.
+ # @note This expects that a method `file_tree_spec_context` is defined, which is
+ # returning an instance of {FileTreeSpecContext}.
#
# @param [String] spec_dir
# the concrete directory of the spec, see {file_spec}.
#
# @param [String] args
@@ -93,12 +93,12 @@
#
# behaves_like file_spec('my_spec_dir') do
# # do some changes to the current dir
# end
#
- # @note This expects that a method `context` is defined, which is returning an
- # instance of {FileTreeSpecContext}.
+ # @note This expects that a method `file_tree_spec_context` is defined, which is
+ # returning an instance of {FileTreeSpecContext}.
#
# @param [String] spec_dir
# the concrete directory of the spec to be passed to
# {FileTreeSpecContext.spec}
#
@@ -114,11 +114,11 @@
raise ArgumentError.new("Spec directory is missing!") if spec_dir.nil?
shared_name = spec_dir
shared shared_name do
- context.spec(spec_dir).run do |spec|
+ file_tree_spec_context.spec(spec_dir).run do |spec|
instance_eval &block
spec.compare do |diff|
it diff.relative_path.to_s do
diff.produced.should.satisfy(spec.formatter.describe_missing_file(diff.relative_path)) do
@@ -146,10 +146,10 @@
end
# Describe a command line interface
# This method basically behaves like {Bacon::Context.describe}, but it provides
- # automatically the methods #subject, #context, #cli_spec and #file_spec.
+ # automatically the methods #subject, #file_tree_spec_context, #cli_spec and #file_spec.
#
# @param [String] subject_name
# the subject name will be used as first argument to initialize
# a new {CLIntegracon::Subject}, which will be accessible in the
# spec by #subject.