Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8301031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:47:04+00:00 2026-06-08T16:47:04+00:00

I am new to Ruby and needed some assistance figuring something out: I’ve been

  • 0

I am new to Ruby and needed some assistance figuring something out: I’ve been stuck on this error for 2 days. I know if I figure out the connect issue everything is going to work perfectly. Please help.

#test_helper.rb

$LOAD_PATH<< File.expand_path(__FILE__)
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
Rails.env='test'
require 'rails/test_help'
require 'action_view/test_case'
require 'factory_girl'
require 'capybara/rails'
require 'capybara/dsl'
require 'factories'

DatabaseCleaner.strategy = :truncation

class ActiveSupport::TestCase
  # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
  #
  # Note: You'll currently still have to declare fixtures explicitly in integration tests
  # -- they do not yet inherit this setting
  fixtures :all

  include Devise::TestHelpers


end

class  ActionController::TestCase
  setup do
    DatabaseCleaner.start  
  end

  teardown do
    DatabaseCleaner.clean       # Truncate the database
  end
end


class ActionDispatch::IntegrationTest
  # Make the Capybara DSL available in all integration tests
  include Capybara::DSL
  include Warden::Test::Helpers
  include Capybara::RSpecMatchers
  Warden.test_mode!
  # Stop ActiveRecord from wrapping tests in transactions
  self.use_transactional_fixtures = false

  teardown do
    DatabaseCleaner.clean       # Truncate the database
    Capybara.reset_sessions!    # Forget the (simulated) browser state
    Capybara.use_default_driver # Revert Capybara.current_driver to Capybara.default_driver
  end

end

class ActionController::TestCase
  # include Devise::TestHelpers
end

require 'selenium-webdriver'
module ::Selenium::WebDriver::Firefox
  class Bridge
    attr_accessor :speed

    def execute(*args)
      result = raw_execute(*args)['value']
      case speed
        when :slow
          sleep 0.3
        when :medium
          sleep 0.1
      end
      result
    end
  end
end

def set_speed(speed)
  begin
    page.driver.browser.send(:bridge).speed=speed
  rescue
  end
end

#test/unit/project_test.rb

require 'test_helper'

class ProjectTest < ActiveSupport::TestCase
  # test "the truth" do
  #   assert true
  # end

  setup do
    DatabaseCleaner.start
    @user = FactoryGirl.create(:user)
    @company = FactoryGirl.create(:company, :name=>'MegaTesters')
    @project = FactoryGirl.create(:project, :name=>'testProject', :budget=>100000)
    assert @project.valid?
    @sow = @project.contracts.create :name=>"first", :company=>@company, :type=>"Sow"
    @invoice = @sow.invoices.create :amount=>25000
    @payment = @invoice.payments.create :amount=>10000

  end

  teardown do
    DatabaseCleaner.clean       # Truncate the database
  end

  test "remaining funds" do

  end
end

#STACK TRACE:

bundle exec rake test:units TEST=test/unit/project_test.rb --trace
(in /Users/higgs001/Sandbox/att-innovate/foundry_ledger)
** Invoke test:units (first_time)
** Invoke test:prepare (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment 
** Execute db:test:purge
** Execute db:test:load
** Invoke db:test:load_schema (first_time)
** Invoke db:test:purge 
** Execute db:test:load_schema
** Invoke db:schema:load (first_time)
** Invoke environment 
** Execute db:schema:load
NOTICE:  CREATE TABLE will create implicit sequence "assignments_id_seq" for serial column "assignments.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "assignments_pkey" for table "assignments"
NOTICE:  CREATE TABLE will create implicit sequence "attachments_id_seq" for serial column "attachments.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "attachments_pkey" for table "attachments"
NOTICE:  CREATE TABLE will create implicit sequence "companies_id_seq" for serial column "companies.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "companies_pkey" for table "companies"
NOTICE:  CREATE TABLE will create implicit sequence "contracts_id_seq" for serial column "contracts.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "contracts_pkey" for table "contracts"
NOTICE:  CREATE TABLE will create implicit sequence "fundings_id_seq" for serial column "fundings.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "fundings_pkey" for table "fundings"
NOTICE:  CREATE TABLE will create implicit sequence "invoices_id_seq" for serial column "invoices.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "invoices_pkey" for table "invoices"
NOTICE:  CREATE TABLE will create implicit sequence "lockers_id_seq" for serial column "lockers.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "lockers_pkey" for table "lockers"
NOTICE:  CREATE TABLE will create implicit sequence "pages_id_seq" for serial column "pages.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "pages_pkey" for table "pages"
NOTICE:  CREATE TABLE will create implicit sequence "payments_id_seq" for serial column "payments.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "payments_pkey" for table "payments"
NOTICE:  CREATE TABLE will create implicit sequence "projects_id_seq" for serial column "projects.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "projects_pkey" for table "projects"
NOTICE:  CREATE TABLE will create implicit sequence "queue_classic_jobs_id_seq" for serial column "queue_classic_jobs.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "queue_classic_jobs_pkey" for table "queue_classic_jobs"
NOTICE:  CREATE TABLE will create implicit sequence "users_id_seq" for serial column "users.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "users_pkey" for table "users"
NOTICE:  CREATE TABLE will create implicit sequence "versions_id_seq" for serial column "versions.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "versions_pkey" for table "versions"
** Execute test:prepare
** Execute test:units
Run options: --seed 14051

# Running tests:

E

Finished tests in 0.802822s, 1.2456 tests/s, 0.0000 assertions/s.

  1) Error:
