testunit Questions

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

3

Solved

In one of my projects I need to collaborate with several backend systems. Some of them somewhat lacks in documentation, and partly therefore I have some test code that interact with some test serve...
Filter asked 28/5, 2010 at 7:51

3

currently I am using the standard testRegex logic to run my tests "jest": { "moduleFileExtensions": [ "ts", "js" ], "transform": { "^.+\\.ts?$": "<rootDir>/node_modules/ts-jest/prepr...
Expendable asked 2/1, 2019 at 10:54

2

Solved

I want to stub a method with Mocha only when a specific parameter value is given and call the original method when any other value is given. When I do it like this: MyClass.any_instance.stubs(:s...
Masqat asked 15/5, 2013 at 7:38

3

Solved

As something of an academic exercise, I thought I'd try to get my unit tests running without loading the Rails env (or hitting the database). I've seen this done before, and it seems like folks ta...
Stoicism asked 16/8, 2011 at 14:8

4

Solved

I'm trying to execute the following code, but it is giving me an undefined method error: require 'minitest/autorun' require 'string_extension' class StringExtensionTest < Minitest::Test def t...
Pliske asked 12/3, 2016 at 9:48

5

Solved

I have test-unit installed and rspec installed (along with -core, -expectations, -mocks and -rails version 2.6.x). When I run the command rails new foo, it uses test-unit to generate the test stub ...
Rexford asked 18/7, 2011 at 4:25

1

Solved

I want to be sure my page does not contain certain text, I know there is an assert_text function, but, how do I test the opposite? I am using RoR 6.0, the default test framework (I think it is Tes...
Salicin asked 9/11, 2019 at 2:51

3

Solved

At the minute all my fixtures have the same name as the table that they are intended for, because of a recent issue with rails it doesn't seem possible to have a fixture beginning with the word 'te...
Subhead asked 21/12, 2009 at 11:27

3

Solved

When running test/unit using the rake test command from the terminal within a rails 3 project directory, the test result output is not coloured. Hence, it cannot be interpreted at a glance. Is ther...
Derwood asked 21/10, 2010 at 21:24

4

Solved

How would be the correct way to mock or override the Kernel.system method so that when called with: system("some command") instead of executing the command, it executes some predefined code? I ...
Faucal asked 20/5, 2013 at 17:58

2

I'm using Capybara to test the front-end portion of an app that utilizes HTML5 local storage to persist data values on the client. In order to ensure session data from one test doesn't interfere wi...
Fantasy asked 17/6, 2014 at 14:52

1

Solved

In my ContactForm component , I have 2 computed mapGetters computed: { ...mapGetters(["language"]), ...mapGetters("authentication", ["loading"]), the first one is defined in my stoe/getters.js...
Gascon asked 2/10, 2018 at 17:6

4

Solved

RSpec has: describe "the user" do before(:each) do @user = Factory :user end it "should have access" do @user.should ... end end How would you group tests like that with Test::Unit? For e...
Charbonneau asked 8/5, 2011 at 0:5

3

Solved

I am writing my first unit tests with Test::Unit and I have reached a point where I need to compare two numbers. Much to my surprise, I have discovered that none of the following were available: a...
Bushed asked 28/4, 2011 at 13:54

1

I have tried couple different ways of defining the mock function and all of my tries failed. When I try to define it as follow: jest.mock('../src/data/server', ()=> ({server: {report: jest.fn()...
Dorton asked 11/12, 2016 at 17:54

3

I opened irb & entered: require 'test/unit' but when I used the assert_equal method, I got following error: NoMethodError: undefined method 'assert_equal' for main:Object. Why is this happen...
Molality asked 7/9, 2012 at 12:16

5

Is there a plugin/extension similar to shared_examples in RSpec for Test::Unit tests?
Arcuation asked 24/1, 2013 at 17:17

1

Solved

I created a Rails 4 app recently and for some reason my rake tasks don't include test. Here's some console action to demonstrate the problem: > rake test:units rake aborted! Don't know how to...
Isaisaac asked 11/11, 2014 at 20:14

9

Solved

I'm going through a tutorial that has suggested using rspec, but I have already gone through a lot of default rails installation. I really don't want to have to redo the installation at all. Anyway...
Brow asked 27/3, 2012 at 5:53

4

Solved

I'm using Rails 4.0.0.beta1. I added two directories: app/services and test/services. I also added this code, based on reading testing.rake of railties: namespace :test do Rake::TestTask.new(ser...
Millard asked 6/3, 2013 at 20:6

3

Solved

For example, when these tests are run, I want to ensure that test_fizz always runs first. require 'test/unit' class FooTest < Test::Unit::TestCase def test_fizz puts "Running fizz" assert tr...
Artery asked 20/11, 2009 at 19:59

2

After upgrading from Rails 3.2 to Rails 4, my app works, but my tests, written with test-unit, are a disaster. Minitest is rumored to be "compatible" with test-unit. However, if I attempt to use ...
Cuirass asked 24/7, 2013 at 19:46

3

Solved

I need to have a custom mechanism for signing in using Devise with Rails 4. So I found the sign_in method in Devise's test helpers section of their documentation: sign_in @user # sign_in(resource)...
Sayles asked 17/3, 2014 at 20:26

© 2022 - 2024 — McMap. All rights reserved.