Sha256: b78af7e8beab6f1bc8e1f29f9b37878095e2d17781b3690bb785f9e58a4ac7dc

Contents?: true

Size: 859 Bytes

Versions: 32

Compression:

Stored size: 859 Bytes

Contents

# frozen_string_literal: true

RSpec.describe RuboCop::RSpec::ExampleGroup do
  include RuboCop::AST::Sexp

  subject(:group) { described_class.new(parse_source(source).ast) }

  let(:source) do
    <<-RUBY
      RSpec.describe Foo do
        it 'does x' do
          x
        end

        it 'does y' do
          y
        end

        context 'nested' do
          it 'does z' do
            z
          end
        end
      end
    RUBY
  end

  let(:example_nodes) do
    [
      s(:block,
        s(:send, nil, :it,
          s(:str, 'does x')),
        s(:args), s(:send, nil, :x)),
      s(:block,
        s(:send, nil, :it,
          s(:str, 'does y')),
        s(:args), s(:send, nil, :y))
    ].map { |node| RuboCop::RSpec::Example.new(node) }
  end

  it 'exposes examples in scope' do
    expect(group.examples).to eql(example_nodes)
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
rubocop-rspec-1.35.0 spec/rubocop/rspec/example_group_spec.rb
rubocop-rspec-1.34.1 spec/rubocop/rspec/example_group_spec.rb
rubocop-rspec-1.34.0 spec/rubocop/rspec/example_group_spec.rb
rubocop-rspec-1.33.0 spec/rubocop/rspec/example_group_spec.rb
rubocop-rspec-1.32.0 spec/rubocop/rspec/example_group_spec.rb
rubocop-rspec-1.31.0 spec/rubocop/rspec/example_group_spec.rb
rubocop-rspec-1.30.1 spec/rubocop/rspec/example_group_spec.rb
rubocop-rspec-1.30.0 spec/rubocop/rspec/example_group_spec.rb
rubocop-rspec-1.29.1 spec/rubocop/rspec/example_group_spec.rb
rubocop-rspec-1.29.0 spec/rubocop/rspec/example_group_spec.rb
rubocop-rspec-1.28.0 spec/rubocop/rspec/example_group_spec.rb
rubocop-rspec-1.27.0 spec/rubocop/rspec/example_group_spec.rb
rubocop-rspec-1.26.0 spec/rubocop/rspec/example_group_spec.rb
rubocop-rspec-1.25.1 spec/rubocop/rspec/example_group_spec.rb
rubocop-rspec-1.25.0 spec/rubocop/rspec/example_group_spec.rb
rubocop-rspec-1.24.0 spec/rubocop/rspec/example_group_spec.rb
rubocop-rspec-1.23.0 spec/rubocop/rspec/example_group_spec.rb
rubocop-rspec-1.22.2 spec/rubocop/rspec/example_group_spec.rb
rubocop-rspec-1.22.1 spec/rubocop/rspec/example_group_spec.rb
rubocop-rspec-1.22.0 spec/rubocop/rspec/example_group_spec.rb