aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/gems/rspec-rails-1.3.3/spec/resources/models
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2011-02-23 12:06:34 +0000
committerLouise Crow <louise.crow@gmail.com>2011-02-23 12:06:34 +0000
commit4cd0de91754f07afd0afb58d137b3adcf5a07611 (patch)
tree1a16f0c5af85f5e7561012b027545183584e15b8 /vendor/gems/rspec-rails-1.3.3/spec/resources/models
parent44b78c1cd78607434b3666f5391ba68da647583f (diff)
Removing rspec and rspec-rails plugins in favour of updated gems.
Diffstat (limited to 'vendor/gems/rspec-rails-1.3.3/spec/resources/models')
-rw-r--r--vendor/gems/rspec-rails-1.3.3/spec/resources/models/animal.rb4
-rw-r--r--vendor/gems/rspec-rails-1.3.3/spec/resources/models/person.rb18
-rw-r--r--vendor/gems/rspec-rails-1.3.3/spec/resources/models/thing.rb3
3 files changed, 25 insertions, 0 deletions
diff --git a/vendor/gems/rspec-rails-1.3.3/spec/resources/models/animal.rb b/vendor/gems/rspec-rails-1.3.3/spec/resources/models/animal.rb
new file mode 100644
index 000000000..3ce078ad4
--- /dev/null
+++ b/vendor/gems/rspec-rails-1.3.3/spec/resources/models/animal.rb
@@ -0,0 +1,4 @@
+class Animal < ActiveRecord::Base
+ belongs_to :person
+ validates_uniqueness_of :name
+end
diff --git a/vendor/gems/rspec-rails-1.3.3/spec/resources/models/person.rb b/vendor/gems/rspec-rails-1.3.3/spec/resources/models/person.rb
new file mode 100644
index 000000000..7f9607e57
--- /dev/null
+++ b/vendor/gems/rspec-rails-1.3.3/spec/resources/models/person.rb
@@ -0,0 +1,18 @@
+class Person < ActiveRecord::Base
+ has_many :animals do
+ def pups
+ find(:all, :conditions => 'age < 1')
+ end
+ def adults
+ find(:all, :conditions => 'age >= 1')
+ end
+ end
+ validates_presence_of :name
+
+ def add_animal animal
+ animal.person = self
+ animals << animal
+ animal.save
+ end
+
+end
diff --git a/vendor/gems/rspec-rails-1.3.3/spec/resources/models/thing.rb b/vendor/gems/rspec-rails-1.3.3/spec/resources/models/thing.rb
new file mode 100644
index 000000000..c674804ac
--- /dev/null
+++ b/vendor/gems/rspec-rails-1.3.3/spec/resources/models/thing.rb
@@ -0,0 +1,3 @@
+class Thing < ActiveRecord::Base
+ validates_presence_of :name
+end