Skip to content

NoMethodError: undefined method `shutdown' for nil:NilClass #1

@foreverman

Description

@foreverman
require 'test_helper'

class AlertTest < ActiveSupport::TestCase
    setup do 
      @server = SimplerDB::Server.new(8087)
      @thread = Thread.new { @server.start }
      SimpleRecord.establish_connection('sean', '123456', {:connection_mode => :per_thread, :protocol => "http", :port => 8087, :server => 'localhost'})
    end
    test "new" do
        alert = Alert.new
        assert alert.present?, "record is not valid"
    end


    def test_should_report_error
        # some_undefined_variable is not defined elsewhere in the test case
        #some_undefined_variable
        assert true
    end


    teardown do
      SimpleRecord.close_connection
      @server.shutdown
      @thread.join
    end
end
test_should_report_error(AlertTest):
NoMethodError: undefined method `shutdown' for nil:NilClass
    /usr/local/lib/ruby19/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/whiny_nil.rb:52:in`method_missing'
    /usr/local/lib/ruby19/gems/1.9.1/gems/simplerdb-0.2/lib/simplerdb/server.rb:29:in `shutdown'
    test/unit/alert_test.rb:28:in`block in class:AlertTest'
    /usr/local/lib/ruby19/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:182:in `call'
    /usr/local/lib/ruby19/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:182:in`evaluate_method'
    /usr/local/lib/ruby19/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:166:in `call'
    /usr/local/lib/ruby19/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in`block in run'
    /usr/local/lib/ruby19/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `reverse_each'
    /usr/local/lib/ruby19/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in`run'
    /usr/local/lib/ruby19/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:276:in `run_callbacks'
    /usr/local/lib/ruby19/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/testing/setup_and_teardown.rb:29:in`run'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions