Permalink
Browse files

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

  • Loading branch information...
2 parents c0959b0 + 7ddfb82 commit ae4d96b84d6741771e9a5f86eb8a8cbdedc88902 Micah Rich committed Oct 19, 2008
@@ -1,6 +1,6 @@
-<% form_for :user, :url => user_confirmation_path(:user_id => @user,
- :salt => @user.salt) do |form| %>
- <div class="submit_field">
- <%= form.submit 'Confirm' %>
- </div>
-<% end %>
+<div id="account-changes" class="confirmation">
+ <% form_for :user, :url => user_confirmation_path(:user_id => @user,
+ :salt => @user.salt) do |form| %>
+ <%= image_submit_tag "confirm-message.png" %>
+ <% end %>
+</div>
@@ -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,
@@ -1090,9 +1090,16 @@ body.stores #map {
margin-top: 10px;
}
+#account-changes.confirmation {
+ text-align: center;
+}
+#account-changes.confirmation .submit_field {
+ text-align: center;
+}
+
#hello {
float: right;
margin-top: 17px;
margin-right: 200px;
color: #91cfd3;
-}
+}
@@ -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 ae4d96b

Please sign in to comment.