diff options
| author | Tyler Mercier <tylermercier@gmail.com> | 2013-07-18 16:17:01 -0600 |
|---|---|---|
| committer | Tyler Mercier <tylermercier@gmail.com> | 2013-07-18 16:17:54 -0600 |
| commit | 44281bbb8f4c7b39e0a70f584b93a304399d0ce7 (patch) | |
| tree | 2c69c1603aaa55905b82e6bdf5d5a6ae3af36c4c /spec | |
| parent | e576fd427f83efda38d65f5cee0dae88f52068a4 (diff) | |
add javascript tests using teaspoon
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/javascripts/fixtures/adder_spec.js.coffee | 5 | ||||
| -rw-r--r-- | spec/javascripts/spec_helper.coffee | 25 | ||||
| -rw-r--r-- | spec/teaspoon_env.rb | 33 |
3 files changed, 63 insertions, 0 deletions
diff --git a/spec/javascripts/fixtures/adder_spec.js.coffee b/spec/javascripts/fixtures/adder_spec.js.coffee new file mode 100644 index 0000000..61aa063 --- /dev/null +++ b/spec/javascripts/fixtures/adder_spec.js.coffee @@ -0,0 +1,5 @@ +describe 'adder', -> + + it 'should add two numbers', -> + result = window.add(1, 3) + expect(result).toEqual(4) diff --git a/spec/javascripts/spec_helper.coffee b/spec/javascripts/spec_helper.coffee new file mode 100644 index 0000000..bd763be --- /dev/null +++ b/spec/javascripts/spec_helper.coffee @@ -0,0 +1,25 @@ +# Teaspoon includes some support files, but you can use anything from your own support path too. +# require support/jasmine-jquery +# require support/sinon +# require support/your-support-file +# +# Deferring execution +# If you're using CommonJS, RequireJS or some other asynchronous library you can defer execution. Call Teaspoon.execute() +# after everything has been loaded. Simple example of a timeout: +# +# Teaspoon.defer = true +# setTimeout(Teaspoon.execute, 1000) +# +# Matching files +# By default Teaspoon will look for files that match _spec.{js,js.coffee,.coffee}. Add a filename_spec.js file in your +# spec path and it'll be included in the default suite automatically. If you want to customize suites, check out the +# configuration in config/initializers/teaspoon.rb +# +# Manifest +# If you'd rather require your spec files manually (to control order for instance) you can disable the suite matcher in +# the configuration and use this file as a manifest. +# +# For more information: http://github.com/modeset/teaspoon +# +# You can require javascript files here. A good place to start is by requiring your application.js. +#= require application diff --git a/spec/teaspoon_env.rb b/spec/teaspoon_env.rb new file mode 100644 index 0000000..196b799 --- /dev/null +++ b/spec/teaspoon_env.rb @@ -0,0 +1,33 @@ +# This file allows you to override various Teaspoon configuration directives when running from the command line. It is not +# required from within the Rails environment, so overriding directives that have been defined within the initializer +# is not possible. +# +# Set RAILS_ROOT and load the environment. +ENV["RAILS_ROOT"] = File.expand_path("../../", __FILE__) +require File.expand_path("../../config/environment", __FILE__) + +# Provide default configuration. +# +# You can override various configuration directives defined here by using arguments with the teaspoon command. +# +# teaspoon --driver=selenium --suppress-log +# rake teaspoon DRIVER=selenium SUPPRESS_LOG=false +Teaspoon.setup do |config| + # Driver / Server + #config.driver = "phantomjs" # available: phantomjs, selenium + #config.server = nil # defaults to Rack::Server + + # Behaviors + #config.server_timeout = 20 # timeout for starting the server + #config.server_port = nil # defaults to any open port unless specified + #config.fail_fast = true # abort after the first failing suite + + # Output + #config.formatters = "dot" # available: dot, tap, tap_y, swayze_or_oprah + #config.suppress_log = false # suppress logs coming from console[log/error/debug] + #config.color = true + + # Coverage (requires istanbul -- https://github.com/gotwarlost/istanbul) + #config.coverage = true + #config.coverage_reports = "text,html,cobertura" +end |
