Questions tagged [minitest]

a testing framework that comes in the standard library of Ruby 1.9.

Minitest provides a complete suite of testing facilities supporting TDD, BDD, mocking, and benchmarking. When making assertions in Cucumber step definitions, there are a few different libraries you could choose. MiniTest is one of the candidates.

MiniTest’s assertions are built into Ruby, which makes them a handy tool to reach for. They use a style of assertion that you’ll be familiar with if you’re used to making assertions in any xUnit testing framework.


Resources

1539 questions
0
votes
1 answer

Why is my Pundit Policy minitest test case not running with rake test?

I am using Rails 4.1 and the Pundit gem. I created a UserPolicyTest class for my UserPolicy class. But when I run rake test, none of the tests in the class get run. I'm also trying to use mini-test. I cannot find any documentation on what the parent…
Mike F.
  • 69
  • 1
  • 9
0
votes
1 answer

How to build task 'minitest'

I'm trying to run minitest. I followed a few videos on how to get it running, but none of them seem to get me around this message Don't know how to build task 'minitest' I think I must be missing a step or gem or something that the videos don't…
baash05
  • 4,394
  • 11
  • 59
  • 97
0
votes
1 answer

Tests skipped after Rails upgrade

After upgrading from Rails 4.0.3 to Rails 4.1.0.rc1 test classes which inherit from ActiveSupport::TestCase stopped being executed. We use shoulda contexts in all our tests. MiniTest was upgraded from 4.7.5 to 5.3.0. Any ideas?
user882027
  • 57
  • 1
  • 6
0
votes
1 answer

Wanted: Most elegant way to code an anonymous class for mocking

I'm mocking part of the Net::SFTP for my tests. The following mimicks dir.entries, entry.name and entry.attributes.size by reading locally from fixture_path: class MockedSFTP mattr_accessor :fixture_path def dir Class.new do def…
svoop
  • 3,318
  • 1
  • 23
  • 41
0
votes
1 answer

Minitest: Testing for Infinity

I am trying to create a Minitest test that tests for an instance of Infinity being returned in an array. However I am getting an uninitialized constant error. How do I check for Infinity in an array? This is the test: def test_lgamma x = 0 z =…
fmorales
  • 149
  • 11
0
votes
1 answer

testing with minitest and capybara rails undefined method `node_name' for nil:NilClass

I was running a test and I got the error undefined method `node_name' for nil:NilClass. I added some javascript to one of my files so that instead of going to the new page when you want to make a new post it provides a popup with the form for…
user2785628
0
votes
1 answer

minitest handler timing issue

Just to start out, I am extremely new to testing my cookbooks. I've been working in cookbooks for a couple of months now and understand things fairly well, but our project has been very lax in adding testing. I'm attempting to drag us into testing…
timepieces141
  • 503
  • 4
  • 7
0
votes
1 answer

user must_send with a method that calls super in minitest

Lets say I have the following module: module SillyDemo class Monkey def screech(sound) sound end end class Ape < Monkey def process(sound) sound end def screech(sound) process(sound) …
Abraham P
  • 15,029
  • 13
  • 58
  • 126
0
votes
1 answer

guard-minitest does not find tests to execute when class under test changes

I created a Gem project and added minitest and guard to the dependencies : spec.add_development_dependency "minitest", "~> 5.0.7" spec.add_development_dependency 'guard-minitest' I'm using minitest-spec so all code under test resides in the lib…
Jef
  • 5,424
  • 26
  • 28
0
votes
2 answers

Minitest undefined method for OptionParser class

After including a module in spec_helper, I am running Minitest spec for a class inside that module and get this error: test_0001_must be true for option name(MyGem::OptionParser::option?): NoMethodError: undefined method `option?' for…
leemour
  • 11,414
  • 7
  • 36
  • 43
0
votes
1 answer

testing with minitest capybara rails link not found

I'm currently testing with minitest capybara and I got an error on one of my tests Unable to find link or button "Edit Profile" here is my test require "test_helper" feature "as a student I want a working user system so grade = good" do scenario…
user2785628
0
votes
1 answer

LoadError when using a Minitest extension from one vendored gem in another vendored gem

I have a problem with two vendored gems of a Rails 3.2 app. One gem is a Minitest extension, the other a piece of code which should use the Minitest extension in it's test suite. Since both are under development, both are vendored and not yet pushed…
svoop
  • 3,318
  • 1
  • 23
  • 41
0
votes
2 answers

chef-client start fails minitest using vagrant and test kitchen

I'm playing around to try and get minitests working in test kitchen with vagrant. My own tests succeed but the chef-client cookbook includes a test to start the chef-client which fails the test run. The reason why the chef-client start fails is…
philbert
  • 478
  • 4
  • 15
0
votes
1 answer

How can I check within program whatever tests (written using MiniTest gem) are passing?

I want to end with something like Tests = run_tests() if !Tests.passed puts Tests.errors exit end start_function_running_for_a_long_time_using_now_verified_code()
Bulwersator
  • 1,102
  • 2
  • 12
  • 30
0
votes
1 answer

How can I run MiniTest tests before running normal code in the file?

I want to change my following code load "API.rb" require 'minitest/spec' require 'minitest/autorun' class Test < MiniTest::Unit::TestCase MiniTest::Assertions.diff = nil def setup end def test_character_detection assert_equal…
Bulwersator
  • 1,102
  • 2
  • 12
  • 30