Merge branch 'update-rails'
This commit is contained in:
commit
f213500451
26 changed files with 151 additions and 135 deletions
12
Gemfile
12
Gemfile
|
|
@ -1,7 +1,7 @@
|
|||
source 'http://rubygems.org'
|
||||
|
||||
gem 'rails', '3.0.11'
|
||||
|
||||
gem 'rails', '3.1.4'
|
||||
gem 'rails_autolink'
|
||||
gem 'bundler', '~> 1.1.0'
|
||||
gem 'foreman', '0.34.1'
|
||||
gem 'whenever'
|
||||
|
|
@ -14,7 +14,7 @@ gem 'rack-cors', '~> 0.2.4', :require => 'rack/cors'
|
|||
|
||||
# authentication
|
||||
|
||||
gem 'devise', '~> 1.3.1'
|
||||
gem 'devise', '1.5.3'
|
||||
gem 'jwt'
|
||||
gem 'oauth2-provider', '0.0.19'
|
||||
|
||||
|
|
@ -49,9 +49,9 @@ end
|
|||
gem 'settingslogic', :git => 'git://github.com/binarylogic/settingslogic.git'
|
||||
# database
|
||||
|
||||
gem 'activerecord-import'
|
||||
gem "activerecord-import", "~> 0.2.9"
|
||||
gem 'foreigner', '~> 1.1.0'
|
||||
gem 'mysql2', '0.2.18' if ENV['DB'].nil? || ENV['DB'] == 'all' || ENV['DB'] == 'mysql'
|
||||
gem 'mysql2', '0.3.11' if ENV['DB'].nil? || ENV['DB'] == 'all' || ENV['DB'] == 'mysql'
|
||||
gem 'pg' if ENV['DB'] == 'all' || ENV['DB'] == 'postgres'
|
||||
gem 'sqlite3' if ENV['DB'] == 'all' || ENV['DB'] == 'sqlite'
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ gem 'ruby-oembed', '~> 0.8.7'
|
|||
|
||||
# queue
|
||||
|
||||
gem 'resque', '1.19.0'
|
||||
gem 'resque', '1.20.0'
|
||||
gem 'resque-ensure-connected', :git => 'git://github.com/socialcast/resque-ensure-connected.git'
|
||||
gem 'resque-timeout', '1.0.0'
|
||||
gem 'SystemTimer', '1.2.3', :platforms => :ruby_18
|
||||
|
|
|
|||
150
Gemfile.lock
150
Gemfile.lock
|
|
@ -50,37 +50,38 @@ GEM
|
|||
open4
|
||||
Platform (0.4.0)
|
||||
SystemTimer (1.2.3)
|
||||
abstract (1.0.0)
|
||||
actionmailer (3.0.11)
|
||||
actionpack (= 3.0.11)
|
||||
mail (~> 2.2.19)
|
||||
actionpack (3.0.11)
|
||||
activemodel (= 3.0.11)
|
||||
activesupport (= 3.0.11)
|
||||
builder (~> 2.1.2)
|
||||
erubis (~> 2.6.6)
|
||||
i18n (~> 0.5.0)
|
||||
rack (~> 1.2.1)
|
||||
rack-mount (~> 0.6.14)
|
||||
rack-test (~> 0.5.7)
|
||||
tzinfo (~> 0.3.23)
|
||||
actionmailer (3.1.4)
|
||||
actionpack (= 3.1.4)
|
||||
mail (~> 2.3.0)
|
||||
actionpack (3.1.4)
|
||||
activemodel (= 3.1.4)
|
||||
activesupport (= 3.1.4)
|
||||
builder (~> 3.0.0)
|
||||
erubis (~> 2.7.0)
|
||||
i18n (~> 0.6)
|
||||
rack (~> 1.3.6)
|
||||
rack-cache (~> 1.1)
|
||||
rack-mount (~> 0.8.2)
|
||||
rack-test (~> 0.6.1)
|
||||
sprockets (~> 2.0.3)
|
||||
active_reload (0.6.1)
|
||||
activemodel (3.0.11)
|
||||
activesupport (= 3.0.11)
|
||||
builder (~> 2.1.2)
|
||||
i18n (~> 0.5.0)
|
||||
activerecord (3.0.11)
|
||||
activemodel (= 3.0.11)
|
||||
activesupport (= 3.0.11)
|
||||
arel (~> 2.0.10)
|
||||
tzinfo (~> 0.3.23)
|
||||
activemodel (3.1.4)
|
||||
activesupport (= 3.1.4)
|
||||
builder (~> 3.0.0)
|
||||
i18n (~> 0.6)
|
||||
activerecord (3.1.4)
|
||||
activemodel (= 3.1.4)
|
||||
activesupport (= 3.1.4)
|
||||
arel (~> 2.2.3)
|
||||
tzinfo (~> 0.3.29)
|
||||
activerecord-import (0.2.9)
|
||||
activerecord (~> 3.0)
|
||||
activerecord (~> 3.0)
|
||||
activeresource (3.0.11)
|
||||
activemodel (= 3.0.11)
|
||||
activesupport (= 3.0.11)
|
||||
activesupport (3.0.11)
|
||||
activeresource (3.1.4)
|
||||
activemodel (= 3.1.4)
|
||||
activesupport (= 3.1.4)
|
||||
activesupport (3.1.4)
|
||||
multi_json (~> 1.0)
|
||||
acts_as_api (0.3.11)
|
||||
activemodel (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
|
|
@ -90,9 +91,9 @@ GEM
|
|||
activesupport
|
||||
builder
|
||||
archive-tar-minitar (0.5.2)
|
||||
arel (2.0.10)
|
||||
bcrypt-ruby (2.1.4)
|
||||
builder (2.1.2)
|
||||
arel (2.2.3)
|
||||
bcrypt-ruby (3.0.1)
|
||||
builder (3.0.0)
|
||||
capistrano (2.9.0)
|
||||
highline
|
||||
net-scp (>= 1.0.0)
|
||||
|
|
@ -134,10 +135,10 @@ GEM
|
|||
nokogiri (>= 1.5.0)
|
||||
daemons (1.1.8)
|
||||
database_cleaner (0.7.1)
|
||||
devise (1.3.4)
|
||||
bcrypt-ruby (~> 2.1.2)
|
||||
devise (1.5.3)
|
||||
bcrypt-ruby (~> 3.0)
|
||||
orm_adapter (~> 0.0.3)
|
||||
warden (~> 1.0.3)
|
||||
warden (~> 1.1)
|
||||
diff-lcs (1.1.3)
|
||||
em-http-request (1.0.2)
|
||||
addressable (>= 2.2.3)
|
||||
|
|
@ -149,8 +150,7 @@ GEM
|
|||
eventmachine
|
||||
em-synchrony (1.0.0)
|
||||
eventmachine (>= 1.0.0.beta.1)
|
||||
erubis (2.6.6)
|
||||
abstract (>= 1.0.0)
|
||||
erubis (2.7.0)
|
||||
eventmachine (1.0.0.beta.4)
|
||||
excon (0.12.0)
|
||||
factory_girl (2.6.4)
|
||||
|
|
@ -172,22 +172,13 @@ GEM
|
|||
activesupport (>= 2)
|
||||
fog (1.2.0)
|
||||
builder
|
||||
builder
|
||||
excon (~> 0.12.0)
|
||||
excon (~> 0.12.0)
|
||||
formatador (~> 0.2.0)
|
||||
formatador (~> 0.2.0)
|
||||
mime-types
|
||||
mime-types
|
||||
multi_json (~> 1.0)
|
||||
multi_json (~> 1.0)
|
||||
net-scp (~> 1.0.4)
|
||||
net-scp (~> 1.0.4)
|
||||
net-ssh (>= 2.1.3)
|
||||
net-ssh (>= 2.1.3)
|
||||
nokogiri (~> 1.5.0)
|
||||
nokogiri (~> 1.5.0)
|
||||
ruby-hmac
|
||||
ruby-hmac
|
||||
foreigner (1.1.5)
|
||||
activerecord (>= 3.0.0)
|
||||
|
|
@ -213,10 +204,11 @@ GEM
|
|||
heroku (>= 2)
|
||||
rails (>= 2)
|
||||
highline (1.6.11)
|
||||
hike (1.2.1)
|
||||
hodel_3000_compliant_logger (0.1.0)
|
||||
http_accept_language (1.0.2)
|
||||
http_parser.rb (0.5.3)
|
||||
i18n (0.5.0)
|
||||
i18n (0.6.0)
|
||||
i18n-inflector (2.6.6)
|
||||
i18n (>= 0.4.1)
|
||||
i18n-inflector-rails (1.0.6)
|
||||
|
|
@ -246,13 +238,12 @@ GEM
|
|||
rbx-require-relative (> 0.0.4)
|
||||
linecache19 (0.5.12)
|
||||
ruby_core_source (>= 0.1.4)
|
||||
mail (2.2.19)
|
||||
activesupport (>= 2.3.6)
|
||||
mail (2.3.3)
|
||||
i18n (>= 0.4.0)
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
messagebus_ruby_api (1.0.3)
|
||||
mime-types (1.17.2)
|
||||
mime-types (1.18)
|
||||
mimemagic (0.1.8)
|
||||
mini_magick (3.4)
|
||||
subexec (~> 0.2.1)
|
||||
|
|
@ -267,7 +258,7 @@ GEM
|
|||
gem_plugin (>= 0.2.3)
|
||||
multi_json (1.0.4)
|
||||
multipart-post (1.1.5)
|
||||
mysql2 (0.2.18)
|
||||
mysql2 (0.3.11)
|
||||
net-scp (1.0.4)
|
||||
net-ssh (>= 1.99.1)
|
||||
net-sftp (2.0.5)
|
||||
|
|
@ -311,37 +302,44 @@ GEM
|
|||
pg (0.13.2)
|
||||
polyglot (0.3.3)
|
||||
proxies (0.2.1)
|
||||
rack (1.2.5)
|
||||
rack (1.3.6)
|
||||
rack-cache (1.2)
|
||||
rack (>= 0.4)
|
||||
rack-cors (0.2.4)
|
||||
rack
|
||||
rack-fiber_pool (0.9.2)
|
||||
rack-google-analytics (0.10.0)
|
||||
rack-mobile-detect (0.3.0)
|
||||
rack
|
||||
rack-mount (0.6.14)
|
||||
rack-mount (0.8.3)
|
||||
rack (>= 1.0.0)
|
||||
rack-piwik (0.1.2)
|
||||
rack-protection (1.2.0)
|
||||
rack
|
||||
rack-rewrite (1.2.1)
|
||||
rack-ssl (1.3.2)
|
||||
rack
|
||||
rack-test (0.5.7)
|
||||
rack-test (0.6.1)
|
||||
rack (>= 1.0)
|
||||
rails (3.0.11)
|
||||
actionmailer (= 3.0.11)
|
||||
actionpack (= 3.0.11)
|
||||
activerecord (= 3.0.11)
|
||||
activeresource (= 3.0.11)
|
||||
activesupport (= 3.0.11)
|
||||
rails (3.1.4)
|
||||
actionmailer (= 3.1.4)
|
||||
actionpack (= 3.1.4)
|
||||
activerecord (= 3.1.4)
|
||||
activeresource (= 3.1.4)
|
||||
activesupport (= 3.1.4)
|
||||
bundler (~> 1.0)
|
||||
railties (= 3.0.11)
|
||||
railties (= 3.1.4)
|
||||
rails-i18n (0.5.2)
|
||||
i18n (~> 0.5)
|
||||
railties (3.0.11)
|
||||
actionpack (= 3.0.11)
|
||||
activesupport (= 3.0.11)
|
||||
rails_autolink (1.0.6)
|
||||
rails (~> 3.1)
|
||||
railties (3.1.4)
|
||||
actionpack (= 3.1.4)
|
||||
activesupport (= 3.1.4)
|
||||
rack-ssl (~> 1.3.2)
|
||||
rake (>= 0.8.7)
|
||||
rdoc (~> 3.4)
|
||||
thor (~> 0.14.4)
|
||||
thor (~> 0.14.6)
|
||||
raindrops (0.8.0)
|
||||
rake (0.9.2.2)
|
||||
rbx-require-relative (0.0.9)
|
||||
|
|
@ -351,7 +349,7 @@ GEM
|
|||
redis (2.2.2)
|
||||
redis-namespace (1.0.3)
|
||||
redis (< 3.0.0)
|
||||
resque (1.19.0)
|
||||
resque (1.20.0)
|
||||
multi_json (~> 1.0)
|
||||
redis-namespace (~> 1.0.2)
|
||||
sinatra (>= 0.9.2)
|
||||
|
|
@ -405,9 +403,14 @@ GEM
|
|||
multi_json (~> 1.0.4)
|
||||
rubyzip
|
||||
simple_oauth (0.1.5)
|
||||
sinatra (1.2.8)
|
||||
rack (~> 1.1)
|
||||
tilt (>= 1.2.2, < 2.0)
|
||||
sinatra (1.3.2)
|
||||
rack (~> 1.3, >= 1.3.6)
|
||||
rack-protection (~> 1.2)
|
||||
tilt (~> 1.3, >= 1.3.3)
|
||||
sprockets (2.0.3)
|
||||
hike (~> 1.2)
|
||||
rack (~> 1.0)
|
||||
tilt (~> 1.1, != 1.3.0)
|
||||
sqlite3 (1.3.5)
|
||||
subexec (0.2.1)
|
||||
term-ansicolor (1.0.7)
|
||||
|
|
@ -435,7 +438,7 @@ GEM
|
|||
raindrops (~> 0.7)
|
||||
vegas (0.1.11)
|
||||
rack (>= 1.0.0)
|
||||
warden (1.0.6)
|
||||
warden (1.1.1)
|
||||
rack (>= 1.0)
|
||||
webmock (1.6.2)
|
||||
addressable (>= 2.2.2)
|
||||
|
|
@ -456,7 +459,7 @@ PLATFORMS
|
|||
DEPENDENCIES
|
||||
SystemTimer (= 1.2.3)
|
||||
active_reload
|
||||
activerecord-import
|
||||
activerecord-import (~> 0.2.9)
|
||||
acts-as-taggable-on!
|
||||
acts_as_api
|
||||
addressable (= 2.2.4)
|
||||
|
|
@ -471,7 +474,7 @@ DEPENDENCIES
|
|||
cucumber-api-steps (= 0.6)
|
||||
cucumber-rails (= 1.2.1)
|
||||
database_cleaner (= 0.7.1)
|
||||
devise (~> 1.3.1)
|
||||
devise (= 1.5.3)
|
||||
diaspora-client!
|
||||
em-synchrony (= 1.0.0)
|
||||
factory_girl_rails
|
||||
|
|
@ -498,7 +501,7 @@ DEPENDENCIES
|
|||
mobile-fu
|
||||
mock_redis
|
||||
mongrel
|
||||
mysql2 (= 0.2.18)
|
||||
mysql2 (= 0.3.11)
|
||||
newrelic_rpm
|
||||
nokogiri (= 1.5.0)
|
||||
oauth2-provider (= 0.0.19)
|
||||
|
|
@ -514,10 +517,11 @@ DEPENDENCIES
|
|||
rack-piwik
|
||||
rack-rewrite (~> 1.2.1)
|
||||
rack-ssl
|
||||
rails (= 3.0.11)
|
||||
rails (= 3.1.4)
|
||||
rails-i18n
|
||||
rails_autolink
|
||||
redcarpet (= 2.0.1)
|
||||
resque (= 1.19.0)
|
||||
resque (= 1.20.0)
|
||||
resque-ensure-connected!
|
||||
resque-timeout (= 1.0.0)
|
||||
rest-client (= 1.6.7)
|
||||
|
|
|
|||
|
|
@ -44,8 +44,9 @@ class AspectMembershipsController < ApplicationController
|
|||
def create
|
||||
@person = Person.find(params[:person_id])
|
||||
@aspect = current_user.aspects.where(:id => params[:aspect_id]).first
|
||||
@contact = current_user.share_with(@person, @aspect)
|
||||
|
||||
if @contact = current_user.share_with(@person, @aspect)
|
||||
if @contact
|
||||
flash.now[:notice] = I18n.t('aspects.add_to_aspect.success')
|
||||
respond_with AspectMembership.where(:contact_id => @contact.id, :aspect_id => @aspect.id).first
|
||||
else
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
# the COPYRIGHT file.
|
||||
|
||||
module ApplicationHelper
|
||||
|
||||
def how_long_ago(obj)
|
||||
timeago(obj.created_at)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ module PeopleHelper
|
|||
if search_query.blank?
|
||||
content_tag(:h2, t('people.index.no_results'))
|
||||
else
|
||||
content_tag(:h2, :id => 'search_title') do
|
||||
content_tag(:h2, :id => 'search_title') do
|
||||
t('people.index.results_for').html_safe + ' ' +
|
||||
content_tag(:span, search_query, :class => 'term')
|
||||
content_tag(:span, search_query, :class => 'term')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -66,13 +66,13 @@ module PeopleHelper
|
|||
def person_href(person, opts={})
|
||||
"href=\"#{local_or_remote_person_path(person, opts)}\"".html_safe
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
# Rails.application.routes.url_helpers is needed since this is indirectly called from a model
|
||||
def local_or_remote_person_path(person, opts={})
|
||||
opts.merge!(:protocol => AppConfig[:pod_uri].scheme, :host => AppConfig[:pod_uri].authority)
|
||||
absolute = opts.delete(:absolute)
|
||||
|
||||
|
||||
if person.local?
|
||||
username = person.diaspora_handle.split('@')[0]
|
||||
unless username.include?('.')
|
||||
|
|
@ -84,7 +84,7 @@ module PeopleHelper
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if absolute
|
||||
return Rails.application.routes.url_helpers.person_url(person, opts)
|
||||
else
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class InvitationCode < ActiveRecord::Base
|
|||
|
||||
def generate_token
|
||||
begin
|
||||
self.token = ActiveSupport::SecureRandom.hex(6)
|
||||
self.token = SecureRandom.hex(6)
|
||||
end while InvitationCode.exists?(:token => self[:token])
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class Photo < ActiveRecord::Base
|
|||
photo.pending = params[:pending] if params[:pending]
|
||||
photo.diaspora_handle = photo.author.diaspora_handle
|
||||
|
||||
photo.random_string = ActiveSupport::SecureRandom.hex(10)
|
||||
photo.random_string = SecureRandom.hex(10)
|
||||
|
||||
if params[:user_file]
|
||||
image_file = params.delete(:user_file)
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class User < ActiveRecord::Base
|
|||
has_many :aspects, :order => 'order_id ASC'
|
||||
|
||||
belongs_to :auto_follow_back_aspect, :class_name => 'Aspect'
|
||||
belongs_to :invited_by, :class_name => 'User'
|
||||
belongs_to :invited_by, :class_name => 'User'
|
||||
|
||||
has_many :aspect_memberships, :through => :aspects
|
||||
|
||||
|
|
@ -438,7 +438,7 @@ class User < ActiveRecord::Base
|
|||
self.unconfirmed_email = nil if unconfirmed_email.blank? || unconfirmed_email == email
|
||||
|
||||
if unconfirmed_email_changed?
|
||||
self.confirm_email_token = unconfirmed_email ? ActiveSupport::SecureRandom.hex(15) : nil
|
||||
self.confirm_email_token = unconfirmed_email ? SecureRandom.hex(15) : nil
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -454,10 +454,10 @@ class User < ActiveRecord::Base
|
|||
def generate_keys
|
||||
key_size = (Rails.env == 'test' ? 512 : 4096)
|
||||
|
||||
self.serialized_private_key = OpenSSL::PKey::RSA::generate(key_size) if self.serialized_private_key.blank?
|
||||
self.serialized_private_key = OpenSSL::PKey::RSA::generate(key_size).to_s if self.serialized_private_key.blank?
|
||||
|
||||
if self.person && self.person.serialized_public_key.blank?
|
||||
self.person.serialized_public_key = OpenSSL::PKey::RSA.new(self.serialized_private_key).public_key
|
||||
self.person.serialized_public_key = OpenSSL::PKey::RSA.new(self.serialized_private_key).public_key.to_s
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -495,7 +495,7 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
self[:email] = "deletedaccount_#{self[:id]}@example.org"
|
||||
|
||||
random_password = ActiveSupport::SecureRandom.hex(20)
|
||||
random_password = SecureRandom.hex(20)
|
||||
self.password = random_password
|
||||
self.password_confirmation = random_password
|
||||
self.save(:validate => false)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,9 @@ Diaspora::Application.configure do
|
|||
# ActionMailer::Base.deliveries array.
|
||||
config.action_mailer.delivery_method = :test
|
||||
config.active_support.deprecation = :stderr
|
||||
config.threadsafe!
|
||||
|
||||
# fixes url helper issue in rspec
|
||||
#config.threadsafe!
|
||||
|
||||
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
||||
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
#
|
||||
#
|
||||
#
|
||||
#Why? as of rails 3.0.4, objects are marshalled by calling to yaml, if it is a text field in the db. since we assume things are strings coming out, and pkey does not seem to define a to_yaml, it was getting set to nil
|
||||
##Why? as of rails 3.0.4, objects are marshalled by calling to yaml, if it is a text field in the db. since we assume things are strings coming out, and pkey does not seem to define a to_yaml, it was getting set to nil
|
||||
class OpenSSL::PKey::RSA
|
||||
def to_yaml
|
||||
self.to_s
|
||||
end
|
||||
def to_yaml(opts=nil)
|
||||
self.to_s
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Feature: Close Account
|
|||
When I try to sign in manually
|
||||
Then I should be on the new user session page
|
||||
When I wait for the ajax to finish
|
||||
Then I should see "Your account is locked."
|
||||
Then I should see "Invalid email or password"
|
||||
|
||||
Scenario: post display should not throw error when mention is removed for the user whose account is closed
|
||||
Given a user named "Bob Jones" with email "bob@bob.bob"
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ Feature: following and being followed
|
|||
And I wait for the ajax to finish
|
||||
|
||||
And I fill in "Name" with "Super People" in the modal window
|
||||
And I press "aspect_submit" in the modal window
|
||||
And I press "Create" in the modal window
|
||||
And I wait for the ajax to finish
|
||||
|
||||
When I go to the home page
|
||||
|
|
|
|||
|
|
@ -13,6 +13,6 @@ module Diaspora::Guid
|
|||
|
||||
# @return [String] The model's guid.
|
||||
def set_guid
|
||||
self.guid = ActiveSupport::SecureRandom.hex(8) if self.guid.blank?
|
||||
self.guid = SecureRandom.hex(8) if self.guid.blank?
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ namespace :generate do
|
|||
task :secret_token do
|
||||
|
||||
path = File.join(Rails.root, 'config', 'initializers', 'secret_token.rb')
|
||||
secret = ActiveSupport::SecureRandom.hex(40)
|
||||
secret = SecureRandom.hex(40)
|
||||
File.open(path, 'w') do |f|
|
||||
f.write <<"EOF"
|
||||
# Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace :heroku do
|
|||
|
||||
task :generate_secret_token do
|
||||
puts "Generating and setting a new secret token"
|
||||
token = ActiveSupport::SecureRandom.hex(40)#reloads secret token every time you reload vars.... this expires cookies, and kinda sucks
|
||||
token = SecureRandom.hex(40)#reloads secret token every time you reload vars.... this expires cookies, and kinda sucks
|
||||
command = "#{HEROKU_CONFIG_ADD_COMMAND} SECRET_TOKEN=#{token}"
|
||||
puts command
|
||||
system command
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ var Publisher = {
|
|||
},
|
||||
|
||||
submit: function(){
|
||||
return Publisher.cachedSubmit = Publisher.cachedSubmit || Publisher.form().find('#status_message_submit');
|
||||
return Publisher.cachedSubmit = Publisher.cachedSubmit || Publisher.form().find("input[type='submit']");
|
||||
},
|
||||
|
||||
determineSubmitAvailability: function(){
|
||||
|
|
@ -32,8 +32,8 @@ var Publisher = {
|
|||
isSubmitDisabled = Publisher.submit().attr('disabled'),
|
||||
isPhotoAttached = ($("#photodropzone").children().length > 0);
|
||||
|
||||
if ((onlyWhitespaces && !isPhotoAttached) && !isSubmitDisabled) {
|
||||
Publisher.submit().attr('disabled', true);
|
||||
if ((onlyWhitespaces && !isPhotoAttached) && !isSubmitDisabled) {
|
||||
Publisher.submit().attr('disabled', 'disabled');
|
||||
} else if ((!onlyWhitespaces || isPhotoAttached) && isSubmitDisabled) {
|
||||
Publisher.submit().removeAttr('disabled');
|
||||
}
|
||||
|
|
@ -43,6 +43,8 @@ var Publisher = {
|
|||
$("#photodropzone").find('li').remove();
|
||||
Publisher.input().mentionsInput("reset");
|
||||
Publisher.wrapper().removeClass("with_attachments");
|
||||
Publisher.hiddenInput().val('');
|
||||
Publisher.determineSubmitAvailability()
|
||||
},
|
||||
|
||||
bindServiceIcons: function(){
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ describe AspectMembershipsController do
|
|||
end
|
||||
|
||||
it 'creates a contact' do
|
||||
#argggg why?
|
||||
alice.contacts.reload
|
||||
lambda {
|
||||
post :create,
|
||||
:format => 'js',
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ describe PostsController do
|
|||
get :show, :id => photo.id
|
||||
response.should be_success
|
||||
end
|
||||
|
||||
|
||||
it 'redirects if the post is missing' do
|
||||
get :show, :id => 1234567
|
||||
response.should be_redirect
|
||||
|
|
@ -94,7 +94,7 @@ describe PostsController do
|
|||
end
|
||||
|
||||
it 'assumes guids less than 8 chars are ids and not guids' do
|
||||
Post.should_receive(:where).with(hash_including(:id => @status.id)).and_return(Post)
|
||||
Post.should_receive(:where).with(hash_including(:id => @status.id.to_s)).and_return(Post)
|
||||
get :show, :id => @status.id
|
||||
response.should be_success
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
# http://railscasts.com/episodes/158-factories-not-fixtures
|
||||
|
||||
def r_str
|
||||
ActiveSupport::SecureRandom.hex(3)
|
||||
SecureRandom.hex(3)
|
||||
end
|
||||
|
||||
FactoryGirl.define do
|
||||
|
|
@ -100,7 +100,7 @@ FactoryGirl.define do
|
|||
end
|
||||
|
||||
factory(:photo) do
|
||||
sequence(:random_string) {|n| ActiveSupport::SecureRandom.hex(10) }
|
||||
sequence(:random_string) {|n| SecureRandom.hex(10) }
|
||||
association :author, :factory => :person
|
||||
after_build do |p|
|
||||
p.unprocessed_image.store! File.open(File.join(File.dirname(__FILE__), 'fixtures', 'button.png'))
|
||||
|
|
@ -237,7 +237,7 @@ FactoryGirl.define do
|
|||
end
|
||||
|
||||
factory(:note, :parent => :status_message) do
|
||||
text ActiveSupport::SecureRandom.hex(1000)
|
||||
text SecureRandom.hex(1000)
|
||||
end
|
||||
|
||||
factory(:rich_media, :parent => :status_message) do
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ require 'spec_helper'
|
|||
|
||||
describe NotificationsHelper do
|
||||
include ApplicationHelper
|
||||
|
||||
before do
|
||||
@user = Factory(:user)
|
||||
@person = Factory(:person)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ describe PeopleHelper do
|
|||
@user = alice
|
||||
@person = Factory(:person)
|
||||
end
|
||||
|
||||
describe "#person_image_link" do
|
||||
it "returns an empty string if person is nil" do
|
||||
person_image_link(nil).should == ""
|
||||
|
|
@ -62,12 +63,12 @@ describe PeopleHelper do
|
|||
describe "#person_href" do
|
||||
it "calls local_or_remote_person_path and passes through the options" do
|
||||
opts = {:absolute => true}
|
||||
|
||||
|
||||
self.should_receive(:local_or_remote_person_path).with(@person, opts).exactly(1).times
|
||||
|
||||
|
||||
person_href(@person, opts)
|
||||
end
|
||||
|
||||
|
||||
it "returns a href attribute" do
|
||||
person_href(@person).should include "href="
|
||||
end
|
||||
|
|
@ -77,7 +78,7 @@ describe PeopleHelper do
|
|||
before do
|
||||
@user = Factory(:user)
|
||||
end
|
||||
|
||||
|
||||
it "links by id if there is a period in the user's username" do
|
||||
@user.username = "invalid.username"
|
||||
@user.save(:validate => false).should == true
|
||||
|
|
@ -91,7 +92,7 @@ describe PeopleHelper do
|
|||
it 'links by username for a local user' do
|
||||
local_or_remote_person_path(@user.person).should == user_profile_path(:username => @user.username)
|
||||
end
|
||||
|
||||
|
||||
it 'links by id for a remote person' do
|
||||
local_or_remote_person_path(@person).should == person_path(@person)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,11 +5,13 @@ describe TagsHelper do
|
|||
it 'returns nil if there is a @ in the query' do
|
||||
helper.stub(:search_query).and_return('foo@bar.com')
|
||||
helper.looking_for_tag_link.should be_nil
|
||||
end
|
||||
end
|
||||
|
||||
it 'returns nil if it normalizes to blank' do
|
||||
helper.stub(:search_query).and_return('++')
|
||||
helper.looking_for_tag_link.should be_nil
|
||||
end
|
||||
|
||||
it 'returns a link to the tag otherwise' do
|
||||
helper.stub(:search_query).and_return('foo')
|
||||
helper.looking_for_tag_link.should include(helper.tag_link)
|
||||
|
|
|
|||
|
|
@ -27,9 +27,7 @@ describe Person do
|
|||
Person.for_json.first.serialized_public_key
|
||||
}.should raise_error ActiveModel::MissingAttributeError
|
||||
end
|
||||
it 'eager loads profiles' do
|
||||
Person.for_json.first.loaded_profile?.should be_true
|
||||
end
|
||||
|
||||
it 'selects distinct people' do
|
||||
aspect = bob.aspects.create(:name => 'hilarious people')
|
||||
aspect.contacts << bob.contact_for(eve.person)
|
||||
|
|
|
|||
|
|
@ -3,17 +3,19 @@ require 'spec_helper'
|
|||
describe Service do
|
||||
|
||||
before do
|
||||
@user = alice
|
||||
@post = @user.post(:status_message, :text => "hello", :to =>@user.aspects.first.id)
|
||||
@service = Services::Facebook.new(:access_token => "yeah")
|
||||
@user.services << @service
|
||||
@post = alice.post(:status_message, :text => "hello", :to => alice.aspects.first.id)
|
||||
@service = Services::Facebook.new(:access_token => "yeah", :uid => 1)
|
||||
alice.services << @service
|
||||
end
|
||||
|
||||
it 'is unique to a user by service type and uid' do
|
||||
@service.save
|
||||
@user.services << Services::Facebook.new(:access_token => "yeah")
|
||||
@user.services[1].valid?.should be_false
|
||||
|
||||
second_service = Services::Facebook.new(:access_token => "yeah", :uid => 1)
|
||||
|
||||
alice.services << second_service
|
||||
alice.services.last.save
|
||||
alice.services.last.should be_invalid
|
||||
end
|
||||
|
||||
it 'destroys the associated service_user' do
|
||||
|
|
@ -28,6 +30,6 @@ describe Service do
|
|||
end
|
||||
|
||||
it 'by default has no profile photo url' do
|
||||
Service.new.profile_photo_url.should == nil
|
||||
Service.new.profile_photo_url.should be_nil
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -30,17 +30,17 @@ describe Services::Twitter do
|
|||
end
|
||||
describe "message size limits" do
|
||||
before :each do
|
||||
@long_message_start = ActiveSupport::SecureRandom.hex(25)
|
||||
@long_message_end = ActiveSupport::SecureRandom.hex(25)
|
||||
@long_message_start = SecureRandom.hex(25)
|
||||
@long_message_end = SecureRandom.hex(25)
|
||||
end
|
||||
|
||||
it "should not truncate a short message" do
|
||||
short_message = ActiveSupport::SecureRandom.hex(20)
|
||||
short_message = SecureRandom.hex(20)
|
||||
short_post = stub(:text => short_message )
|
||||
@service.public_message(short_post, '').should == short_message
|
||||
end
|
||||
it "should truncate a long message" do
|
||||
long_message = ActiveSupport::SecureRandom.hex(220)
|
||||
long_message = SecureRandom.hex(220)
|
||||
long_post = stub(:text => long_message )
|
||||
@service.public_message(long_post, '').should == long_message.first(137) + "..."
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ describe User do
|
|||
|
||||
it 'marshalls the key to and from the db correctly' do
|
||||
user = User.build(:username => 'max', :email => 'foo@bar.com', :password => 'password', :password_confirmation => 'password')
|
||||
|
||||
user.save!
|
||||
user.serialized_private_key.should be_present
|
||||
|
||||
expect{
|
||||
user.reload.encryption_key
|
||||
|
|
@ -846,7 +848,7 @@ describe User do
|
|||
describe "#clear_account!" do
|
||||
it 'resets the password to a random string' do
|
||||
random_pass = "12345678909876543210"
|
||||
ActiveSupport::SecureRandom.should_receive(:hex).and_return(random_pass)
|
||||
SecureRandom.should_receive(:hex).and_return(random_pass)
|
||||
@user.clear_account!
|
||||
@user.valid_password?(random_pass)
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue