Update rspec-instafail, test git headers
This commit is contained in:
parent
981c37d286
commit
e00a033e9e
9 changed files with 52 additions and 21 deletions
2
Gemfile
2
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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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?
|
||||
|
|
|
|||
|
|
@ -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)}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
40
spec/controllers/application_controller_spec.rb
Normal file
40
spec/controllers/application_controller_spec.rb
Normal file
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue