Skip to content

Commit

Permalink
Add DataSource specs
Browse files Browse the repository at this point in the history
  • Loading branch information
borama committed Jun 7, 2024
1 parent 6dcf4a0 commit f6ef398
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
21 changes: 21 additions & 0 deletions spec/lib/dump_cleaner/cleanup/data_source_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

require "spec_helper"

RSpec.describe DumpCleaner::Cleanup::DataSource do
describe "#data_for" do
it "creates an initial step_context and runs the workflow" do
workflow_double = instance_double(DumpCleaner::Cleanup::Workflow)
expect(DumpCleaner::Cleanup::Workflow).to receive(:new).and_return(workflow_double)

step_context = DumpCleaner::Cleanup::StepContext.new(type: "some_type", cleanup_data: %w[a b c])
expect(workflow_double).to receive(:run).and_return(step_context)

config_double = instance_double(DumpCleaner::Config)
allow(config_double).to receive(:steps_for).and_return([])

result = described_class.new(config: config_double).data_for("some_type")
expect(result).to eq(%w[a b c])
end
end
end
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@

# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!

config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
end

0 comments on commit f6ef398

Please sign in to comment.