Skip to content

Commit

Permalink
Fix spec
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasdundacek committed Jan 11, 2025
1 parent 09a9d61 commit d7ccf3b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
4 changes: 3 additions & 1 deletion lib/flatware/rspec/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ def rspec(*rspec_args)
start_sink(jobs: jobs, workers: workers, formatter: formatter)
end

private

def formatter
@formatter ||= begin
formatter_klass = "Flatware::RSpec::Formatters::#{options[:formatter].capitalize}".constantize
formatter_klass = Flatware::RSpec::Formatters.const_get(options[:formatter].capitalize)

formatter_klass.new(
::RSpec.configuration.output_stream,
Expand Down
18 changes: 15 additions & 3 deletions spec/flatware/rspec/formatter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,25 @@
context 'when example_passed' do
it "sends a 'passed' progress message to the sink client" do
formatter = described_class.new StringIO.new
example = double 'Example'
example = double 'Example', full_description: 'example description',
location: 'here',
location_rerun_argument: 'here[1]',
metadata: {},
execution_result: double(
'Execution result',
status: :passed,
exception: nil,
finished_at: Time.now,
run_time: 0.1,
started_at: Time.now - 0.1
)
notification = double 'Notification', example: example
client = double 'Client', progress: true
Flatware::Sink.client = client
formatter.example_passed example
formatter.example_passed notification

expect(client).to have_received(:progress).with anything do |message|
expect(message.progress).to eq :passed
expect(message.example.execution_result.status).to eq :passed
true
end
end
Expand Down

0 comments on commit d7ccf3b

Please sign in to comment.