Sha256: b28be82d7efa8b544519fadcc40978aa105a5e22217a85a1062f52f9711fb184

Contents?: true

Size: 1.48 KB

Versions: 27

Compression:

Stored size: 1.48 KB

Contents

module Cucumber
  class Runtime
    
    class Results
      def initialize(configuration)
        @configuration = configuration

        # Optimization - quicker lookup.
        @inserted_steps = {}
        @inserted_scenarios = {}
      end

      def configure(new_configuration)
        @configuration = Configuration.parse(new_configuration)
      end

      def step_visited(step) #:nodoc:
        step_id = step.object_id

        unless @inserted_steps.has_key?(step_id)
          @inserted_steps[step_id] = step
          steps.push(step)
        end
      end
      
      def scenario_visited(scenario) #:nodoc:
        scenario_id = scenario.object_id

        unless @inserted_scenarios.has_key?(scenario_id)
          @inserted_scenarios[scenario_id] = scenario
          scenarios.push(scenario)
        end
      end
      
      def steps(status = nil) #:nodoc:
        @steps ||= []
        if(status)
          @steps.select{|step| step.status == status}
        else
          @steps
        end
      end
      
      def scenarios(status = nil) #:nodoc:
        @scenarios ||= []
        if(status)
          @scenarios.select{|scenario| scenario.status == status}
        else
          @scenarios
        end
      end
      
      def failure?
        if @configuration.wip?
          scenarios(:passed).any?
        else
          scenarios(:failed).any? ||
          (@configuration.strict? && (steps(:undefined).any? || steps(:pending).any?))
        end
      end
    end
    
  end
end

Version data entries

27 entries across 27 versions & 5 rubygems

Version Path
casecumber-1.0.2.1 lib/cucumber/runtime/results.rb
cucumber-1.1.4 lib/cucumber/runtime/results.rb
cucumber-1.1.3 lib/cucumber/runtime/results.rb
cucumber-1.1.2 lib/cucumber/runtime/results.rb
cucumber-1.1.1 lib/cucumber/runtime/results.rb
js-log-cucumber-1.0.2 lib/cucumber/runtime/results.rb
cucumber-1.1.0 lib/cucumber/runtime/results.rb
cucumber-1.0.6 lib/cucumber/runtime/results.rb
cucumber-1.0.5 lib/cucumber/runtime/results.rb
cucumber-1.0.4 lib/cucumber/runtime/results.rb
cucumber-1.0.3 lib/cucumber/runtime/results.rb
cucumber-1.0.2 lib/cucumber/runtime/results.rb
cucumber-1.0.1 lib/cucumber/runtime/results.rb
cucumber-1.0.0 lib/cucumber/runtime/results.rb
cucumber-0.10.7 lib/cucumber/runtime/results.rb
cucumber-0.10.6 lib/cucumber/runtime/results.rb
cucumber-0.10.5 lib/cucumber/runtime/results.rb
cucumber-0.10.3 lib/cucumber/runtime/results.rb
cucumber-0.10.2 lib/cucumber/runtime/results.rb
cucumber-0.10.1 lib/cucumber/runtime/results.rb