Skip to content

Commit

Permalink
Starting to make an actual test
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffLtz committed Aug 27, 2008
1 parent b426d43 commit 4d256f7
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 3 deletions.
2 changes: 1 addition & 1 deletion init.rb
@@ -1,2 +1,2 @@
require 'vendor/plugins/annotated_timeline/lib/annotated_timeline.rb'
require File.join(File.dirname(__FILE__), 'lib/annotated_timeline.rb')
ActionView::Base.send(:include, AnnotatedTimeline)
24 changes: 22 additions & 2 deletions test/annotated_timeline_test.rb
Expand Up @@ -7,12 +7,32 @@
require 'action_controller'
require 'action_view'

require 'annotated_timeline'
require 'ostruct'

require File.join(File.dirname(__FILE__), '../lib/annotated_timeline.rb')
include AnnotatedTimeline

require File.dirname(__FILE__) + '/test_helper.rb'

class AnnotatedTimelineTest < Test::Unit::TestCase
# Replace this with your real tests.

#'Sun Aug 24 17:06:15 -0400 2008' 'Sun Aug 26 17:06:15 -0400 2008' 'Sun Aug 28 17:06:15 -0400 2008'

def test_this_plugin

# @timestamp1= OpenStruct.new(:year => '2008')
# @timestamp2= OpenStruct.new(:year => '2008')
# @timestamp3= OpenStruct.new(:year => '2008')

output = annotated_timeline({Time.now =>{:foo=>7, :bar=>9}, 1.days.ago=>{:foo=>6, :bar=>10}, 2.days.ago=>{:foo=>5, :bar=>4}})
assert_match(/data\.addColumn\('date', 'Date'\);/, output, "Should Make Date Column")
assert_match(/data\.addColumn\('number', 'Bar'\);/, output, "Should Make Bar Column")
assert_match(/data\.addColumn\('number', 'Foo'\);/, output, "Should Make Foo Column")
end
#
# def time_ext_stub
#
# end


end
31 changes: 31 additions & 0 deletions test/test_helper.rb
@@ -0,0 +1,31 @@
ENV["RAILSENV"] = "test"
# require File.expand_path(File.join(File.dirname(__FILE__), '../../../../config/boot'))

# #if soap4r is installed as a gem, it totally craps rails. This MUST be at the top of environment.rb
# require 'rubygems'
# gem 'soap4r'
#
# # Remove pointless deprecation warnings
# Object.class_eval "undef type"
# Object.class_eval "undef id;alias id object_id"
# $VERBOSE = nil
#
# # Uncomment below to force Rails into production mode when
# # you don't control web/app server and can't set it the proper way
# # ENV['RAILS_ENV'] ||= 'production'
#
# # Specifies gem version of Rails to use when vendor/rails is not present
# RAILS_GEM_VERSION = '1.2.6' unless defined? RAILS_GEM_VERSION
#
# # Bootstrap the Rails environment, frameworks, and default configuration
# require File.expand_path(File.join(File.dirname(__FILE__), '../../../../config/boot'))
# #
# require 'rubygems'
# gem "rails", "=1.2.6"
# require_gem "rails"



# require 'initializer'

# require 'test_help'

0 comments on commit 4d256f7

Please sign in to comment.