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
2 answers

Minitest logger outputting more information than I want

I'm using Minitest with my Sinatra application to do TDD. Every time I run my test I see the database transactions (below) plus the actual test result (not shown). How can I keep it from showing the database transactions. Started with run options…
Bhushan Lodha
  • 6,824
  • 7
  • 62
  • 100
0
votes
1 answer

how to call a method immediately before the start of a test run in minitest

I have the following scenario in testing a large, distributed system via end-to-end tests: Class A < Minitest::Spec before do # stuff setup_runtime_environment end end Class B < Class A before do # stuff end end Class C…
dax
  • 10,779
  • 8
  • 51
  • 86
0
votes
1 answer

Get number of assertions in rails application

We are working on migrating Rails application from 2.3 to 3. The tests are written using minitest. There are many errors in the tests itself so as we fix some errors, we have more number of assertions to test. We would have correct number of…
Amit Patel
  • 15,609
  • 18
  • 68
  • 106
0
votes
1 answer

Is it worth trying to reuse test fixtures as much as possible?

I have to work with Rails fixtures on an existing project. Switching to FactoryGirl or the like is not an option. In my fixtures I normally have some generic once (records that would appear most often in the production database) plus a fair portion…
sakovias
  • 1,356
  • 1
  • 17
  • 26
0
votes
1 answer

Ruby minitest test output of method that requires user input

RESOLVED Question 1: I want to write a test for file_choice_reader in the following class. The class prints a list of files of certain types to command line and lets the user choose one by typing in the index number. class File_chooser …
enahel
  • 355
  • 3
  • 15
0
votes
1 answer

How do I make a Capybara Rails TestCase run as a single transaction?

I have a rails app that includes a blog feature. In one single feature test (using Capybara::Rails::TestCase, with ruby tests (asserts/refutes) i.e, not spec) for the blog, I want to test adding a post, adding comments, editing the post, etc. as…
Anand
  • 3,690
  • 4
  • 33
  • 64
0
votes
1 answer

Shoulda context and syntax, ruby 2.1

The following code doesn't compile in ruby 2.1 on OS X. The error message is quite strange: /Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/rake_test_loader.rb:10:in `require': …
jayunit100
  • 17,388
  • 22
  • 92
  • 167
0
votes
2 answers

IntelliJ with Ruby on Rails plugin gives warnings about "not able to find route path" when coding tests using built in mini-test framework

I am new to web dev and Ruby on Rails. I chose IntelliJ(13.1.5) with ruby plugins since I also have worked with Java apps for many years for saving a lot of typing. I am trying out rails built-in mini-test framework these days and I have trouble…
0
votes
2 answers

Undefined method `get' in Minitest

I'm trying to create a functional test for my RESTful API with MiniTest: require 'test_helper' class AutomaticTests < ActiveSupport::TestCase test "test1" do get '/' end end The code above triggers an error: Minitest::UnexpectedError:…
Sergey
  • 47,222
  • 25
  • 87
  • 129
0
votes
1 answer

minitest-rails - test:helpers - NameError: Unable to resolve controller for ApplicationHelper

I have strange error when i run my tests for helpers with rake test:helpers ApplicationHelper::dummy#test_0001_must return string: NameError: Unable to resolve controller for ApplicationHelper::dummy Test: require "test_helper" describe…
rootatdarkstar
  • 1,486
  • 2
  • 15
  • 26
0
votes
1 answer

Ruby load module in test

I am running a padrino application and have started with the included mailers. I want to test that a mail is sent and had previously had no trouble accessing the Mail::TestMailer object to look at the mails delivered during the test. That is the…
Peter Saxton
  • 4,466
  • 5
  • 33
  • 51
0
votes
1 answer

The correct place to put the test of a signup page - Minitest

I need to write a test to check if the title of Signup page is correct. I'm stuck between two places that I can places the test: Inside users_controller_test.rb using: class UsersControllerTest < ActionController::TestCase test "should get new"…
Sajad Rastegar
  • 3,014
  • 3
  • 25
  • 36
0
votes
1 answer

Rails 4 minitest failed for update action

Im using Rails 4.1.6 and Ruby 2.1.3 my update method in bookmarks_controller.rb def update service = UpdateBookmark.new(params[:id], params[:bookmark]) if service.update head 204 else head 422 end end and this is my…
junior
  • 808
  • 15
  • 25
0
votes
1 answer

Create a class instance from string when files containing class are 'required' run-time in Ruby?

I am writing some test cases in ruby using Minitest FW. In the setup routine, I try to require all the ruby files which have the classes of which I wish to create instances (by string name) in each test case. I get the error saying uninitialized…
0
votes
1 answer

Count; find User with id= Minitest

I am following Michael Hartl's Ruby on Rails tutorial and I am not sure why I am getting this Error when according to the tutorial everything should pass: 1) Error: UsersControllerTest#test_should_get_show: ActiveRecord::RecordNotFound: Couldn't…
Liondancer
  • 15,721
  • 51
  • 149
  • 255