Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Use minitest/spec with Rails 3
require 'test_helper'
require 'minitest/autorun'
module Tenderlove
class Spec < MiniTest::Spec
include ActiveSupport::Testing::SetupAndTeardown
include ActiveRecord::TestFixtures
alias :method_name :__name__ if defined? :__name__
self.fixture_path = File.join(Rails.root, 'test', 'fixtures')
end
end
class PersonTest < Tenderlove::Spec
fixtures :people
describe 'holy shit' do
it 'does awesome stuff' do
1.must_equal 1
end
end
it 'finds a fixture' do
people(:one).name.must_equal 'America!'
end
end
@metaskills

This comment has been minimized.

Copy link

commented Feb 13, 2011

Try this line. In the describe block and it should fail.

people(:one).name.must_equal 'America!'
@raggi

This comment has been minimized.

Copy link

commented May 11, 2012

This won't work on 1.8 with Rails 3.2. You can get full-ish integration on 1.8 with Rails 3.2 simply by doing Gem.activate 'minitest_tu_shim' before require 'rails/test_help'. You'll need the 'minitest_tu_shim' gem, which ideally you want to include with :platforms => :mri_18 in your Gemfile.

@metaskills

This comment has been minimized.

Copy link

commented May 11, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.