Commit e5cb549d
Changed files (7)
config
initializers
spec
javascripts
helpers
config/initializers/teaspoon.rb
@@ -0,0 +1,64 @@
+Teaspoon.setup do |config|
+
+ # This determines where the Teaspoon routes will be mounted. Changing this to "/jasmine" would allow you to browse to
+ # http://localhost:3000/jasmine to run your specs.
+ config.mount_at = "/teaspoon"
+
+ # This defaults to Rails.root if left nil. If you're testing an engine using a dummy application it can be useful to
+ # set this to your engines root.. E.g. `Teaspoon::Engine.root`
+ config.root = nil
+
+ # These paths are appended to the Rails assets paths (relative to config.root), and by default is an array that you
+ # can replace or add to.
+ config.asset_paths = ["spec/javascripts", "spec/javascripts/stylesheets"]
+
+ # Fixtures are rendered through a standard controller. This means you can use things like HAML or RABL/JBuilder, etc.
+ # to generate fixtures within this path.
+ config.fixture_path = "spec/javascripts/fixtures"
+
+ # You can modify the default suite configuration and create new suites here. Suites can be isolated from one another.
+ # When defining a suite you can provide a name and a block. If the name is left blank, :default is assumed. You can
+ # omit various directives and the defaults will be used.
+ #
+ # To run a specific suite
+ # - in the browser: http://localhost/teaspoon/[suite_name]
+ # - from the command line: rake teaspoon suite=[suite_name]
+ config.suite do |suite|
+
+ # You can specify a file matcher and all matching files will be loaded when the suite is run. It's important that
+ # these files are serve-able from sprockets.
+ #
+ # Note: Can also be set to nil.
+ suite.matcher = "{spec/javascripts,app/assets}/**/*_spec.{js,js.coffee,coffee}"
+
+ # Each suite can load a different helper, which can in turn require additional files. This file is loaded before
+ # your specs are loaded, and can be used as a manifest.
+ suite.helper = "spec_helper"
+
+ # These are the core Teaspoon javascripts. It's strongly encouraged to include only the base files here. You can
+ # require other support libraries in your spec helper, which allows you to change them without having to restart the
+ # server.
+ #
+ # Available frameworks: teaspoon-jasmine, teaspoon-mocha, teaspoon-qunit
+ #
+ # Note: To use the CoffeeScript source files use `"teaspoon/jasmine"` etc.
+ suite.javascripts = ["teaspoon-jasmine"]
+
+ # If you want to change how Teaspoon looks, or include your own stylesheets you can do that here. The default is the
+ # stylesheet for the HTML reporter.
+ suite.stylesheets = ["teaspoon"]
+
+ # When running coverage reports, you probably want to exclude libraries that you're not testing.
+ # Accepts an array of filenames or regular expressions. The default is to exclude assets from vendors or gems.
+ suite.no_coverage = [%r{/lib/ruby/gems/}, %r{/vendor/assets/}, %r{/support/}, %r{/(.+)_helper.}]
+ # suite.no_coverage << "jquery.min.js" # excludes jquery from coverage reports
+
+ end
+
+ # Example suite. Since we're just filtering to files already within the root spec/javascripts, these files will also
+ # be run in the default suite -- but can be focused into a more specific suite.
+ #config.suite :targeted do |suite|
+ # suite.matcher = "spec/javascripts/targeted/*_spec.{js,js.coffee,coffee}"
+ #end
+
+end if defined?(Teaspoon) && Teaspoon.respond_to?(:setup) # let Teaspoon be undefined outside of development/test/asset groups
spec/javascripts/helpers/.gitkeep
spec/javascripts/helpers/SpecHelper.js
@@ -1,9 +0,0 @@
-beforeEach(function() {
- this.addMatchers({
- toBePlaying: function(expectedSong) {
- var player = this.actual;
- return player.currentlyPlayingSong === expectedSong
- && player.isPlaying;
- }
- })
-});
spec/javascripts/spec_helper.js
@@ -0,0 +1,26 @@
+// 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
+
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
Gemfile
@@ -45,7 +45,7 @@ end
group :development, :test do
gem 'sqlite3'
gem 'rspec-rails'
- gem 'jasmine'
+ gem 'teaspoon'
gem 'rack-mini-profiler'
gem 'database_cleaner'
gem 'factory_girl_rails'
@@ -54,9 +54,11 @@ group :development, :test do
gem 'simplecov'
gem 'ffaker'
end
+
group :staging do
gem 'rack-mini-profiler'
end
+
group :production, :staging do
gem 'fog'
gem 'newrelic_rpm'
Gemfile.lock
@@ -68,8 +68,6 @@ GEM
json (>= 1.7)
carrierwave_backgrounder (0.2.2)
carrierwave (~> 0.5)
- childprocess (0.3.9)
- ffi (~> 1.0, >= 1.0.11)
coderay (1.0.9)
coffee-rails (4.0.0)
coffee-script (>= 2.2.0)
@@ -96,6 +94,7 @@ GEM
dotenv-rails (0.8.0)
dotenv (= 0.8.0)
erubis (2.7.0)
+ eventmachine (1.0.3)
excon (0.25.3)
execjs (1.4.0)
multi_json (~> 1.0)
@@ -108,8 +107,9 @@ GEM
fakes-rspec (1.0.5)
fakes
rspec
+ faye-websocket (0.4.7)
+ eventmachine (>= 0.12.0)
ffaker (1.16.2)
- ffi (1.9.0)
fog (1.14.0)
builder
excon (~> 0.25.0)
@@ -124,13 +124,8 @@ GEM
geocoder (1.1.8)
highline (1.6.19)
hike (1.2.3)
+ http_parser.rb (0.5.3)
i18n (0.6.4)
- jasmine (1.3.2)
- jasmine-core (~> 1.3.1)
- rack (~> 1.0)
- rspec (>= 1.3.1)
- selenium-webdriver (>= 0.1.3)
- jasmine-core (1.3.1)
jbuilder (1.4.2)
activesupport (>= 3.0.0)
multi_json (>= 1.2.0)
@@ -170,6 +165,12 @@ GEM
mini_portile (~> 0.5.0)
orm_adapter (0.4.0)
pg (0.16.0)
+ phantomjs (1.8.1.1)
+ poltergeist
+ poltergeist (1.3.0)
+ capybara (~> 2.1.0)
+ faye-websocket (>= 0.4.4, < 0.5.0)
+ http_parser.rb (~> 0.5.3)
polyglot (0.3.3)
rack (1.5.2)
rack-mini-profiler (0.1.27)
@@ -209,7 +210,6 @@ GEM
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
ruby-hmac (0.4.0)
- rubyzip (0.9.9)
rvm-capistrano (1.4.1)
capistrano (>= 2.0.0)
sass (3.2.10)
@@ -220,11 +220,6 @@ GEM
sdoc (0.3.20)
json (>= 1.1.3)
rdoc (~> 3.10)
- selenium-webdriver (2.33.0)
- childprocess (>= 0.2.5)
- multi_json (~> 1.0)
- rubyzip
- websocket (~> 1.0.4)
simplecov (0.7.1)
multi_json (~> 1.0)
simplecov-html (~> 0.7.1)
@@ -240,6 +235,9 @@ GEM
sprockets (~> 2.8)
sqlite3 (1.3.7)
stringex (2.0.6)
+ teaspoon (0.7.4)
+ phantomjs (>= 1.8.1.1)
+ railties (>= 3.2.5, < 5)
thor (0.18.1)
thread_safe (0.1.2)
atomic
@@ -256,7 +254,6 @@ GEM
uniform_notifier (1.2.0)
warden (1.2.3)
rack (>= 1.0)
- websocket (1.0.7)
xpath (2.0.0)
nokogiri (~> 1.3)
@@ -289,7 +286,6 @@ DEPENDENCIES
ffaker
fog
geocoder
- jasmine
jbuilder (~> 1.2)
jquery-fileupload-rails
jquery-rails
@@ -307,5 +303,6 @@ DEPENDENCIES
sdoc
simplecov
sqlite3
+ teaspoon
turbolinks
uglifier (>= 1.3.0)