Sha256: b72047e4213d7be0131b233bfa519bca24f8eb35c68f09f1acd585e65dd0f52e

Contents?: true

Size: 456 Bytes

Versions: 3

Compression:

Stored size: 456 Bytes

Contents

module RSpec
  module TestSpec
    module SharedSteps
      def shared_steps(name, &block)
        ensure_shared_example_steps_name_not_taken(name)
        ::RSpec.world.shared_example_steps[name] = block
      end

      private

      def ensure_shared_example_steps_name_not_taken(name)
        return unless ::RSpec.world.shared_example_steps.key?(name)

        raise(ArgumentError, "Shared step '#{name}' already exists")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
test_spec-1.1.0 lib/test_spec/rspec/shared_steps.rb
test_spec-1.0.0 lib/test_spec/rspec/shared_steps.rb
test_spec-0.1.0 lib/test_spec/rspec/shared_steps.rb