Sha256: e7fe71abf167b74ab41f2165b82ca9ebeb67fdb0f4a5780602ffedf263d14a4e

Contents?: true

Size: 716 Bytes

Versions: 13

Compression:

Stored size: 716 Bytes

Contents

module VCR
  class CucumberTags
    class << self
      def tags
        @tags.dup
      end

      def add_tag(tag)
        @tags << tag
      end
    end

    @tags = []
    def initialize(main_object)
      @main_object = main_object
    end

    def tags(*tag_names)
      options = tag_names.last.is_a?(::Hash) ? tag_names.pop : {}
      tag_names.each do |tag_name|
        tag_name = "@#{tag_name}" unless tag_name =~ /^@/
        cassette_name = "cucumber_tags/#{tag_name.gsub(/\A@/, '')}"

        @main_object.Around(tag_name) do |scenario, block|
          VCR.use_cassette(cassette_name, options, &block)
        end

        self.class.add_tag(tag_name)
      end
    end
    alias :tag :tags
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
vcr-1.6.0 lib/vcr/cucumber_tags.rb
vcr-1.5.1 lib/vcr/cucumber_tags.rb
vcr-1.5.0 lib/vcr/cucumber_tags.rb
vcr-1.4.0 lib/vcr/cucumber_tags.rb
vcr-1.3.3 lib/vcr/cucumber_tags.rb
vcr-1.3.2 lib/vcr/cucumber_tags.rb
vcr-1.3.1 lib/vcr/cucumber_tags.rb
vcr-1.3.0 lib/vcr/cucumber_tags.rb
vcr-1.2.0 lib/vcr/cucumber_tags.rb
vcr-1.1.2 lib/vcr/cucumber_tags.rb
vcr-1.1.1 lib/vcr/cucumber_tags.rb
vcr-1.1.0 lib/vcr/cucumber_tags.rb
vcr-1.0.3 lib/vcr/cucumber_tags.rb