<commit_before>require 'rails_helper'

RSpec.describe UserDeposit do
  describe '#call' do
    let(:user) {create(:user, balance: 1000)}
    let(:interactor) {UserDeposit.new(user_id: user.id, amount: 1000)}
    let(:context) {interactor.context}

    it 'succeeds' do
      interactor.call
      expect(context).to be_a_success
    end

    it 'updates the user\'s balance' do
      expect {interactor.call && user.reload}.to change(user, :balance).
        from(1000).to(2000)
    end

    it 'creates a transaction' do
      expect {interactor.call}.to change(Transaction, :count).by(1)
    end
  end<commit_msg>Add a context for user_deposit specs<commit_after>require 'rails_helper'

RSpec.describe UserDeposit do
  describe '#call' do
    let(:user) {create(:user, balance: 1000)}
    let(:interactor) {UserDeposit.new(user_id: user.id, amount: 1000)}
    let(:context) {interactor.context}

    context 'when everything is swell' do
    it 'succeeds' do
      interactor.call
      expect(context).to be_a_success
    end

    it 'updates the user\'s balance' do
      expect {interactor.call && user.reload}.to change(user, :balance).
        from(1000).to(2000)
    end

    it 'creates a transaction' do
      expect {interactor.call}.to change(Transaction, :count).by(1)
    end
    end
  end
{'fraction_non_alphanumeric': 0.11972371450498849, 'fraction_numerical': 0.026093630084420567, 'mean_word_length': 3.3036303630363038, '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': '5699152', 'n_tokens_mistral': 465, 'n_tokens_neox': 417, 'n_words': 111}