Ruby on Rails: Cucumber: how to reset the db after each scenario? -
So I am in my testing environment
Now, in the terminal, make Rake DB: Test: DB clears ... but when I run it with code
and I have this feature / support / env.rb:
before working : Build_all [: debug, release]. T | $ Build_type = t rake :: Task ["db: test: prepare"]. Reenable rake :: Task ["db: test: ready"]. End end end
but my
is in my database.yml
test: adapter: mysql encoding: utf8 database : Projectname_test Username: Root password:
Ive also tried
db: test: purge
And
db: test: reset
And I know that this is using my test db because i check my SQLWorkBrain , And it includes data in the table ... but it does not get removed When the data is done (I have to manually delete it) when the tables are empty, test case pass
You need the 'database_claner' to start
'database_cleaner / cucumber' DatabaseCleaner.strategy =: truncation rescue nameError raise "if you want to use it , You need to add database_cleaner (test group) to your Gemfile. " Do the database cleaner before terminating. Scenario | DatabaseCleaner.clean termination
Comments
Post a Comment