Commit b6ee8455 by John Doe

refactored service to agent

parent 1683ca9e
# frozen_string_literal: true
# Service class for DbFolders
class DbFolderService
# Agent class for DbFolders
class DbFolderAgent
attr_accessor :error_msg
def initialize(db_service:, db_builder:)
......
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'DbFileService' do
RSpec.describe 'DbFolderAgent' do
describe 'insert_file' do
# mock the DbService and DbBuilder
let(:db_service) { double(create_file: true) }
......@@ -12,9 +12,9 @@ RSpec.describe 'DbFileService' do
let(:parent_folder) { FactoryGirl.build_stubbed(:db_folder) }
it 'adds the given file to the folder' do
db_folder_service = DbFolderService.new(db_service: db_service,
db_folder_agent = DbFolderAgent.new(db_service: db_service,
db_builder: db_builder)
db_folder_service.insert_file(folder: parent_folder, file: new_file)
db_folder_agent.insert_file(folder: parent_folder, file: new_file)
expect(new_file.db_folder).to eq(parent_folder)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment