[84013] branches/gsoc11-statistics/stats-server/spec/models/port_spec.rb
derek at macports.org
derek at macports.org
Wed Sep 14 17:31:55 PDT 2011
Revision: 84013
http://trac.macports.org/changeset/84013
Author: derek at macports.org
Date: 2011-09-14 17:31:54 -0700 (Wed, 14 Sep 2011)
Log Message:
-----------
Added spec for Port model.
- Test for presence of associations
- Test for existence of validators on name, version
Added Paths:
-----------
branches/gsoc11-statistics/stats-server/spec/models/port_spec.rb
Added: branches/gsoc11-statistics/stats-server/spec/models/port_spec.rb
===================================================================
--- branches/gsoc11-statistics/stats-server/spec/models/port_spec.rb (rev 0)
+++ branches/gsoc11-statistics/stats-server/spec/models/port_spec.rb 2011-09-15 00:31:54 UTC (rev 84013)
@@ -0,0 +1,34 @@
+require 'spec_helper'
+
+describe Port do
+
+ before(:each) do
+ @port = Port.new :name => "name",
+ :version => "version"
+ end
+
+ it "should belong to category" do
+ @port.should belong_to :category
+ end
+
+ it "should have many installed ports" do
+ @port.should have_many :installed_ports
+ end
+
+ it "should have a name" do
+ @port[:name] = nil
+ @port.should be_invalid
+
+ @port[:name] = "name"
+ @port.should be_valid
+ end
+
+ it "should have a version" do
+ @port[:version] = nil
+ @port.should be_invalid
+
+ @port[:version] = "version"
+ @port.should be_valid
+ end
+
+end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110914/94bd3831/attachment.html>
More information about the macports-changes
mailing list