test_remaining_funds(ProjectTest):
Errno::ECONNREFUSED: Connection refused - connect(2)
    /Users/higgs001/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/http.rb:644:in `initialize'
    /Users/higgs001/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/http.rb:644:in `open'
    /Users/higgs001/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/http.rb:644:in `block in connect'
    /Users/higgs001/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/timeout.rb:44:in `timeout'
    /Users/higgs001/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/timeout.rb:89:in `timeout'
    /Users/higgs001/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/http.rb:644:in `connect'
    /Users/higgs001/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/http.rb:637:in `do_start'
    /Users/higgs001/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/http.rb:626:in `start'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/rest-client-1.6.7/lib/restclient.rb:72:in `post'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/tire-0.4.2/lib/tire/http/client.rb:19:in `post'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/tire-0.4.2/lib/tire/index.rb:80:in `store'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/tire-0.4.2/lib/tire/model/search.rb:134:in `block in update_index'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:403:in `_run__2302947893627650000__update_elasticsearch_index__985824136385614657__callbacks'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:405:in `__run_callback'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:385:in `_run_update_elasticsearch_index_callbacks'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/tire-0.4.2/lib/tire/model/search.rb:130:in `update_index'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/tire-0.4.2/lib/tire/model/callbacks.rb:21:in `block in included'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:471:in `_run__2302947893627650000__save__985824136385614657__callbacks'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:405:in `__run_callback'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:81:in `run_callbacks'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.6/lib/active_record/callbacks.rb:264:in `create_or_update'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.6/lib/active_record/persistence.rb:104:in `save!'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.6/lib/active_record/validations.rb:56:in `save!'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.6/lib/active_record/attribute_methods/dirty.rb:33:in `save!'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.6/lib/active_record/transactions.rb:246:in `block in save!'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.6/lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.6/lib/active_record/transactions.rb:208:in `transaction'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.6/lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.6/lib/active_record/transactions.rb:246:in `save!'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/factory_girl-3.5.0/lib/factory_girl/configuration.rb:18:in `block in initialize'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/factory_girl-3.5.0/lib/factory_girl/evaluation.rb:15:in `[]'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/factory_girl-3.5.0/lib/factory_girl/evaluation.rb:15:in `create'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/factory_girl-3.5.0/lib/factory_girl/strategy/create.rb:12:in `block in result'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/factory_girl-3.5.0/lib/factory_girl/strategy/create.rb:9:in `tap'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/factory_girl-3.5.0/lib/factory_girl/strategy/create.rb:9:in `result'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/factory_girl-3.5.0/lib/factory_girl/factory.rb:42:in `run'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/factory_girl-3.5.0/lib/factory_girl/factory_runner.rb:23:in `block in run'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/notifications.rb:125:in `instrument'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/factory_girl-3.5.0/lib/factory_girl/factory_runner.rb:22:in `run'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/factory_girl-3.5.0/lib/factory_girl/strategy_syntax_method_registrar.rb:19:in `block in define_singular_strategy_method'
    /Users/higgs001/Sandbox/att-innovate/foundry_ledger/test/unit/project_test.rb:11:in `block in <class:ProjectTest>'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:429:in `_run__3361187329649106861__setup__985824136385614657__callbacks'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:405:in `__run_callback'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:81:in `run_callbacks'
    /Users/higgs001/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/testing/setup_and_teardown.rb:35:in `run'

1 tests, 0 assertions, 0 failures, 1 errors, 0 skips
rake aborted!
Command failed with status (1): [/Users/higgs001/.rvm/rubies/ruby-1.9.2-p32...]
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `call'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `sh'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `sh'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:82:in `ruby'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `ruby'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/testtask.rb:99:in `block (2 levels) in define'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:60:in `verbose'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/testtask.rb:98:in `block in define'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/higgs001/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/bin/rake:19:in `load'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320@global/bin/rake:19:in `<main>'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320/bin/ruby_noexec_wrapper:14:in `eval'
/Users/higgs001/.rvm/gems/ruby-1.9.2-p320/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => test:units    
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T16:47:08+00:00Added an answer on June 8, 2026 at 4:47 pm

    ElasticSearch needs to be configured. Special thanks to Lee Hambley.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im new to ruby, wrote this code and works but i know is not
I'm brand new to ruby and rails and I'm having trouble creating a sign-out
I'm new Ruby but been a .net dev for many a year. I want
Learning Ruby. Needed to create a hash of arrays. This works... but I don't
I have been trying to find a solution to this for some time. I
I'm relatively new to Ruby and have limited time therefore I try out simple
I am looking for NEW Ruby on Rails resource websites (Screencasts, Tutorials, etc) some
I am new to ruby and started using it for the last few days,
I'm currently evaluating options for adding sub-domain support to a new Ruby on Rails
new on ruby and using windows xp and rails 3, i want to send

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.