Sha256: 98cc07f5b0890b43b124e480809da3ad491a6268ec323088f703ce966415d7df

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

class EolScenario

  # scenario helpers that can be used in your specs
  #
  # specifically, a #scenarios method for easily loading scenarios
  #
  module Spec

    # scenarios to load in a spec
    #
    #   scenario  :foo
    #   scenarios :foo, :bar
    #   scenarios :foo, :bar, :before => :all
    #   scenarios :foo, :bar, :before => :each
    #
    # defaults to before each
    #
    # to use this in your own specs, in your spec_helper.rb
    #
    #   require 'eol_scenarios'
    #
    #   Spec::Runner.configure do |config|
    #     include EolScenario::Spec
    #   end
    #
    # is RSpec is loaded, we'll load up the EolScenario::Spec for 
    # you automatically.  if you need to manually load this:
    #
    #   require 'eol_scenarios/spec'
    #
    def scenario *scenarios
      puts "EolScenario::Spec::Helper.scenario #{ scenarios.inspect }" if EolScenario.verbose
      options = (scenarios.last.is_a?Hash) ? scenarios.pop : { }
      options[:before] ||= :each
      before options[:before] do
        EolScenario.load *scenarios
      end
    end
    alias scenarios scenario

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eol_scenarios-0.3.4 lib/eol_scenarios/spec.rb
eol_scenarios-0.3.3 lib/eol_scenarios/spec.rb