<commit_before># RSpec::Crispy

[![Build Status](https://travis-ci.org/igrep/rspec-crispy.svg?branch=master)](https://travis-ci.org/igrep/rspec-crispy)
[![Test Coverage](https://codeclimate.com/github/igrep/rspec-crispy/badges/coverage.svg)](https://codeclimate.com/github/igrep/rspec-crispy)
[![Code Climate](https://codeclimate.com/github/igrep/rspec-crispy/badges/gpa.svg)](https://codeclimate.com/github/igrep/rspec-crispy)

Custom matchers for RSpec to call [Crispy](https://github.com/igrep/crispy)'s API.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'rspec-crispy'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install rspec-crispy

## Usage

### Use with rspec-mocks

Add `::RSpec::Crispy.configure_without_conflict config` in your `spec_helper.rb`.

```ruby
RSpec.configure do|config|
  config.mock_with(:rspec)
  ::RSpec::Crispy.configure_without_conflict config
end
```

Then, `include ::RSpec::Crispy::CrispyFeatures` in a context where you want to use the features.

```ruby
RSpec.describe YourClass do

  subject { YourClass }

  context 'use crispy' do
    include ::RSpec::Crispy::CrispyFeatures

    before do
      spy_into subject
      subject.new.hoge
    end

    it { is_expected.to have_received(:foo) }
  end

  context 'use rspec-mocks' do
    it 'calls foo' do
      expect(subject).to have_receive(:foo)
      subject.new.hoge
    end
  end<commit_msg>fix rspec-mocks sample in README<commit_after># RSpec::Crispy

[![Build Status](https://travis-ci.org/igrep/rspec-crispy.svg?branch=master)](https://travis-ci.org/igrep/rspec-crispy)
[![Test Coverage](https://codeclimate.com/github/igrep/rspec-crispy/badges/coverage.svg)](https://codeclimate.com/github/igrep/rspec-crispy)
[![Code Climate](https://codeclimate.com/github/igrep/rspec-crispy/badges/gpa.svg)](https://codeclimate.com/github/igrep/rspec-crispy)

Custom matchers for RSpec to call [Crispy](https://github.com/igrep/crispy)'s API.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'rspec-crispy'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install rspec-crispy

## Usage

### Use with rspec-mocks

Add `::RSpec::Crispy.configure_without_conflict config` in your `spec_helper.rb`.

```ruby
RSpec.configure do|config|
  config.mock_with(:rspec)
  ::RSpec::Crispy.configure_without_conflict config
end
```

Then, `include ::RSpec::Crispy::CrispyFeatures` in a context where you want to use the features.

```ruby
RSpec.describe YourClass do

  subject { YourClass }

  context 'use crispy' do
    include ::RSpec::Crispy::CrispyFeatures

    before do
      spy_into subject
      subject.new.hoge
    end

    it { is_expected.to have_received(:foo) }
  end

  context 'use rspec-mocks' do
    subject { spy("rspec's spy') }

    before { some_object.some_method(spy) }

    it 'calls foo' do
      expect(subject).to have_received(:foo)
    end
  end
{'fraction_non_alphanumeric': 0.13885135135135135, 'fraction_numerical': 0.0, 'mean_word_length': 4.185639229422066, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 14, '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': '2509176', 'n_tokens_mistral': 1113, 'n_tokens_neox': 1069, 'n_words': 215}