Commit ef27dbc9 authored by Wandenberg Peixoto's avatar Wandenberg Peixoto

adding new test structure

parent 7eb716b5
......@@ -6,6 +6,7 @@ group :test do
gem 'POpen4', '0.1.4'
gem 'em-http-request', '0.2.14'
gem 'json', '1.4.3'
gem 'jasmine', '1.0.2.1'
platforms :mri_18 do
gem "ruby-debug"
......
......@@ -8,18 +8,37 @@ GEM
RedCloth (4.2.7)
addressable (2.2.2)
archive-tar-minitar (0.5.2)
childprocess (0.2.0)
ffi (~> 1.0.6)
columnize (0.3.2)
diff-lcs (1.1.2)
em-http-request (0.2.14)
addressable (>= 2.0.0)
eventmachine (>= 0.12.9)
eventmachine (0.12.10)
ffi (1.0.9)
github-markup (0.5.3)
jasmine (1.0.2.1)
json_pure (>= 1.4.3)
rack (>= 1.1)
rspec (>= 1.3.1)
selenium-webdriver (>= 0.1.3)
json (1.4.3)
json_pure (1.5.3)
linecache (0.43)
linecache19 (0.5.11)
ruby_core_source (>= 0.1.4)
open4 (1.0.1)
rack (1.3.2)
rake (0.8.7)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
rspec-mocks (~> 2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)
ruby-debug (0.10.4)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.4.0)
......@@ -35,6 +54,12 @@ GEM
ruby-debug-base19 (>= 0.11.19)
ruby_core_source (0.1.4)
archive-tar-minitar (>= 0.5.2)
rubyzip (0.9.4)
selenium-webdriver (2.3.2)
childprocess (>= 0.1.9)
ffi (>= 1.0.7)
json_pure
rubyzip
PLATFORMS
ruby
......@@ -44,6 +69,7 @@ DEPENDENCIES
RedCloth
em-http-request (= 0.2.14)
github-markup
jasmine (= 1.0.2.1)
json (= 1.4.3)
rake
ruby-debug
......
......@@ -34,3 +34,12 @@ task :tests, :executable, :host, :port, :workers, :tests_tmp_dir do |t, args|
require test_case
end
end
begin
require 'jasmine'
load 'jasmine/tasks/jasmine.rake'
rescue LoadError
task :jasmine do
abort "Jasmine is not available. In order to run jasmine, you must: (sudo) gem install jasmine"
end
end
describe("PushStream", function() {
beforeEach(function() {
});
it("should use default port", function() {
expect(PushStream.port).toEqual(80);
});
});
beforeEach(function() {
this.addMatchers({
})
});
# src_files
#
# Return an array of filepaths relative to src_dir to include before jasmine specs.
# Default: []
#
# EXAMPLE:
#
# src_files:
# - lib/source1.js
# - lib/source2.js
# - dist/**/*.js
#
src_files:
- misc/examples/js/jquery-1.4.2.min.js
- misc/examples/js/log4js.js
- misc/examples/js/pushstream.js
# stylesheets
#
# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
# Default: []
#
# EXAMPLE:
#
# stylesheets:
# - css/style.css
# - stylesheets/*.css
#
stylesheets:
# helpers
#
# Return an array of filepaths relative to spec_dir to include before jasmine specs.
# Default: ["helpers/**/*.js"]
#
# EXAMPLE:
#
# helpers:
# - helpers/**/*.js
#
helpers:
# spec_files
#
# Return an array of filepaths relative to spec_dir to include.
# Default: ["**/*[sS]pec.js"]
#
# EXAMPLE:
#
# spec_files:
# - **/*[sS]pec.js
#
spec_files:
# src_dir
#
# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
# Default: project root
#
# EXAMPLE:
#
# src_dir: public
#
src_dir:
../
# spec_dir
#
# Spec directory path. Your spec_files must be returned relative to this path.
# Default: spec/javascripts
#
# EXAMPLE:
#
# spec_dir: spec/javascripts
#
spec_dir:
module Jasmine
class Config
# Add your overrides or custom config code here
end
end
# Note - this is necessary for rspec2, which has removed the backtrace
module Jasmine
class SpecBuilder
def declare_spec(parent, spec)
me = self
example_name = spec["name"]
@spec_ids << spec["id"]
backtrace = @example_locations[parent.description + " " + example_name]
parent.it example_name, {} do
me.report_spec(spec["id"])
end
end
end
end
$:.unshift(ENV['JASMINE_GEM_PATH']) if ENV['JASMINE_GEM_PATH'] # for gem testing purposes
require 'rubygems'
require 'jasmine'
jasmine_config_overrides = File.expand_path(File.join(File.dirname(__FILE__), 'jasmine_config.rb'))
require jasmine_config_overrides if File.exist?(jasmine_config_overrides)
if Jasmine::rspec2?
require 'rspec'
else
require 'spec'
end
jasmine_config = Jasmine::Config.new
spec_builder = Jasmine::SpecBuilder.new(jasmine_config)
should_stop = false
if Jasmine::rspec2?
RSpec.configuration.after(:suite) do
spec_builder.stop if should_stop
end
else
Spec::Runner.configure do |config|
config.after(:suite) do
spec_builder.stop if should_stop
end
end
end
spec_builder.start
should_stop = true
spec_builder.declare_suites
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment