Skip to content

Commit

Permalink
fix spec
Browse files Browse the repository at this point in the history
  • Loading branch information
alpaca-tc committed Jun 20, 2024
1 parent 4671dde commit a8f4484
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/diver_down/web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,24 @@ def call(env)

def load_definition_files_on_thread(definition_files)
definition_loader = DiverDown::Web::DefinitionLoader.new
store = self.class.store

Thread.new do
loop do
break if definition_files.empty?

# If store is changed in test, stop loading.
break if store != self.class.store

definition_file = definition_files.shift
definition = definition_loader.load_file(definition_file)

# No needed to synchronize because this is executed on a single thread.
self.class.store.set(definition)
store.set(definition)
end

# Cache combined_definition
self.class.store.combined_definition
store.combined_definition
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/diver_down/web_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def assert_definition_group(definition_group, expected_ids)
expect(JSON.parse(last_response.body)).to eq({
'total' => 0,
'loaded' => 0,
})
}), -> { binding.irb }
end

it 'returns loaded size if definition files exist' do
Expand Down

0 comments on commit a8f4484

Please sign in to comment.