<commit_before>require 'spec_helper'

describe Notifiable::NotifierBase do

  describe "#test_env?" do
    let(:notifiable_app) { FactoryGirl.create(:app, :configuration => {:configurable_mock => {:use_sandbox => true}}) }
    let(:notification) { FactoryGirl.create(:notification, :app => notifiable_app) }
    subject(:notifier) { ConfigurableMockNotifier.new(Rails.env, notification) }
    
    before(:each) { ConfigurableMockNotifier.send(:public, *ConfigurableMockNotifier.protected_instance_methods) }  

    it { expect(notifier.test_env?).to eq true }
  end
  
  describe "#processed" do
    let(:notifiable_app) { FactoryGirl.create(:app, :configuration => {:configurable_mock => {:use_sandbox => true}}) }
    let(:notification) { FactoryGirl.create(:notification_with_en_localization, :app => notifiable_app) }
    
    let(:device_token1) { FactoryGirl.create(:device_token, :app => notifiable_app, :locale => :en) }
    let(:device_token2) { FactoryGirl.create(:device_token, :app => notifiable_app, :locale => :en) }
    let(:device_token3) { FactoryGirl.create(:device_token, :app => notifiable_app, :locale => :en) }
    
    subject(:notifier) { ConfigurableMockNotifier.new(Rails.env, notification) }
    
    before(:each) do
      ConfigurableMockNotifier.send(:public, *ConfigurableMockNotifier.protected_instance_methods)
      
      Notifiable.notification_status_batch_size = 2
      notifier.processed(device_token1, 0)
      notifier.processed(device_token2, 0)
    end

    it { expect(Notifiable::NotificationStatus.count).to eq 2 }
  end
  
  
end

class ConfigurableMockNotifier < Notifiable::NotifierBase
  attr_accessor :use_sandbox
end<commit_msg>Update spec<commit_after>require 'spec_helper'

describe Notifiable::NotifierBase do

  describe "#test_env?" do
    let(:notifiable_app) { FactoryGirl.create(:app, :configuration => {:configurable_mock => {:use_sandbox => true}}) }
    let(:notification) { FactoryGirl.create(:notification, :app => notifiable_app) }
    subject(:notifier) { ConfigurableMockNotifier.new(Rails.env, notification) }
    
    before(:each) { ConfigurableMockNotifier.send(:public, *ConfigurableMockNotifier.protected_instance_methods) }  

    it { expect(notifier.test_env?).to eq true }
  end
  
  describe "#processed" do
    let(:notifiable_app) { FactoryGirl.create(:app, :configuration => {:configurable_mock => {:use_sandbox => true}}) }
    let(:notification) { FactoryGirl.create(:notification_with_en_localization, :app => notifiable_app) }
    
    let(:device_token1) { FactoryGirl.create(:device_token, :app => notifiable_app, :locale => :en) }
    let(:device_token2) { FactoryGirl.create(:device_token, :app => notifiable_app, :locale => :en) }
    let(:device_token3) { FactoryGirl.create(:device_token, :app => notifiable_app, :locale => :en) }
    
    subject(:notifier) { ConfigurableMockNotifier.new(Rails.env, notification) }
    
    before(:each) do
      ConfigurableMockNotifier.send(:public, *ConfigurableMockNotifier.protected_instance_methods)
      
      Notifiable.notification_status_batch_size = 2
      notifier.processed(device_token1, 0)
      notifier.processed(device_token2, 0)
    end

    it { expect(Notifiable::NotificationStatus.count).to eq 2 }
    it { expect(notification.sent_count).to eq 2 }
    
  end
  
  
end

class ConfigurableMockNotifier < Notifiable::NotifierBase
  attr_accessor :use_sandbox
end
{'fraction_non_alphanumeric': 0.12521942656524282, 'fraction_numerical': 0.005558806319485079, 'mean_word_length': 4.905008635578584, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, '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': '647068', 'n_tokens_mistral': 1091, 'n_tokens_neox': 1037, 'n_words': 176}