<commit_before>
= Socialcast Shoulda Extensions
Adds new matchers and functionality to the shoulda test library

= Matchers

== RecordCountChangeMatcher
Test if the count for a model has changed, and by how much.  Requires the context_with_matcher_before_hooks patch, which is included by default.

Provides the following matcher methods:

- create_record(klass_or_symbol)
  Alias for change_record_count.for(klass_or_symbol).by(1)

- create_records(klass_or_symbol, amount)
  Alias for change_record_count.for(klass_or_symbol).by(amount)

- destroy_record(klass_or_symbol)
  Alias for change_record_count.for(klass_or_symbol).by(-1)

- destroy_records(klass_or_symbol, amount) 
  Alias for change_record_count.for(klass_or_symbol).by(-amount)

- change_record_count
  Tests the difference in record count before and after the current setup/subject block
  Can be used with the follow methods:
  - for(klass_or_symbol)
    Provides the class which the test is being performed on.  Can be a constant or a symbol

  - by(amount)
    Provides an expected difference for the number of records for the specified class.
    Excluding this number will allow the matcher to check for any difference<commit_msg>Added installation instructions in README<commit_after>
= Socialcast Shoulda Extensions
Adds new matchers and functionality to the shoulda test library

= Installation

In your Gemfile:

  group :test do
    gem 'socialcast_shoulda_ext', :git => '<EMAIL>:socialcast/socialcast-shoulda-ext.git', :require => 'shoulda_ext'
  end

= Matchers

== RecordCountChangeMatcher
Test if the count for a model has changed, and by how much.  Requires the context_with_matcher_before_hooks patch, which is included by default.

Provides the following matcher methods:

- create_record(klass_or_symbol)
  Alias for change_record_count.for(klass_or_symbol).by(1)

- create_records(klass_or_symbol, amount)
  Alias for change_record_count.for(klass_or_symbol).by(amount)

- destroy_record(klass_or_symbol)
  Alias for change_record_count.for(klass_or_symbol).by(-1)

- destroy_records(klass_or_symbol, amount) 
  Alias for change_record_count.for(klass_or_symbol).by(-amount)

- change_record_count
  Tests the difference in record count before and after the current setup/subject block
  Can be used with the follow methods:
  - for(klass_or_symbol)
    Provides the class which the test is being performed on.  Can be a constant or a symbol

  - by(amount)
    Provides an expected difference for the number of records for the specified class.
    Excluding this number will allow the matcher to check for any difference
{'fraction_non_alphanumeric': 0.05753739930955121, 'fraction_numerical': 0.0015343306482546988, 'mean_word_length': 5.0510440835266825, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 0, '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': '1292980', 'n_tokens_mistral': 767, 'n_tokens_neox': 771, 'n_words': 269}