Sha256: a978bdab3b732c904e79e69a770b50e91c9a30c28f9fd99c75d8e6ed44ade107

Contents?: true

Size: 1.5 KB

Versions: 24

Compression:

Stored size: 1.5 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? || steps(:failed).any? ||
          (@configuration.strict? && (steps(:undefined).any? || steps(:pending).any?))
        end
      end
    end
    
  end
end

Version data entries

24 entries across 22 versions & 8 rubygems

Version Path
candlepin-api-0.4.0 bundle/ruby/gems/cucumber-1.2.1/lib/cucumber/runtime/results.rb
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/cucumber-1.2.1/lib/cucumber/runtime/results.rb
candlepin-api-0.4.0 bundle/ruby/1.8/gems/cucumber-1.2.1/lib/cucumber/runtime/results.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/cucumber-1.2.1/lib/cucumber/runtime/results.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/cucumber-1.2.1/lib/cucumber/runtime/results.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/cucumber-1.2.1/lib/cucumber/runtime/results.rb
casecumber-1.2.1.cb2 lib/cucumber/runtime/results.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/cucumber-1.2.1/lib/cucumber/runtime/results.rb
cucumber-1.2.1 lib/cucumber/runtime/results.rb
resque-pool-0.3.0 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/lib/cucumber/runtime/results.rb
ftl-0.2.0 vendor/bundle/gems/cucumber-1.2.0/lib/cucumber/runtime/results.rb
cucumber-1.2.0 lib/cucumber/runtime/results.rb
frameworks-capybara-0.2.0.rc6 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/lib/cucumber/runtime/results.rb
frameworks-capybara-0.2.0.rc5 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/lib/cucumber/runtime/results.rb
frameworks-capybara-0.2.0.rc4 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/lib/cucumber/runtime/results.rb
frameworks-capybara-0.2.0.rc3 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/lib/cucumber/runtime/results.rb
frameworks-capybara-0.2.0.rc2 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/lib/cucumber/runtime/results.rb
resque-pool-0.3.0.beta.2 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/lib/cucumber/runtime/results.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/cucumber-1.1.9/lib/cucumber/runtime/results.rb
cucumber-1.1.9 lib/cucumber/runtime/results.rb