Permalink
Browse files

Merge branch 'master' of git@github.com:railsrumble/giant-robots

  • Loading branch information...
Chad Pytel
Chad Pytel committed Oct 19, 2008
2 parents 8272bcd + 7ebf907 commit 7ddfb823e6e5628071a9ed51d44262a32289a5b4
@@ -6,19 +6,21 @@
<span class="location"><%=h purchase.store.name %></span>
</span>
<span class="your-price"><%= number_to_formatted_currency(purchase.price) %></span>
- <span class="cheapest-price closed">
- <%= link_to_remote number_to_formatted_currency(purchase.cheapest_price),
- :url => purchase_stores_path(purchase),
- :method => :get,
- :complete => "$('#{dom_id(purchase)}').down('.open').show(); " <<
- "$('#{dom_id(purchase)}').down('.closed').hide(); " %>
- </span>
- <span class="cheapest-price open" style="display: none">
- <%= link_to_function number_to_formatted_currency(purchase.cheapest_price),
- "new Effect.BlindUp('#{dom_id(purchase, :stores_for)}'); " <<
- "$('#{dom_id(purchase)}').down('.closed').show(); " <<
- "$('#{dom_id(purchase)}').down('.open').hide(); " %>
- </span>
+ <% unless purchase.cheapest_price.nil? %>
+ <span class="cheapest-price closed">
+ <%= link_to_remote number_to_formatted_currency(purchase.cheapest_price),
+ :url => purchase_stores_path(purchase),
+ :method => :get,
+ :complete => "$('#{dom_id(purchase)}').down('.open').show(); " <<
+ "$('#{dom_id(purchase)}').down('.closed').hide(); " %>
+ </span>
+ <span class="cheapest-price open" style="display: none">
+ <%= link_to_function number_to_formatted_currency(purchase.cheapest_price),
+ "new Effect.BlindUp('#{dom_id(purchase, :stores_for)}'); " <<
+ "$('#{dom_id(purchase)}').down('.closed').show(); " <<
+ "$('#{dom_id(purchase)}').down('.open').hide(); " %>
+ </span>
+ <% end %>
<%= link_to_remote '<span class="invisible">X</span>', {:url => purchase_path(purchase), :method => :delete }, :class => 'delete' %>
</div>
<% content_tag_for :div,
@@ -96,6 +96,17 @@ def setup
assert_no_match @focus_quantity, @response.body
end
end
+
+ context "on GET to index without any nearby stores" do
+ setup do
+ @purchases.each {|purchase| purchase.stubs(:cheapest_price).returns(nil) }
+ get :index
+ end
+
+ should "not show the cheapest-price box" do
+ assert_select 'span.cheapest-price', false
+ end
+ end
end
context "on GET to index without any previous purchases" do
View
@@ -137,6 +137,19 @@ class UserTest < Test::Unit::TestCase
assert_equal [@nearby], @user.nearby_stores
end
end
+
+ context "with an existing openid user" do
+ setup { Factory(:user, :openid_identity => 'test', :email => nil) }
+ context "a new openid user" do
+ setup do
+ @user = Factory.build(:user, :openid_identity => 'other', :email => nil)
+ end
+
+ should "be valid" do
+ assert_valid @user
+ end
+ end
+ end
context "an email User" do
setup do
@@ -12,7 +12,7 @@ def self.included(base)
validates_presence_of :email, :if => :email_required?
validates_presence_of :password, :if => :password_required?
validates_confirmation_of :password, :if => :password_required?
- validates_uniqueness_of :email
+ validates_uniqueness_of :email, :allow_nil => true
before_save :initialize_salt, :encrypt_password

0 comments on commit 7ddfb82

Please sign in to comment.