<commit_before>require 'spec_helper'

describe User do

  describe "associations" do
    it { should have_many(:subscriptions) }
    it { should have_many(:comics).through(:subscriptions) }
  end

  describe "validations" do
    it { should validate_presence_of(:username) }
  end

  describe "subscriptions" do
    let(:user) { Factory(:user) }
    let(:comic) { Factory(:comic) }

    it "has no subscribed comics" do
      user.subscriptions.should be_empty
    end

    it "can subscribe to a comic" do
      expect {
        user.subscribe!(comic)
      }.to change { user.subscriptions.count }.by(1)
    end

    it "cannot subscribe to the same comic twice" do
      user.subscribe!(comic)
      expect {
        user.subscribe!(comic)
      }.to_not change { user.subscriptions.count }
    end
  end
end<commit_msg>Update syntax of expect in User spec<commit_after>require 'spec_helper'

describe User do

  describe "associations" do
    it { should have_many(:subscriptions) }
    it { should have_many(:comics).through(:subscriptions) }
  end

  describe "validations" do
    it { should validate_presence_of(:username) }
  end

  describe "subscriptions" do
    let(:user) { Factory(:user) }
    let(:comic) { Factory(:comic) }

    it "has no subscribed comics" do
      user.subscriptions.should be_empty
    end

    it "can subscribe to a comic" do
      expect {
        user.subscribe!(comic)
      }.to change(user.subscriptions, :count).by(1)
    end

    it "cannot subscribe to the same comic twice" do
      user.subscribe!(comic)
      expect {
        user.subscribe!(comic)
      }.to_not change(user.subscriptions, :count)
    end
  end
end
{'fraction_non_alphanumeric': 0.10077984403119376, 'fraction_numerical': 0.0011997600479904018, 'mean_word_length': 2.9247058823529413, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7116252', 'n_tokens_mistral': 532, 'n_tokens_neox': 505, 'n_words': 146}