Skip to content

Commit 50f666b

Browse files
committed
Fix spec
1 parent dd9ca4a commit 50f666b

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

lib/flatware/rspec/cli.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ def rspec(*rspec_args)
2323
start_sink(jobs: jobs, workers: workers, formatter: formatter)
2424
end
2525

26+
private
27+
2628
def formatter
2729
@formatter ||= begin
28-
formatter_klass = "Flatware::RSpec::Formatters::#{options[:formatter].capitalize}".constantize
30+
formatter_klass = Flatware::RSpec::Formatters.const_get(options[:formatter].capitalize)
2931

3032
formatter_klass.new(
3133
::RSpec.configuration.output_stream,

spec/flatware/rspec/formatter_spec.rb

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,25 @@
55
context 'when example_passed' do
66
it "sends a 'passed' progress message to the sink client" do
77
formatter = described_class.new StringIO.new
8-
example = double 'Example'
8+
example = double 'Example', full_description: 'example description',
9+
location: 'here',
10+
location_rerun_argument: 'here[1]',
11+
metadata: {},
12+
execution_result: double(
13+
'Execution result',
14+
status: :passed,
15+
exception: nil,
16+
finished_at: Time.now,
17+
run_time: 0.1,
18+
started_at: Time.now - 0.1
19+
)
20+
notification = double 'Notification', example: example
921
client = double 'Client', progress: true
1022
Flatware::Sink.client = client
11-
formatter.example_passed example
23+
formatter.example_passed notification
1224

1325
expect(client).to have_received(:progress).with anything do |message|
14-
expect(message.progress).to eq :passed
26+
expect(message.example.execution_result.status).to eq :passed
1527
true
1628
end
1729
end

0 commit comments

Comments
 (0)