<commit_before>require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')



describe SettingsController do
  include SocialStream::TestHelpers
  render_views

  it "should render index" do
    get :index
    assert_response :success
  end

  it "should render index after update_all" do
    put :update_all
    response.should redirect_to settings_path
  end

describe "Notification settings" do
    before do
      @user = Factory(:user)
      @actor = @user.actor
      sign_in @user
    end

    it "update notification email settings to Never" do
      @actor.update_attribute(:notify_by_email, true)
      assert @actor.notify_by_email.should
      put :update_all, :settings_section => "notifications", :notify_by_email => "never"
      response.should redirect_to settings_path
      assert ! @actor.notify_by_email.should

    end

    it "update notification email settings to Always" do
      @actor.update_attribute(:notify_by_email, false)
      assert ! @actor.notify_by_email.should
      put :update_all, :settings_section => "notifications", :notify_by_email => "always"
      response.should redirect_to settings_path
      assert @actor.notify_by_email.should
    end
  end
end<commit_msg>Fixing settings tests<commit_after>require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe SettingsController do
  include SocialStream::TestHelpers
  render_views

  before do
    @user = Factory(:user)
    @actor = @user.actor
    sign_in @user
  end

  it "should render index" do
    get :index
    assert_response :success
  end

  it "should render index after update_all" do
    put :update_all
    response.should redirect_to settings_path
  end

  describe "Notification settings" do
    it "update notification email settings to Never" do
      @actor.update_attributes(:notify_by_email => true)
      @actor.notify_by_email.should==true
      put :update_all, :settings_section => "notifications", :notify_by_email => "never"
      @actor.reload
      @actor.notify_by_email.should==false

    end

    it "update notification email settings to Always" do
      @actor.update_attributes(:notify_by_email => false)
      @actor.notify_by_email.should==false
      put :update_all, :settings_section => "notifications", :notify_by_email => "always"
      @actor.reload
      @actor.notify_by_email.should==true
    end
  end
end
{'fraction_non_alphanumeric': 0.08494533221194281, 'fraction_numerical': 0.0, 'mean_word_length': 3.6374269005847952, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '5098064', 'n_tokens_mistral': 700, 'n_tokens_neox': 685, 'n_words': 183}