diff --git a/spec/models/bar.rb b/spec/models/bar.rb new file mode 100644 index 0000000..7a50dfb --- /dev/null +++ b/spec/models/bar.rb @@ -0,0 +1,15 @@ +class Bar + include AASM + + aasm do + state :read + state :ended + + event :foo do + transitions :to => :ended, :from => [:read] + end + end +end + +class Baz < Bar +end diff --git a/spec/spec_helpers/models_spec_helper.rb b/spec/models/foo.rb similarity index 54% rename from spec/spec_helpers/models_spec_helper.rb rename to spec/models/foo.rb index 504a6a7..482b94c 100644 --- a/spec/spec_helpers/models_spec_helper.rb +++ b/spec/models/foo.rb @@ -1,5 +1,3 @@ -Dir[File.dirname(__FILE__) + "/../models/*.rb"].sort.each { |f| require File.expand_path(f) } - class Foo include AASM aasm do @@ -34,31 +32,3 @@ class FooTwo < Foo state :foo end end - -class Bar - include AASM - - aasm do - state :read - state :ended - - event :foo do - transitions :to => :ended, :from => [:read] - end - end -end - -class Baz < Bar -end - -class ThisNameBetterNotBeInUse - include AASM - - aasm do - state :initial - state :symbol - state :string - state :array - state :proc - end -end diff --git a/spec/models/mongoid/simple_mongoid.rb b/spec/models/mongoid/simple_mongoid.rb new file mode 100644 index 0000000..ed7cb07 --- /dev/null +++ b/spec/models/mongoid/simple_mongoid.rb @@ -0,0 +1,10 @@ +class SimpleMongoid + include Mongoid::Document + include AASM + + field :status, type: String + + aasm_column :status + aasm_state :unknown_scope + aasm_state :new +end diff --git a/spec/models/mongoid/mongoid_models.rb b/spec/models/mongoid/simple_new_dsl_mongoid.rb similarity index 52% rename from spec/models/mongoid/mongoid_models.rb rename to spec/models/mongoid/simple_new_dsl_mongoid.rb index 5a4b50d..e0406c0 100644 --- a/spec/models/mongoid/mongoid_models.rb +++ b/spec/models/mongoid/simple_new_dsl_mongoid.rb @@ -1,14 +1,3 @@ -class SimpleMongoid - include Mongoid::Document - include AASM - - field :status, type: String - - aasm_column :status - aasm_state :unknown_scope - aasm_state :new -end - class SimpleNewDslMongoid include Mongoid::Document include AASM @@ -20,4 +9,4 @@ class SimpleNewDslMongoid state :unknown_scope state :new end -end \ No newline at end of file +end diff --git a/spec/models/this_name_better_not_be_in_use.rb b/spec/models/this_name_better_not_be_in_use.rb new file mode 100644 index 0000000..e330439 --- /dev/null +++ b/spec/models/this_name_better_not_be_in_use.rb @@ -0,0 +1,11 @@ +class ThisNameBetterNotBeInUse + include AASM + + aasm do + state :initial + state :symbol + state :string + state :array + state :proc + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e2e3b11..c20350a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -15,5 +15,8 @@ def load_schema load(File.dirname(__FILE__) + "/schema.rb") end -# Requiring custom spec helpers +# custom spec helpers Dir[File.dirname(__FILE__) + "/spec_helpers/**/*.rb"].sort.each { |f| require File.expand_path(f) } + +# example model classes +Dir[File.dirname(__FILE__) + "/models/*.rb"].sort.each { |f| require File.expand_path(f) } diff --git a/spec/unit/persistence/mongoid_persistance_spec.rb b/spec/unit/persistence/mongoid_persistance_spec.rb index e6a1843..0791f85 100644 --- a/spec/unit/persistence/mongoid_persistance_spec.rb +++ b/spec/unit/persistence/mongoid_persistance_spec.rb @@ -4,7 +4,7 @@ describe 'mongoid', :if => Gem::Version.create(RUBY_VERSION.dup) >= Gem::Version require 'mongoid' require 'logger' require 'spec_helper' - require File.dirname(__FILE__) + '/../../models/mongoid/mongoid_models' + Dir[File.dirname(__FILE__) + "/../../models/*.rb"].sort.each { |f| require File.expand_path(f) } # if you want to see the statements while running the spec enable the following line # Mongoid.logger = Logger.new(STDERR) @@ -123,4 +123,4 @@ describe 'mongoid', :if => Gem::Version.create(RUBY_VERSION.dup) >= Gem::Version end end -end \ No newline at end of file +end