Simple Rspec test for positive number just won't pass <p>I'm new to rails and trying to write my first app. I have a table with columns order_size:integer and price:decimal(8,5). The price column holds currency prices so it needs to be really precise, in case you're wondering. I'm trying to write tests to make sure the price and order_size are a positive numbers, but no matter what I do they won't pass.</p> <p>Here are the Rspec tests</p> <pre><code>it "should require a positive order size" do @attr[:order_size] = -23 @user.orders.create!(@attr).should_not be_valid end it "should require a positive price" do @attr[:price] = -1.2908 @user.orders.create!(@attr).should_not be_valid end </code></pre> <p>Here are the Order class validations</p> <pre><code> validates_presence_of :user_id validates_numericality_of :order_size, :greater_than =&gt; 0, :only_integer =&gt; true validates_numericality_of :price, :greater_than =&gt; 0 </code></pre> <p>Here's the test results</p> <pre><code>Failures: 1) Order validations should require a positive order size Failure/Error: @user.orders.create!(@attr).should_not be_valid ActiveRecord::RecordInvalid: Validation failed: Order size must be greater than 0 # ./spec/models/order_spec.rb:39:in `block (3 levels) in &lt;top (required)&gt;' 2) Order validations should require a positive price Failure/Error: @user.orders.create!(@attr).should_not be_valid ActiveRecord::RecordInvalid: Validation failed: Price must be greater than 0 # ./spec/models/order_spec.rb:44:in `block (3 levels) in &lt;top (required)&gt;' </code></pre> <p>What exactly is going on here? I even tried running the test asserting they should be_valid, but they still fail. Any help would be appreciated.</p>