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...
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...
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...
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...
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...
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
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...
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 ...
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...
Crudity asked 28/9, 2018 at 20:58
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.
...
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...
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
1 Next >
© 2022 - 2025 — McMap. All rights reserved.