 		it "should be able to save the transaction in the db", (done) ->
 			messageStore.storeTransaction ctx, (error, result) ->
 				should.not.exist(error)
-				transactions.Transaction.findOne { '_id': result._id }, (error, trans) ->
+				Transaction.findOne { '_id': result._id }, (error, trans) ->
 					should.not.exist(error)
 					(trans != null).should.be.true
 					trans.clientID.should.equal "Master_OpenMRS_Instance"

sinon = require "sinon"
http = require "http"
messageStore = require "../../lib/middleware/messageStore"
MongoClient = require('mongodb').MongoClient
config = require "../../lib/config/config"
transactions = require "../../lib/model/transactions"

collection = null
transactionId = null
db = null

beforeEach (done) ->
	MongoClient.connect config.mongo.url, {native_parser:true}, (error,db) ->
		if error
			return done error
		root = exports ? that 
		db.collection "transactions", (err, coll) ->
			coll.remove (err, doc) ->
			collection = coll
			done()
afterEach (done)->
	collection.remove (err, doc) ->
		done()

describe "MessageStore", ->
	req = new Object()

				ctx.transactionId = storedTrans._id
				messageStore.storeResponse ctx, (err2) ->
					should.not.exist(err2)
					Transaction.findOne { '_id': storedTrans._id }, (err3, trans) ->
						should.not.exist(err3)
						(trans != null).should.true
						trans.response.status.should.equal 201
