Setting up cucumber test framework

Hi All

I am trying to setup a cucumber test framework which tests an
application which uses a mongodb, and I have installed the mongodb and
the I am using Mongoid as my ORM. And this is what the structure looks
like.

.
├── Gemfile
├── Gemfile.lock
├── config
│ └── mongoid.yml
├── features
│ ├── fruit_list.feature
│ ├── lib
│ │ └── fruit_app.rb
│ ├── step_definitions
│ └── support
│ ├── env.rb
│ └── hooks.rb
└── spec

6 directories, 7 files

However my configuration is not right because is failing:

mongoid.yml

development:
sessions:
default:
database: test_mongo_db
hosts:
- localhost:27017

env.rb

require File.join(File.dirname(FILE), ‘…’, ‘lib/fruit_app’ )
require ‘mongoid’

Mongoid.load!( File.join(File.dirname(FILE), ‘…’, ‘…’,
‘config/mongoid.yml’) , :development)

configure do

Mongoid.load!(‘config/mongoid.yml’)

end

Mongoid.configure do |config|
config.master = Mongo::Connection.new.db(“godfather”)
end

hook

require ‘database_cleaner’

DatabaseCleaner.strategy = :truncation
DatabaseCleaner.orm = “mongoid”

Before do
DatabaseCleaner.clean
end

I am not sure what I am doing wrong, can anyone help on this.

Thanks

On Fri, Sep 28, 2012 at 4:09 PM, Ja Tse [email protected] wrote:

├── config

6 directories, 7 files

Typically lib sits at the top level, and not inside of features.

However my configuration is not right because is failing:

It would probably be helpful to explain what “is failing” actually
means.
Error raised (what is the error)? Tests not passing (show the test)?
Personally I’d assume it has to do with Mongoid setup, but I don’t know
anything about Mongoid.

env.rb

require File.join(File.dirname(FILE), ‘…’, ‘lib/fruit_app’ )
require ‘mongoid’

It might be a problem to require mongoid after your app.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs