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

Is there a "should" minitest gem?

I would like to use fluent assertions type of syntax with minitest result.should_be "my result" result.should_be_true result.should_contain "foo" Is there some gem that adds this functionality? My request come from a similar idea in C#.
David MZ
  • 3,648
  • 6
  • 33
  • 50
0
votes
3 answers

uniqueness test on minitest

I use minitest on Ruby on Rails. Below is my model. require 'mongoid' class Person include Mongoid::Document index({ pin: 1 }, { unique: true, name: "pin_index" }) field :first_name field :last_name field :pin validates :pin, …
miyamotomusashi
  • 531
  • 7
  • 22
0
votes
1 answer

Why does integration minitest spec with capybara return true for .present? when no rows in db

I am running Rails 3.2.11 and believe I have minitest spec and capybara installed and working correctly through my gem file and test_helper.rb I have the following integration test: describe "Products integration" do fixtures :users, :businesses …
Marklar
  • 1,247
  • 4
  • 25
  • 48
0
votes
1 answer

testing a method's parameter

How can I test a method's parameter? def create_person child end Above code is my method. It takes a parameter named "child". I try to test this parameter. So, if method doesn't take parameter, test will give me error. I use minitest and Ruby on…
miyamotomusashi
  • 531
  • 7
  • 22
0
votes
1 answer

Rake task with minitest-spec-rails gem

I have been using the minitest-rails gem, and everything works great when I run: rake minitest:models However, I recently switched to the minitest-spec-rails gem, and when I run that same command I get this error: "Don't know how to build task…
hellion
  • 4,602
  • 6
  • 38
  • 77
0
votes
0 answers

Rails has_many and belongs_to on same model

I have a School model that has_many :users. But, each school also has a primary_user. Here is my model: has_many :users belongs_to :primarycontact, :class_name => "User" This works fine in my my production and dev app, but it raises stack level…
hellion
  • 4,602
  • 6
  • 38
  • 77
0
votes
1 answer

Equivalent of should be_true in minitest

I would like to know the equivalent of: event.should be_live in Minitest? The method I am testing is: event.live? At the moment I am using: conf.live?.must_equal true But it looks to me quite contrived.
rtacconi
  • 14,317
  • 20
  • 66
  • 84
0
votes
1 answer

Testing a ruby block with minitest

What would be the best way of testing a Ruby block with minitest. Rspec seems to have a set of yield matchers. Is there something similar in minitest
Indika K
  • 1,332
  • 17
  • 27
0
votes
1 answer

minitest racktest

Does anybody have any examples of using minitest and reacktest together to create request specs? I want to be able to request a resource: get '/api/resource', format: :json And then test the response.
dagda1
  • 26,856
  • 59
  • 237
  • 450
0
votes
1 answer

Loading miniskirt with Spork TestUnit

I really like Miniskirt and Minitest but I am having issues loading the factories.rb file on each run using spork server. It goes: cannot load such file -- factories (LoadError) My factories.rb file is located in the /test directory along with my…
chourobin
  • 4,004
  • 4
  • 35
  • 48
0
votes
1 answer

htmp post in rails minitest

I would like to post an xml to a controller from minitest. The way how it works in normal mode is this: curl -X POST -H "Content-Type: text/xml" -d "@/Users/boti/Rails/clients/kevin/search_server/db/search.xml" localhost:3000/search I tried by doing…
Boti
  • 3,275
  • 1
  • 29
  • 54
0
votes
1 answer

rails3 minitest bundle update give me register_spec_type undefined method

I'm just trying to get into testing an tried minitest. I finally got something working patterning after a Railscast, but tests were running twice. Saw something that said to do a bundle update. That led to several problems that I have cleared up…
appleII717
  • 328
  • 3
  • 12
0
votes
1 answer

it-block does not accept extra javascript argument anymore

I got a strange problem with minitest and capybara. I am using rails 3.2.8 and test with minitest/capybara/poltergeist. Until now every went fine. I always could test my javascript stuff. For a new project I downloaded rails 4 to get into it a…
0
votes
0 answers

verbouse assertions with Test::Unit (minitest?) in ruby 1.9

I'm in the middle of the upgrade of my application. I want to move from ruby 1.8 to 1.9 and from rails 3.0 to 3.2 (right now I run ruby 1.9 and RoR 3.2). I have problems with my tests: the output is vague and not very helpful. For example for…
mrzasa
  • 22,895
  • 11
  • 56
  • 94
0
votes
1 answer

Why is mocha not stubbing this method in my Rails 3 integration test?

I have the following: setup do Capybara.current_driver = Capybara.javascript_driver @project.user = @user @project.save Project.any_instance.stubs(:price_all) end And yet I have a test failing because the Project.price_all…
croceldon
  • 4,511
  • 11
  • 57
  • 92
1 2 3
99
100