foneandrew / ruby-spec-runner

Run specific rspec & minitest tests from within vscode
MIT License
9 stars 3 forks source link

Support custom test block method #9

Open hotrungnhan opened 9 months ago

hotrungnhan commented 9 months ago

Hello, @team I appreciate that your guy creating this helpful plugin. That saves me a ton of time to run each test once.

To create the swagger doc, I utilized the https://github.com/rswag/rswag rswag extensions, which call for the addition of a test file.

However, this plugin is not customizable to identify the "response" block to exec them. I hope you can improve it to make it better. Example :

RSpec.describe 'example_apis' do
  path '/example_apis' do
[run,debug] <---- it should be here.
    get('list example_apis') do
      response(200, 'successful') do
        after do |example|
          example.metadata[:response][:content] = {
            'application/json' => {
              example: JSON.parse(response.body, symbolize_names: true)
            }
          }
        end
[run,debug] <---- it should be here.
        run_test!
      end
    end
  end
foneandrew commented 5 months ago

Oh wow I completely missed this post sorry!

On one hand I am not keen on adding support for rspec DSL extensions cause that seems like a whole can of worms. On the other hand I can see it being helpful to add your own matchers for where a run prompt should live.

Are you able to provide me with some output examples of how it works? So for the lines with get('list example_apis') do and run_test! are you able to: