Sha256: b7b9b038d1346b5462c8048d7f8db8cf91dcf507a7a47f29c1d16de8e2593fdf
Contents?: true
Size: 1.87 KB
Versions: 10
Compression:
Stored size: 1.87 KB
Contents
require 'cucumber/core/filter' require 'cucumber/step_match' require 'cucumber/events' require 'cucumber/errors' module Cucumber module Filters class ActivateSteps < Core::Filter.new(:step_match_search, :configuration) def test_case(test_case) CaseFilter.new(test_case, step_match_search, configuration).test_case.describe_to receiver end class CaseFilter def initialize(test_case, step_match_search, configuration) @original_test_case = test_case @step_match_search = step_match_search @configuration = configuration end def test_case @original_test_case.with_steps(new_test_steps) end private def new_test_steps @original_test_case.test_steps.map(&self.method(:attempt_to_activate)) end def attempt_to_activate(test_step) find_match(test_step).activate(test_step) end def find_match(test_step) FindMatch.new(@step_match_search, @configuration, test_step).result end class FindMatch def initialize(step_match_search, configuration, test_step) @step_match_search, @configuration, @test_step = step_match_search, configuration, test_step end def result return NoStepMatch.new(test_step.source.last, test_step.name) unless matches.any? configuration.notify Events::StepMatch.new(test_step, match) return SkippingStepMatch.new if configuration.dry_run? match end private attr_reader :step_match_search, :configuration, :test_step private :step_match_search, :configuration, :test_step def match matches.first end def matches step_match_search.call(test_step.name) end end end end end end
Version data entries
10 entries across 10 versions & 2 rubygems