Newer
Older
# licensed under the Affero General Public License version 3 or later. See
Daniel Vincent Grippi
a validé
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] ||= 'test'
require File.join(File.dirname(__FILE__), '..', 'config', 'environment') unless defined?(Rails)
require 'helper_methods'
include Devise::TestHelpers
include WebMock::API
`rm #{File.join(Rails.root, 'tmp', 'fixture_builder.yml')}`
Michael Sofaer
a validé
#
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
config.before(:each) do
RestClient.stub!(:post).and_return(FakeHttpRequest.new(:success))
end
def set_up_friends
local_luke = Factory(:user_with_aspect, :username => "luke")
local_leia = Factory(:user_with_aspect, :username => "leia")
remote_raphael = Factory(:person, :diaspora_handle => "raphael@remote.net")
connect_users_with_aspects(local_luke, local_leia)
local_leia.activate_contact(remote_raphael, local_leia.aspects.first)
local_luke.activate_contact(remote_raphael, local_luke.aspects.first)
[local_luke, local_leia, remote_raphael]
end
User.where(:username => 'alice').first
end
def bob
User.where(:username => 'bob').first
end
def eve
User.where(:username => 'eve').first
end
FakeRedis.new
end
end
class FakeRedis
ImageUploader.enable_processing = false
Michael Sofaer
a validé
class FakeHttpRequest
def initialize(callback_wanted)
@callback = callback_wanted
@callbacks = []
end
def callbacks=(rs)
@callbacks += rs.reverse
end
def response
@callbacks.pop unless @callbacks.nil? || @callbacks.empty?
end
def response_header
self
end
def method_missing(method)
self
end
Michael Sofaer
a validé
def post(opts = nil);
self
def get(opts = nil)
Michael Sofaer
a validé
self
def publish(opts = nil)
self
end