diff --git a/.gitignore b/.gitignore index 8ea7842..4a79afe 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ config/settings/*.local.yml config/environments/*.local.yml *.sublime-workspace +.rvmrc \ No newline at end of file diff --git a/spec/controllers/preorder_controller_spec.rb b/spec/controllers/preorder_controller_spec.rb new file mode 100644 index 0000000..8af84e3 --- /dev/null +++ b/spec/controllers/preorder_controller_spec.rb @@ -0,0 +1,10 @@ +require 'spec_helper' + +describe PreorderController do + [:index, :checkout].each do |method| + it "should get #{method}" do + get method + response.should be_success + end + end +end \ No newline at end of file diff --git a/spec/models/order_spec.rb b/spec/models/order_spec.rb index 0fe452f..1bd2655 100644 --- a/spec/models/order_spec.rb +++ b/spec/models/order_spec.rb @@ -2,17 +2,19 @@ describe Order do context "attributes" do - [:address_one, :address_two, :city, :country, :number, :state, :status, - :token, :transaction_id, :zip, :shipping, :tracking_number, :name, + [:address_one, :address_two, :city, :country, :number, :state, :status, + :token, :transaction_id, :zip, :shipping, :tracking_number, :name, :price, :phone, :expiration ].each do |property| - it { should allow_mass_assignment_of property } - end + it { should allow_mass_assignment_of property } + end it { should_not allow_mass_assignment_of :uuid } it "generates UUID before validation on_create" do - # TODO + @order = Order.new + @order.valid? + @order.uuid.should_not be_nil end it { Order.primary_key.should == 'uuid' } @@ -140,16 +142,16 @@ describe Order do end context "no orders" do - + before do ActiveRecord::Relation.any_instance.stub(:first).and_return(nil) Order.stub!(:count).and_return(0) end - + it "doesn't break if there's no orders" do expect { Order.next_order_number }.to_not raise_error end - + it "returns 1 if there's no orders" do Order.next_order_number.should == 1 end @@ -177,7 +179,7 @@ describe Order do it "multiplies the #current with price from Settings" do Order.stub(:current).and_return(4) Settings.stub(:price).and_return(6) - + Order.revenue.should == 24 end end