how can I return 2 values from an Rspec Mock?

how can I return 2 values from an Rspec Mock?

I'm trying to mock Open3.capture2 and I want to return a string and a double for the status. Any idea how to return 2 value?

I'm trying to mock Open3.capture2 and I want to return a string and a double for the status. Any idea how to return 2 value?

code under test:

stdout, status = Open3.capture2(command)

if status.success? puts stdout else puts stdout throw "error: could not execute" end

spec:

it "throws an error" do
  status = double("status message", :success? => false)
  allow(Open3).to receive(:capture2).and_return("wat?", status)
  ScreenShotWorker.new.perform(url: "www.google.com")
  expect(Open3).to have_received(:capture2)
end


ruby-on-rails ruby

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Hire Ruby on Rails Developer | Hire RoR Developer

#1 Ruby on Rails development company. Hire Ruby on rails developer or a team to build secure, scalable and complex web solutions with a quick turnaround time.

Explain Ruby on rails MVC

Our Ruby on Rails Training will provide you to learn about Rails and web applications development with realty. Our Ruby on Rails Course also includes live sessions.

"Rewrite your Software," says Creator of Ruby on Rails

David Heinemeier Hansson is the creator of Ruby on Rails, co-founder & CTO of Basecamp, best-selling author, Le Mans class-winning race car driver, family man, frequent podcast guest, and inspirational conference speaker.

Pros & Cons you must know before using Ruby on Rails for your startup

Click here, free ruby on rails course videos for you. It shows you best way to complete Ruby certification. OnlineITGuru guides you towards easy Web script

Ruby on Rails Performance Tuning

Synchronises Assets between Rails and S3. Contribute to AssetSync/asset_sync development by creating an account on GitHub.