Sha256: e3e3b94d7cf19063f703189f2b0b763d6e34aca5eefc0f8e83905d10967b6362

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

describe SimpleBlacklist do
  before(:all) do
    @setup = SimpleBlacklist::Setup.new
    @setup.configure
    require @setup.initializer_file
  end

  after(:all) do
    FileUtils.rm_rf @setup.config_dir
  end

  it 'has a version number' do
    expect(SimpleBlacklist::VERSION).not_to be nil
  end

  describe "#sanitize" do

    subject(:text_simple) { 'kiss my ass' }
    it 'a word contained in the blacklist is replaced' do
      expect(SimpleBlacklist.sanitize(text_simple)).to eq('kiss my ****')
    end

    subject(:text_special_char) { 'kiss my @$$' }
    it 'a word written with special characters is replaced' do
      expect(SimpleBlacklist.sanitize(text_special_char)).to eq('kiss my ****')
    end

    subject(:text_with_word_like) { 'kiss my ass assassin' }
    it 'a similar word (not contained in the blacklist) can not be replaced' do
      expect(SimpleBlacklist.sanitize(text_with_word_like)).to eq('kiss my **** assassin')
    end

    subject(:text_special_char_with_word_like) { 'kiss my @$$ @$$assin' }
    it 'a similar word with special characters (not contained in the blacklist) can not be replaced' do
      expect(SimpleBlacklist.sanitize(text_special_char_with_word_like)).to eq('kiss my **** @$$assin')
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_blacklist-0.2.0 spec/simple_blacklist_spec.rb