Sha256: 2c7552594e99fcbbaadc824f13312a067faae461a2c8e97575cd41a9bd81cee2

Contents?: true

Size: 933 Bytes

Versions: 17

Compression:

Stored size: 933 Bytes

Contents

module Lopata
  module RSpec
    module DSL
      def self.included(base)
        base.extend(ClassMethods)
      end

      module ClassMethods
        def action *contexts, &block
          contexts.each do |context|
            if context.is_a?(Proc)
              action(&context)
            else
              include_context context
            end
          end
          before(:all, &block) if block_given?
        end

        def setup *contexts, &block
          root_setup = false
          unless @doing_setup
            root_setup = true
            @doing_setup = true
          end
          action *contexts, &block
          if root_setup
            # action Config.after_setup if Config.after_setup
            @doing_setup = false
          end
        end

        def teardown &block
          after(:all, &block) if block_given?
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
lopata-0.1.1 lib/lopata/rspec/dsl.rb
lopata-0.1.0 lib/lopata/rspec/dsl.rb
lopata-0.0.16 lib/lopata/rspec/dsl.rb
lopata-0.0.15 lib/lopata/rspec/dsl.rb
lopata-0.0.14 lib/lopata/rspec/dsl.rb
lopata-0.0.13 lib/lopata/rspec/dsl.rb
lopata-0.0.12 lib/lopata/rspec/dsl.rb
lopata-0.0.11 lib/lopata/rspec/dsl.rb
lopata-0.0.10 lib/lopata/rspec/dsl.rb
lopata-0.0.9 lib/lopata/rspec/dsl.rb
lopata-0.0.8 lib/lopata/rspec/dsl.rb
lopata-0.0.7 lib/lopata/rspec/dsl.rb
lopata-0.0.6 lib/lopata/rspec/dsl.rb
lopata-0.0.5 lib/lopata/rspec/dsl.rb
lopata-0.0.4 lib/lopata/rspec/dsl.rb
lopata-0.0.3 lib/lopata/rspec/dsl.rb
lopata-0.0.2 lib/lopata/rspec/dsl.rb