minitest Questions

2

Solved

I'm working on an application with 731 tests, and if 6 fail, I have to scroll through 731 lines to try and spot each failure so I can fix the problems. Is there a way for minitest to print all the ...
Carbamidine asked 21/8, 2020 at 5:46

3

I have a problem understanding the usefulness of assert_predicate in MiniTest. How is it different from assert_equal? When would one want to use this assertion? I have came across it many times but...
Chocolate asked 6/10, 2015 at 7:49

6

Solved

I want to test whether a function invokes other functions properly with minitest Ruby, but I cannot find a proper assert to test from the doc. The source code class SomeClass def invoke_function...
Gaspard asked 3/6, 2012 at 10:6

7

Solved

I have a minitest spec: it "fetches a list of all databases" do get "/v1/databases" json = JSON.parse(response.body) json.length.must_equal Database.count json.map{|d| d["id"]}.must_equal Data...
Lamia asked 2/12, 2013 at 13:22

11

Solved

I downloaded source code for a project, found a bug, and fixed it. Now I want to run tests to find out if I have broken anything. The Tests are in minitest DSL. How do I run them all at once? I...
Turanian asked 24/1, 2011 at 23:13

6

Solved

I have a ruby class like this: require 'logger' class T def do_something log = Logger.new(STDERR) log.info("Here is an info message") end end And a test script line this: #!/usr/bin/env rub...
Earhart asked 31/12, 2014 at 5:40

17

Solved

I can run all tests in a single file with: rake test TEST=path/to/test_file.rb However, if I want to run just one test in that file, how would I do it? I'm looking for similar functionality to:...
Profusion asked 12/3, 2011 at 21:45

8

Solved

I would like to have unit tests output color in my dev environment. However, I can't make it work on Linux (Debian and Ubuntu). When I include the following libs: require 'minitest/autorun' requir...
Interrelated asked 7/7, 2011 at 11:28

7

Solved

My page should contain a link that looks like <a href="/desired_path/1">Click to go</a>. How would you test for that using assert_select? I want to check for the presence of an a tag w...
Mcclendon asked 17/8, 2011 at 19:43

2

Solved

I am trying to run Minitest with Spec syntax with rake test and get this error: /path/to/gem/spec/script_spec.rb:3:in `<top (required)>': uninitialized constant MyGem (NameError) My Rakefi...
Tarra asked 14/12, 2013 at 15:36

7

I have a form_tag that generates the following HTML: <form accept-charset="UTF-8" action="http://www.example.com/product_page" id="dates_form" method="get"><div style="margin:0;padding:0;...
Sheasheaf asked 17/4, 2013 at 2:28

6

If I run test case: ruby test/models/chat_bot/option_test.rb I get error: /home/anuja/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such...
Yuille asked 20/9, 2016 at 15:32

4

Solved

I have an application and I want to test if I get correct messages from my logger. A short example (you may switch between log4r and logger): gem 'minitest' require 'minitest/autorun' require 'l...
Terebinthine asked 1/4, 2015 at 13:37

4

Solved

There are comments in the rails codebase that indicate that the test database should be reset between runs rake -T rake test:all # Run tests quickly by merging all types and not resetting db rake...
Cannell asked 12/6, 2014 at 23:54

2

Solved

Are there any differences at all between calling def setup and setup do in Rails Minitests? I had been using def setup this whole time, but I suddenly found that my setup for a particular test file...
Earing asked 14/8, 2019 at 6:17

2

Is there any way to verify a method never called or only a number of times called using Minitest::Mock Thanks in advance
Kenny asked 25/5, 2015 at 15:36

4

Solved

I need to run code before each test in all my tests in MiniTest. Before I did: MiniTest::Unit::TestCase.add_setup_hook do ...code to run before each test end After I upgraded MiniTest to versi...
Thorpe asked 20/4, 2013 at 7:57

1

Is there a reporter for minitest to generate HTML from minitest spec-runs? Or do I miss a built-in feature or flag? Rspec has formatters to generate HTML documentation, but I cannot find this for ...
Dock asked 6/8, 2014 at 13:19

4

Solved

I have an assertion in a test that looks like this: assert_equals object.sent_at, Time.now When I run this test, I keep getting an error that looks like this --- expected +++ actual @@ -1 +1 @@...
Hamper asked 4/3, 2016 at 19:1

3

Solved

I'm trying to run one of my tests, which makes a search, trying to assert the inclusion of records in the search result, but in the meantime, I'm receiving a Elasticsearch::Transport::Transport::Er...

4

Whenever I try to assert_equal two objects, I always get errors like this: No visible difference in the User#inspect output. You should look at the implementation of #== on User or its members. ...
Choker asked 24/2, 2015 at 13:53

2

Solved

I'm using MiniTest 2.12.1 (the latest version of the stock testing framework shipped with Ruby >= 1.9) and I can't figure out how to mock a class method with it, the same way it's possible with the...
Pismire asked 5/5, 2012 at 19:40

2

Solved

Hopefully a simple question for MiniTest folks.. I have a section of code which I'll condense into an example here: class Foo def initialize(name) @sqs = Aws::SQS::Client.new @id = @sqs.create...
Lexicon asked 7/5, 2015 at 2:23

1

Solved

I am trying to run some test cases using Minitest in Ruby. Here's the class that I am testing**: # square_root.rb class SquareRoot def square_root(value) return nil if value < 0 Math.sqrt(v...
Hyperpyrexia asked 27/10, 2020 at 9:28

2

Solved

I'm trying to access the instance variables inside my controllers with minitest. For example: microposts_controller.rb: def destroy p "*"*40 p @cats = 42 end How would I test the value of @c...
Dubitable asked 4/12, 2016 at 20:36

© 2022 - 2025 — McMap. All rights reserved.