<commit_before># RSpec::The

Easily make assertions about the contents of your `let` blocks

[![Travis Status](https://img.shields.io/travis/jamesottaway/rspec-the.svg)](https://travis-ci.org/jamesottaway/rspec-the)
[![RubyGems Version](https://img.shields.io/gem/v/rspec-the.svg)](https://rubygems.org/gems/rspec-the)

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'rspec-the'
```

And then execute:

```
bundle install
```

Or install it yourself as:

```
gem install rspec-the
```

## Usage

Using `rspec-its` to test your given `subject` works for simple method invocations, but requires excessive nesting in more complex scenarios.

``` ruby
describe Array do
  let(:array) { [1, 2, 3, 4, 5] }
  subject { array }

  its(:count) { is_expected.to eq 5 }
  its(:first) { is_expected.to eq 1 }

  describe 'select #even?' do
    subject { array.select(&:even?) }
    it { is_expected.to eq [2, 4] }
  end

  describe 'select #odd?' do
    subject { array.select(&:odd?) }
    it { is_expected.to eq [1, 3, 5] }
  end
end
```

Instead, `rspec-the` allows us use `let` to define many pseudo-`subject` blocks which can easily be tested.

``` ruby
describe Array do
  subject { [1, 2, 3, 4, 5] }

  its(:count) { is_expected.to eq 5 }
  its(:first) { is_expected.to eq 1 }

  let(:evens) { subject.select(&:even?) }
  the(:evens) { is_expected.to eq [2, 4] }

  let(:odds) { subject.select(&:odd?) }
  the(:odds) { is_expected.to eq [1, 3, 5] }
end
```

See, isn't that easier?!?

## Contributing

1. Fork it ( https://github.com/jamesottaway/rspec-the/fork )
2. Create your feature branch (`git checkout -b $BRANCH_NAME`)
3. Commit your changes (`git commit --all --message $COMMIT_MESSAGE`)
4. Push to the branch (`git push $REMOTE $BRANCH_NAME`)
5. Create a new Pull Request ( https://github.com/jamesottaway/rspec-the/compare )<commit_msg>Use `#are_expected` in the Usage example<commit_after># RSpec::The

Easily make assertions about the contents of your `let` blocks

[![Travis Status](https://img.shields.io/travis/jamesottaway/rspec-the.svg)](https://travis-ci.org/jamesottaway/rspec-the)
[![RubyGems Version](https://img.shields.io/gem/v/rspec-the.svg)](https://rubygems.org/gems/rspec-the)

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'rspec-the'
```

And then execute:

```
bundle install
```

Or install it yourself as:

```
gem install rspec-the
```

## Usage

Using `rspec-its` to test your given `subject` works for simple method invocations, but requires excessive nesting in more complex scenarios.

``` ruby
describe Array do
  let(:array) { [1, 2, 3, 4, 5] }
  subject { array }

  its(:count) { is_expected.to eq 5 }
  its(:first) { is_expected.to eq 1 }

  describe 'select #even?' do
    subject { array.select(&:even?) }
    it { is_expected.to eq [2, 4] }
  end

  describe 'select #odd?' do
    subject { array.select(&:odd?) }
    it { is_expected.to eq [1, 3, 5] }
  end
end
```

Instead, `rspec-the` allows us use `let` to define many pseudo-`subject` blocks which can easily be tested.

``` ruby
describe Array do
  subject { [1, 2, 3, 4, 5] }

  its(:count) { is_expected.to eq 5 }
  its(:first) { is_expected.to eq 1 }

  let(:evens) { subject.select(&:even?) }
  the(:evens) { are_expected.to eq [2, 4] }

  let(:odds) { subject.select(&:odd?) }
  the(:odds) { are_expected.to eq [1, 3, 5] }
end
```

See, isn't that easier?!?

## Contributing

1. Fork it ( https://github.com/jamesottaway/rspec-the/fork )
2. Create your feature branch (`git checkout -b $BRANCH_NAME`)
3. Commit your changes (`git commit --all --message $COMMIT_MESSAGE`)
4. Push to the branch (`git push $REMOTE $BRANCH_NAME`)
5. Create a new Pull Request ( https://github.com/jamesottaway/rspec-the/compare )
{'fraction_non_alphanumeric': 0.15786680817192889, 'fraction_numerical': 0.015388697267179624, 'mean_word_length': 3.8209718670076724, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2508195', 'n_tokens_mistral': 1458, 'n_tokens_neox': 1338, 'n_words': 405}