Permalink
Browse files

replace test with spec

  • Loading branch information...
1 parent f5c098c commit 69806c5f07a5e0630d4c0ce0d1cb8d2f99500105 @jaredbeck jaredbeck committed Aug 2, 2012
Showing with 14 additions and 19 deletions.
  1. +14 −0 spec/models/attendee_spec.rb
  2. +0 −19 test/unit/attendee_plan_test.rb
@@ -52,6 +52,20 @@
end
describe "#valid?" do
+ let(:plan) { FactoryGirl.create :plan, inventory: 42, max_quantity: 999 }
+
+ it "plan quantity cannot exceed available inventory" do
+ a = FactoryGirl.create :attendee
+ a.attendee_plans.build plan_id: plan.id, quantity: 43
+ a.should_not be_valid
+ end
+
+ it "plan quantity can equal available inventory" do
+ a = FactoryGirl.create :attendee
+ a.attendee_plans.build plan_id: plan.id, quantity: 42
+ a.should be_valid
+ end
+
it "requires minors to provide the name of a guardian" do
a = FactoryGirl.build :attendee
a.stub(:minor?) { true }
@@ -1,19 +0,0 @@
-require 'test_helper'
-
-class AttendeePlanTest < ActiveSupport::TestCase
-
- setup do
- @atnd = FactoryGirl.create :attendee
- @plan = FactoryGirl.create :plan, inventory: 42, max_quantity: 999
- end
-
- test "quantity cannot exceed available inventory" do
- @atnd.attendee_plans.build plan_id: @plan.id, quantity: 43
- assert_equal false, @atnd.valid?
- end
-
- test "quantity can equal available inventory" do
- @atnd.attendee_plans.build plan_id: @plan.id, quantity: 42
- assert @atnd.valid?
- end
-end

0 comments on commit 69806c5

Please sign in to comment.