Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling invoke directly in RSpec breaks with required class_options, even when they are provided. #811

Open
WriterZephos opened this issue Feb 10, 2023 · 0 comments

Comments

@WriterZephos
Copy link

I am trying to test my Thor tasks and running into an issue. I have the following option defined on my Thor class:

class_option :file_path, required: true, type: :string, aliases: :f

and in my tests I have:

  let(:options){
    {
      :file_path => "v_1.0.0/chapter_1/content.md"
    }
  }
  
  ...
  
  
    it "does a dry run render of html" do
      expect{ ::MyThorTask.new.invoke(:foo, [], options) }.to output(...).to_stdout
    end

Which give me this error:

     Thor::RequiredArgumentMissingError:
       No value provided for required options '--file-path'

But I can run the Thor task in the terminal just fine, so I think there is something broken with invoke.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant