lib/lopata/scenario_builder.rb in lopata-0.1.20 vs lib/lopata/scenario_builder.rb in lopata-0.1.21
- old
+ new
@@ -275,9 +275,27 @@
steps << Lopata::Step.new(:let) do
execution.let(method_name, &block)
end
end
+ # Define memorized runtime method for the scenario.
+ #
+ # @note
+ # The method to be called via #method_missing, so it wont override already defined methods.
+ #
+ # @example
+ # let!(:started) { Time.now }
+ # it 'started early' do
+ # first_started = started
+ # expect(started).to eq first_started
+ # end
+ def let!(method_name, &block)
+ steps << Lopata::Step.new(:let) do
+ execution.let!(method_name, &block)
+ end
+ end
+
+
# @!endgroup
# @private
def add_step(method_name, *args, condition: nil, metadata: {}, &block)
step_class =