diff --git a/Gemfile b/Gemfile index decc86c7f..61f2ac22d 100644 --- a/Gemfile +++ b/Gemfile @@ -81,6 +81,6 @@ group :test do gem 'webmock', :require => false gem 'jasmine', :path => 'vendor/gems/jasmine', :require => false gem 'mongrel', :require => false if RUBY_VERSION.include? '1.8' - gem 'rspec-instafail', :require => false + gem 'rspec-instafail', '>= 0.1.7', :require => false gem 'fuubar' end diff --git a/Gemfile.lock b/Gemfile.lock index 3a2996ecb..38a4fbbbf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -324,7 +324,7 @@ GEM rspec-core (2.5.1) rspec-expectations (2.5.0) diff-lcs (~> 1.1.2) - rspec-instafail (0.1.6) + rspec-instafail (0.1.7) rspec-mocks (2.5.0) rspec-rails (2.5.0) actionpack (~> 3.0) @@ -427,7 +427,7 @@ DEPENDENCIES rest-client (= 1.6.1) roxml! rspec (>= 2.0.0) - rspec-instafail + rspec-instafail (>= 0.1.7) rspec-rails (>= 2.0.0) ruby-debug thin (= 1.2.8) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2174c8f2d..64940e9da 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -11,7 +11,7 @@ class ApplicationController < ActionController::Base before_filter :count_requests before_filter :set_invites before_filter :set_locale - before_filter :set_git_header + before_filter :set_git_header if (AppConfig[:git_update] && AppConfig[:git_revision]) before_filter :which_action_and_user prepend_before_filter :clear_gc_stats before_filter :set_grammatical_gender @@ -43,8 +43,8 @@ class ApplicationController < ActionController::Base end def set_git_header - headers['X-Git-Update'] = GIT_UPDATE unless GIT_UPDATE.nil? - headers['X-Git-Revision'] = GIT_REVISION unless GIT_REVISION.nil? + headers['X-Git-Update'] = AppConfig[:git_update] + headers['X-Git-Revision'] = AppConfig[:git_revision] end def which_action_and_user diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index e2bb20881..519f0383e 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -12,12 +12,11 @@ class AspectsController < ApplicationController def index if params[:a_ids] @aspects = current_user.aspects.where(:id => params[:a_ids]).includes(:contacts => {:person => :profile}) - @selected_contacts = @aspects.inject([]){|arr, aspect| arr.concat(aspect.contacts)} - @selected_contacts.uniq! else @aspects = current_user.aspects.includes(:contacts => {:person => :profile}) - @selected_contacts = current_user.contacts.includes(:person => :profile) end + @selected_contacts = @aspects.inject([]){|arr, aspect| arr.concat(aspect.contacts)} + @selected_contacts.uniq! # redirect to signup if (current_user.getting_started == true || @aspects.blank?) && !request.format.mobile? diff --git a/app/helpers/sockets_helper.rb b/app/helpers/sockets_helper.rb index 1c6ee13ac..8010d699b 100644 --- a/app/helpers/sockets_helper.rb +++ b/app/helpers/sockets_helper.rb @@ -58,7 +58,6 @@ module SocketsHelper end rescue Exception => e Rails.logger.error("event=socket_render status=fail user=#{user.diaspora_handle} object=#{object.id.to_s}") - raise e.original_exception if e.respond_to?(:original_exception) raise e end action_hash = {:class =>object.class.to_s.underscore.pluralize, :html => v, :post_id => obj_id(object)} diff --git a/config/initializers/version_header.rb b/config/initializers/version_header.rb index 56ec60cf1..85e48aaae 100644 --- a/config/initializers/version_header.rb +++ b/config/initializers/version_header.rb @@ -5,9 +5,6 @@ git_cmd = `git log -1 --format="%H %ci"` if git_cmd =~ /^([\d\w]+?)\s(.+)$/ - GIT_REVISION = $1 - GIT_UPDATE = $2.strip -else - GIT_REVISION = nil - GIT_UPDATE = nil + AppConfig[:git_revision] = $1 + AppConfig[:git_update] = $2.strip end diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb new file mode 100644 index 000000000..b14770247 --- /dev/null +++ b/spec/controllers/application_controller_spec.rb @@ -0,0 +1,40 @@ +require 'spec_helper' + +describe ApplicationController do + controller do + def user_signed_in? + nil + end + def current_user + nil + end + def index + render :nothing => true + end + end + describe '#set_git_headers' do + context 'with git info' do + before do + AppConfig[:git_update] = 'yesterday' + AppConfig[:git_revision] = '02395' + end + it 'sets the git header if there is git info' do + get :index + response.headers['X-Git-Update'].should == 'yesterday' + response.headers['X-Git-Revision'].should == '02395' + end + end + #this context is commented out because the code to do it gets applied at environment load. + #context 'without git info' do + # before do + # AppConfig.config_vars.delete(:git_update) + # AppConfig.config_vars.delete(:git_revision) + # end + # it 'does not set the headers if there is no git info' do + # get :index + # response.headers.keys.should_not include('X-Git-Update') + # response.headers.keys.should_not include('X-Git-Revision') + # end + #end + end +end diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb index ab29b6d1d..f8fa12c0e 100644 --- a/spec/controllers/home_controller_spec.rb +++ b/spec/controllers/home_controller_spec.rb @@ -30,7 +30,7 @@ describe HomeController do sign_in @user @aspect0 = @user.aspects.all[0] @aspect1 = @user.aspects.create(:name => "Yeaaaah!") - @index_params = {:a_ids => [@aspect0.id.to_s, @aspect1.id.to_s]} + @index_params = {:a_ids => [@aspect0.id.to_s, @aspect1.id.to_s]} @user.aspects.where(:id => @index_params[:a_ids]).update_all(:open => true) @user.save get :show diff --git a/spec/intergration/receiving_spec.rb b/spec/intergration/receiving_spec.rb index 81fbc1ddb..d3cd867ab 100644 --- a/spec/intergration/receiving_spec.rb +++ b/spec/intergration/receiving_spec.rb @@ -308,11 +308,7 @@ describe 'a user receives a post' do end it "should activate the Person if I initiated a request to that url" do - begin - @user1.send_contact_request_to(@user3.person, @aspect) - rescue Exception => e - raise e.original_exception - end + @user1.send_contact_request_to(@user3.person, @aspect) request = @user3.request_from(@user1.person) fantasy_resque do @user3.accept_and_respond(request.id, @aspect3.id)