Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6675651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:53:02+00:00 2026-05-26T03:53:02+00:00

It seems that I cannot find much documentation on Minitest/spec so I was wondering

  • 0

It seems that I cannot find much documentation on Minitest/spec so I was wondering if somebody could help me figure out how to do what I need to do. Basically I want to run tests on all my classes and modules to make sure they 1.) Output the right value type if static or 2.) In the case of to_symbols all keys are symbols. Here is what I tried so far:

What I assume the Gherkin would look like:

Given binns
When the version method is called
then the return should be a float
and version should be a method or constant

What I assumed it would be with minitest/spec:

require 'minitest/autorun'
require 'minitest/spec'
require 'binns'

given Binns do
  when "the version method is called" do
    then "the return should be a float" do
      # Do work
    end
  end
end

But I get:

syntax error, unexpected keyword_when (SyntaxError)
  when "the version method is called" do
      ^

Note: I am also open to other suggestions for testing (I don’t know much about cucumber and heard it was hefty) or if somebody has a book suggestion, please do tell I’ve been looking for a good book on Ruby Unit Testing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:53:03+00:00Added an answer on May 26, 2026 at 3:53 am

    MiniTest/Spec uses Rspec-style syntax: desc, it, before, after…

    require 'minitest/autorun'
    require 'minitest/spec'
    require 'binns'
    
    desc Binns do
      it "should return a float when the version method is called" do
        # Do work
      end
    end
    

    If it’d make the transition easier for you, you could alias the “desc” method to “given” and “it” method to “when”.

    Good tutorial from Peter Cooper here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It seems that Microsoft wants Silverlight to take off, yet I cannot find an
I have a weird error that I cannot seem to find any documentation or
I have a relatively simple question that I cannot seem to find the answer
It seems that i cannot access $(this) inside jquery ajax success function. please see
How ASP.NET compiles its assemblies generally confuses me. It seems that I cannot program
It seems that a List object cannot be stored in a List variable in
It seems that a constructor that takes a non-const reference to an istream cannot
Intuitively, it would seems that a compiler for language Foo cannot itself be written
Agile methodologies are rather prevalent these days, but I cannot seem to find much
It seems that Visual Basic can not reference sheets according to user-modified sheet names.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.