Skip to content

Commit

Permalink
one file per test model class
Browse files Browse the repository at this point in the history
  • Loading branch information
alto committed Apr 21, 2013
1 parent ede514b commit 461886e
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 45 deletions.
15 changes: 15 additions & 0 deletions 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
30 changes: 0 additions & 30 deletions spec/spec_helpers/models_spec_helper.rb → 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
Expand Down Expand Up @@ -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
10 changes: 10 additions & 0 deletions 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
@@ -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
Expand All @@ -20,4 +9,4 @@ class SimpleNewDslMongoid
state :unknown_scope
state :new
end
end
end
11 changes: 11 additions & 0 deletions 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
5 changes: 4 additions & 1 deletion spec/spec_helper.rb
Expand Up @@ -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) }
4 changes: 2 additions & 2 deletions spec/unit/persistence/mongoid_persistance_spec.rb
Expand Up @@ -4,7 +4,7 @@
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)
Expand Down Expand Up @@ -123,4 +123,4 @@
end

end
end
end

0 comments on commit 461886e

Please sign in to comment.