created the rspec runner so you dont have to worry about cleaning mongoid every run completed chore MS

This commit is contained in:
maxwell 2010-06-13 16:12:32 -07:00
parent 3fd7f2719b
commit c84c99f993
3 changed files with 31 additions and 4 deletions

View file

@ -3,10 +3,7 @@ require File.dirname(__FILE__) + '/../spec_helper'
describe UsersController do describe UsersController do
render_views render_views
#fixtures here? #fixtures here?
it 'should, after logging in redirect to the dashboard page' do it 'should, after logging in redirect to the dashboard page' do
post 'index'
puts "boner!"
end
end end
end

27
spec/models/misc_spec.rb Normal file
View file

@ -0,0 +1,27 @@
require File.dirname(__FILE__) + '/../spec_helper'
describe 'making sure the spec runner works' do
it 'should not delete the database mid-spec' do
User.count.should == 0
billy = User.create(:email => "billy@aol.com", :password => "foobar")
User.count.should == 1
end
it 'should make sure the last user no longer exsists' do
User.count.should == 0
end
describe 'testing a before do block' do
before do
@bill = User.create(:email => "billy@aol.com", :password => "foobar")
end
it 'should have cleaned before the before do block runs' do
User.count.should == 1
end
end
end

View file

@ -19,6 +19,9 @@ Rspec.configure do |config|
config.mock_with :rspec config.mock_with :rspec
config.fixture_path = "#{::Rails.root}/spec/fixtures" config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.before(:each) do
Mongoid.master.collections.select { |c| c.name != 'system.indexes' }.each(&:drop)
end
# If you're not using ActiveRecord, or you'd prefer not to run each of your # If you're not using ActiveRecord, or you'd prefer not to run each of your