1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00
aasm/spec/generators/no_brainer_generator_spec.rb
Guillaume Hain 65073e360a Add support for Nobrainer (RethinkDB)
* Add persistence for NoBrainer
* Add tests for NoBrainer
* Show the ORM version when running the tests
* Add a Dockerfile and a docker-compose.yml file allowing to run from anywhere very easily the test suite with `docker-compose run --rm aasm\'
* Moves the Mongoid database name definition in the gem loader (avoiding code repetition)
* Update the CHANGELOG.md and the README.md files
* Add Rails generator for NoBrainer
2018-02-13 12:49:27 +05:30

29 lines
891 B
Ruby

require 'spec_helper'
if defined?(NoBrainer::Document)
require 'generator_spec'
require 'generators/nobrainer/aasm_generator'
describe NoBrainer::Generators::AASMGenerator, type: :generator do
destination File.expand_path('../../../tmp', __FILE__)
before(:all) do
prepare_destination
end
it 'creates model with aasm block for default column_name' do
run_generator %w[user]
assert_file 'app/models/user.rb', /include AASM\n\n aasm do\n end\n/
end
it 'creates model with aasm block for custom column_name' do
run_generator %w[user state]
assert_file 'app/models/user.rb', /aasm :column => 'state' do\n end\n/
end
it 'creates model with aasm block for namespaced model' do
run_generator %w[Admin::User state]
assert_file 'app/models/admin/user.rb', /aasm :column => 'state' do\n end\n/
end
end
end