From c74dc120df63f463b77512f1c09265a7d6903664 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Fri, 7 Jan 2011 16:44:27 -0800 Subject: [PATCH] fixed all cucumber tests --- app/controllers/aspects_controller.rb | 29 ++++++++++-------- app/views/aspects/_aspect_listings.haml | 2 +- app/views/aspects/_no_contacts_message.haml | 9 ++---- app/views/aspects/edit.html.haml | 14 ++++----- app/views/aspects/index.html.haml | 4 +-- app/views/aspects/manage.html.haml | 8 +++-- app/views/aspects/show.html.haml | 1 - features/manages_aspects.feature | 2 +- features/step_definitions/custom_web_steps.rb | 2 +- features/step_definitions/session_steps.rb | 2 +- features/step_definitions/user_steps.rb | 3 +- public/images/facebox/closelabel.png | Bin 168 -> 140 bytes public/stylesheets/sass/application.sass | 23 ++++++++++++-- public/stylesheets/vendor/facebox.css | 7 ++--- 14 files changed, 62 insertions(+), 44 deletions(-) mode change 100755 => 100644 public/images/facebox/closelabel.png diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index a294bff0a..5cda129f0 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -16,20 +16,23 @@ class AspectsController < ApplicationController @aspects = current_user.aspects end - @aspect_ids = @aspects.map{|a| a.id} - post_ids = @aspects.map{|a| a.post_ids}.flatten! - - @posts = Post.where(:id.in => post_ids, :_type => "StatusMessage").paginate :page => params[:page], :per_page => 15, :order => 'created_at DESC' - @post_hashes = hashes_for_posts @posts - - @contacts = Contact.all(:aspect_ids.in => @aspect_ids, :user_id => current_user.id, :pending => false) - @contact_hashes = hashes_for_contacts @contacts - @aspect_hashes = hashes_for_aspects @aspects, @contacts, :limit => 8 - - @aspect = :all unless params[:a_ids] - - if current_user.getting_started == true + # redirect to signup + if current_user.getting_started == true || @aspects.blank? redirect_to getting_started_path + else + + @aspect_ids = @aspects.map{|a| a.id} + post_ids = @aspects.map{|a| a.post_ids}.flatten! + + @posts = Post.where(:id.in => post_ids, :_type => "StatusMessage").paginate :page => params[:page], :per_page => 15, :order => 'created_at DESC' + @post_hashes = hashes_for_posts @posts + + @contacts = Contact.all(:aspect_ids.in => @aspect_ids, :user_id => current_user.id, :pending => false) + @contact_hashes = hashes_for_contacts @contacts + @aspect_hashes = hashes_for_aspects @aspects, @contacts, :limit => 8 + + @aspect = :all unless params[:a_ids] + end end diff --git a/app/views/aspects/_aspect_listings.haml b/app/views/aspects/_aspect_listings.haml index 4810bfda1..d11fd3a8f 100644 --- a/app/views/aspects/_aspect_listings.haml +++ b/app/views/aspects/_aspect_listings.haml @@ -5,7 +5,7 @@ %h4 .right - = link_to t('contacts', :count => @contacts.count), aspects_manage_path + = link_to t('contacts', :count => @contacts.count), aspects_manage_path, :title => t('aspects.manage.manage_aspects') = @aspect_hashes.count = t('_aspects') diff --git a/app/views/aspects/_no_contacts_message.haml b/app/views/aspects/_no_contacts_message.haml index 026e6c23e..0878ffabc 100644 --- a/app/views/aspects/_no_contacts_message.haml +++ b/app/views/aspects/_no_contacts_message.haml @@ -3,10 +3,7 @@ -# the COPYRIGHT file. #no_contacts.floating.empty_message{:style => ("display:none" unless contact_count == 0)} - - if aspect == :all - %h3=t('.nobody') - - if current_user.invites > 0 - %h4= link_to t('.invite'), new_user_invitation_path - - else - %h3=t('.nobody_in_aspect', :aspect_name => aspect.name) + %h3=t('.nobody') + - if current_user.invites > 0 + %h4= link_to t('.invite'), new_user_invitation_path diff --git a/app/views/aspects/edit.html.haml b/app/views/aspects/edit.html.haml index 5793a5467..0e56711b8 100644 --- a/app/views/aspects/edit.html.haml +++ b/app/views/aspects/edit.html.haml @@ -8,14 +8,9 @@ #aspect_edit_pane #aspect_edit_pane_header %h4 - .right.description - = "#{@aspect_contacts.count} contacts" = @aspect - - = link_to 'rename', '#' - \. - \. - = link_to 'delete', @aspect, :method => "delete", :confirm => t('.confirm_remove_aspect') + .description + = "#{@aspect_contacts.count} contacts" .person_tiles{:style => "display:none;"} - for contact in @aspect.contacts @@ -32,3 +27,8 @@ - if @contacts.count > 0 = render 'shared/contact_list', :aspect_id => @aspect.id, :contact_hashes => @all_contacts + + #aspect_edit_controls + = link_to 'rename', '#' + \/ + = link_to 'delete', @aspect, :method => "delete", :confirm => t('.confirm_remove_aspect') diff --git a/app/views/aspects/index.html.haml b/app/views/aspects/index.html.haml index 20a25ca99..84d36c436 100644 --- a/app/views/aspects/index.html.haml +++ b/app/views/aspects/index.html.haml @@ -7,7 +7,7 @@ = include_javascripts :home .span-15.append-2 - /= render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @contacts.count + = render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @contacts.count #aspect_stream_container = render 'aspect_stream', @@ -18,7 +18,7 @@ .span-7.last #home_user_badge = owner_image_link - %h3{:style => "position:relative;display:inline-block;margin-left:12px;top:-8px;"} + %h3{:style => "position:relative;"} = current_user.name .description = link_to current_user.diaspora_handle, person_path(current_user.person) diff --git a/app/views/aspects/manage.html.haml b/app/views/aspects/manage.html.haml index fbe9e2831..3a7c690bf 100644 --- a/app/views/aspects/manage.html.haml +++ b/app/views/aspects/manage.html.haml @@ -9,9 +9,11 @@ = t('.manage_aspects') #section_header - %h2=t('.manage_aspects') - .right{:style=>"top:0;"} - = link_to("+ #{t('.add_a_new_aspect')}", "#add_aspect_pane", :class => "new_aspect add_aspect_button button", :title => t('.add_a_new_aspect')) + .right + = link_to("+ #{t('.add_a_new_aspect')}", "#add_aspect_pane", :class => "new_aspect button", :title => t('.add_a_new_aspect'), :rel => 'facebox') + + %h2 + =t('.manage_aspects') #manage_aspect_zones .span-4.append-1.last diff --git a/app/views/aspects/show.html.haml b/app/views/aspects/show.html.haml index 3068a87e3..f9a3e9ce2 100644 --- a/app/views/aspects/show.html.haml +++ b/app/views/aspects/show.html.haml @@ -23,7 +23,6 @@ .span-15.last = render 'shared/publisher', :aspect => @aspect - = render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @aspect_contacts_count, :options => false #main_stream.stream{:data => {:guids => @aspect.id}} = render 'shared/stream', :posts => @post_hashes diff --git a/features/manages_aspects.feature b/features/manages_aspects.feature index b81d19e1f..5715a77a5 100644 --- a/features/manages_aspects.feature +++ b/features/manages_aspects.feature @@ -7,7 +7,7 @@ Feature: User manages aspects Scenario: creating an aspect Given I am signed in When I follow "Home" in the header - And I follow "manage aspects" + And I follow "Manage aspects" And I follow "+ Add a new aspect" And I fill in "Name" with "Dorm Mates" in the modal window And I press "Create" in the modal window diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index 923040c46..1d6b04ec6 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -5,7 +5,7 @@ When /^(.*) in the header$/ do |action| end When /^(.*) in the modal window$/ do |action| - within('#fancybox-wrap') do + within('#facebox') do When action end end diff --git a/features/step_definitions/session_steps.rb b/features/step_definitions/session_steps.rb index 446748262..4aa51129b 100644 --- a/features/step_definitions/session_steps.rb +++ b/features/step_definitions/session_steps.rb @@ -11,7 +11,7 @@ end Given 'I am signed in' do - @me ||= Factory(:user, :getting_started => false) + @me ||= Factory(:user_with_aspect, :getting_started => false) When %(I go to the new user session page) When %(I fill in "Username" with "#{@me.username}") When %(I fill in "Password" with "#{@me.password}") diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb index 4a92c2ec9..e10c93ca4 100644 --- a/features/step_definitions/user_steps.rb +++ b/features/step_definitions/user_steps.rb @@ -1,6 +1,7 @@ Given /^a user with username "([^\"]*)" and password "([^\"]*)"$/ do |username, password| - Factory(:user, :username => username, :password => password, + user = Factory(:user, :username => username, :password => password, :password_confirmation => password, :getting_started => false) + user.aspects.create(:name => "Besties") end Given /^a user with email "([^\"]*)"$/ do |email| diff --git a/public/images/facebox/closelabel.png b/public/images/facebox/closelabel.png old mode 100755 new mode 100644 index c339e59333e4c3b5bc5fd910796fda5469a2515f..74985823a25b8482d7e54d700931f6fe6527053b GIT binary patch delta 111 zcmV-#0FeKv0gM5VBxqAfL_t&-m5qSw)vXL+e6iFrq u+~6-Z-B_(4=t!71b