File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11Given /^that someone has provided "([^"]*)" as an answer for my question$/ do |solution |
2- other_user = Fabricate ( :user )
2+ other_user = Fabricate ( :user )
33 other_user . save!
44 @question . answers . build ( :description => solution , :user => other_user ) . save!
55end
Original file line number Diff line number Diff line change 3131
3232# Remove/comment out the lines below if your app doesn't have a database.
3333# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
34- DatabaseCleaner . strategy = :truncation
34+ DatabaseCleaner . orm = "mongo_mapper"
35+ DatabaseCleaner [ :mongo_mapper ] . strategy = :truncation
3536
3637Before do
37- MongoMapper . database . collections . each do |collection |
38- unless collection . name . match ( /^system\. / )
39- collection . remove
40- end
41- end
38+ DatabaseCleaner [ :mongo_mapper ] . clean
4239end
4340
4441# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
Original file line number Diff line number Diff line change 1+ ENV [ "RAILS_ENV" ] ||= 'test'
2+ require File . expand_path ( "../../config/environment" , __FILE__ )
3+ require 'rspec/rails'
4+ require 'database_cleaner'
5+
6+ # Requires supporting ruby files with custom matchers and macros, etc,
7+ # in spec/support/ and its subdirectories.
8+ Dir [ Rails . root . join ( "spec/support/**/*.rb" ) ] . each { |f | require f }
9+
10+ RSpec . configure do |config |
11+ # == Mock Framework
12+ #
13+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
14+ #
15+ # config.mock_with :mocha
16+ # config.mock_with :flexmock
17+ # config.mock_with :rr
18+ config . mock_with :rspec
19+
20+ DatabaseCleaner . orm = "mongo_mapper"
21+ DatabaseCleaner [ :mongo_mapper ] . strategy = :truncation
22+
23+ config . before ( :each ) do
24+ DatabaseCleaner [ :mongo_mapper ] . clean
25+ end
26+ end
You can’t perform that action at this time.
0 commit comments