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

Watir / MiniTest - Undefined local variable or method 'browser'

I have 66 watir scripts that I have been creating over the past week to automate testing on the clients website. However I have recently found out about a test framework called MiniTest which I am trying to implement now. The reason I have set the…
CustomNet
  • 732
  • 3
  • 12
  • 31
0
votes
1 answer

Rails / Zeus: "MiniTest v5.0.8 is out of date" error

I recently set up Zeus and Minitest for testing a Rails app. However, I got the following error: leo% zeus test /Users/leo/.rvm/gems/ruby-1.9.3-p125@backscratchers/gems/turn-0.9.6/lib/turn/minitest.rb:23:in `': MiniTest v5.0.8 is out…
Leo
  • 4,217
  • 4
  • 25
  • 41
0
votes
2 answers

Unit Testing updating a mongoid field using rr

I am trying to unit test the following code: require 'mongoid' class Seller include Mongoid::Document field :updated_at, type: Time def update_updated_at updated_at = Time.now save end end Here is my attempt describe Seller do …
zhon
  • 1,610
  • 1
  • 22
  • 31
0
votes
1 answer

Test passes with `testrb`, but crashes using Rails `rake test`?

I have a simple test to check that a carrierwave uploader works. I use minitest for this, and the test works when run on its own, but not under Rails’s rake test... environment. (Code for the test is included below.) Things that work: If I run ruby…
Leo
  • 4,217
  • 4
  • 25
  • 41
0
votes
1 answer

Rails Minitest not running a test class

I have 2 controllers with the same name but in different folders. The first is in "controllers" the other one is in the "controllers/api/v1". The first is running smoothly but the latter just don't run. Both test files are on functionals test…
Miguel de Sousa
  • 324
  • 2
  • 15
0
votes
1 answer

How to assert that some text only shows up on a web page certain number of times?

For one of my integration tests (minitest::spec) for my Rails app, I want to assert the number of times a bit of text shows up on a webpage? For instance I want to make sure that the text "This bit of text." only shows up once on the page. Is…
Joey
  • 343
  • 2
  • 10
0
votes
1 answer

Testing a call to an external library in MiniTest

I am working on an application for a blog using Ruby on Rails. I have a model called Essay with a Draper Decorator. I am also using MiniTest::Spec for testing this application. Each Essay has a body which will be stored as Markdown. In the…
Alex Shenoy
  • 101
  • 1
  • 4
0
votes
4 answers

how to test rails 4 with persisted data?

I've spent hours on findin information on how to test rails 4 app with new MiniTest, seems like everyone use rspec. I'm trying to test all levels of application, and currently stuck on how to test persisted data, for example I've User model which is…
user59382
  • 1
  • 1
0
votes
4 answers

Having minitest run tests in sequence instead of parallel?

Given the following code: require 'minitest/autorun' require ' class test < MiniTest::Unit::TestCase def setup end def teardown end def test1 end def…
llaskin
  • 789
  • 2
  • 9
  • 24
0
votes
2 answers

Incrementing an instance variable in the before :each clause of a MiniTest

I'm writing a Ruby wrapper for a web-based API and each request requires a unique transaction ID to be sent along with the request. I have written up a test shell using MiniTest::Spec, however the the transaction id is not incrementing between each…
Dave Sag
  • 13,266
  • 14
  • 86
  • 134
0
votes
1 answer

NokoGiri Error trying to use MiniTest-Rails-capybara

when trying to run rake minitest:features for the first time in my rails 3 app on my osx 10.8.4 machine i get a nokogiri error /Users/willbarker/.rvm/gems/ruby-2.0.0-p195/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in…
Will
  • 4,498
  • 2
  • 38
  • 65
0
votes
1 answer

Cucumber + Minitest Error

I've started to use Cucumber and wrote a simple test before the code implementation and cucumber said that minitest required. How can i require minitest in cucumber and how or in which file minitest should be required? Thanks in advance. This is my…
grek011
  • 3
  • 3
0
votes
2 answers

Minitest shortened syntax

The following is a Rails model test: it "will respond to name" do @user.must_respond_to :name end In minitest, is there a way to shorten this syntax like this? it { must_respond_to :name } or even this? it { must_respond_to (:name) }
Brent Eicher
  • 1,050
  • 9
  • 14
0
votes
1 answer

Watir-webdriver rails integration with minitest

Looking for equivalent of the gem minitest-rails-capybara for watir-webdriver, or in other words having the tests automatically start and stop the rails server. This is for the purposes of a continuous integration server, where I don't want to muck…
0
votes
2 answers

Search command output for string minitest

I'm trying to create a minitest for chef (minitest::spec) and I'm a little lost at how to accomplish what I want in ruby. What I want to do is have the code run the 'date' command and then check if the output contains 'UTC'. I have this so far, but…
shlant
  • 71
  • 3
  • 9
1 2 3
99
100