1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00
aasm/spec/generators/mongoid_generator_spec.rb

31 lines
887 B
Ruby

require 'spec_helper'
if defined?(Mongoid::Document)
require 'generator_spec'
require 'generators/mongoid/aasm_generator'
describe Mongoid::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