Commit 211174b5

mo khan <mo@mokhan.ca>
2014-06-10 02:25:08
fix teaspoon errors.
1 parent 09d2c79
Changed files (4)
config/initializers/teaspoon.rb
@@ -1,64 +0,0 @@
-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
db/schema.rb
@@ -30,8 +30,8 @@ ActiveRecord::Schema.define(version: 20140607232108) do
 
   create_table "avatars", force: true do |t|
     t.integer  "user_id"
-    t.datetime "created_at"
-    t.datetime "updated_at"
+    t.datetime "created_at",        null: false
+    t.datetime "updated_at",        null: false
     t.string   "avatar"
     t.boolean  "avatar_processing"
     t.string   "avatar_tmp"
@@ -93,8 +93,8 @@ ActiveRecord::Schema.define(version: 20140607232108) do
     t.datetime "failed_at"
     t.string   "locked_by"
     t.string   "queue"
-    t.datetime "created_at"
-    t.datetime "updated_at"
+    t.datetime "created_at",             null: false
+    t.datetime "updated_at",             null: false
   end
 
   add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree
@@ -111,8 +111,8 @@ ActiveRecord::Schema.define(version: 20140607232108) do
 
   create_table "interests", force: true do |t|
     t.string   "name"
-    t.datetime "created_at"
-    t.datetime "updated_at"
+    t.datetime "created_at", null: false
+    t.datetime "updated_at", null: false
   end
 
   create_table "photos", force: true do |t|
@@ -156,8 +156,8 @@ ActiveRecord::Schema.define(version: 20140607232108) do
     t.text     "description"
     t.string   "url"
     t.integer  "user_id"
-    t.datetime "created_at"
-    t.datetime "updated_at"
+    t.datetime "created_at",  null: false
+    t.datetime "updated_at",  null: false
     t.string   "image_url"
     t.string   "author"
     t.string   "author_url"
@@ -166,12 +166,12 @@ ActiveRecord::Schema.define(version: 20140607232108) do
   add_index "tutorials", ["user_id"], name: "index_tutorials_on_user_id", using: :btree
 
   create_table "users", force: true do |t|
-    t.string   "email",                  default: "", null: false
-    t.string   "encrypted_password",     default: "", null: false
+    t.string   "email",                              default: "", null: false
+    t.string   "encrypted_password",     limit: 128, default: "", null: false
     t.string   "reset_password_token"
     t.datetime "reset_password_sent_at"
     t.datetime "remember_created_at"
-    t.integer  "sign_in_count",          default: 0
+    t.integer  "sign_in_count",                      default: 0
     t.datetime "current_sign_in_at"
     t.datetime "last_sign_in_at"
     t.string   "current_sign_in_ip"
@@ -190,13 +190,13 @@ ActiveRecord::Schema.define(version: 20140607232108) do
     t.datetime "confirmed_at"
     t.datetime "confirmation_sent_at"
     t.string   "unconfirmed_email"
-    t.integer  "failed_attempts",        default: 0
+    t.integer  "failed_attempts",                    default: 0
     t.string   "unlock_token"
     t.datetime "locked_at"
     t.string   "authentication_token"
     t.string   "invitation_token"
     t.string   "full_address"
-    t.integer  "creations_count",        default: 0
+    t.integer  "creations_count",                    default: 0
     t.boolean  "is_admin"
   end
 
spec/javascripts/spec_helper.js
@@ -1,11 +1,16 @@
 // Teaspoon includes some support files, but you can use anything from your own support path too.
-// require support/jasmine-jquery
+// require support/jasmine-jquery-1.7.0
+// require support/jasmine-jquery-2.0.0
 // require support/sinon
 // require support/your-support-file
 //
+// PhantomJS (Teaspoons default driver) doesn't have support for Function.prototype.bind, which has caused confusion.
+// Use this polyfill to avoid the confusion.
+//= require support/bind-poly
+//
 // 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:
+// 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)
@@ -21,6 +26,6 @@
 //
 // 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.
+// You can require your own javascript files here. By default this will include everything in application, however you
+// may get better load performance if you require the specific files that are being used in the spec that tests them.
 //= require application
-
spec/teaspoon_env.rb
@@ -1,33 +1,182 @@
-# 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"
+# Set RAILS_ROOT and load the environment if it's not already loaded.
+unless defined?(Rails)
+  ENV["RAILS_ROOT"] = File.expand_path("../../", __FILE__)
+  require File.expand_path("../../config/environment", __FILE__)
+end
+
+Teaspoon.configure do |config|
+
+  # 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 tests.
+  #config.mount_at = "/teaspoon"
+
+  # Specifies the root where Teaspoon will look for files. 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`).
+  # Note: Defaults to `Rails.root` if nil.
+  #config.root = nil
+
+  # Paths that will be appended to the Rails assets paths
+  # Note: Relative to `config.root`.
+  #config.asset_paths = ["spec/javascripts", "spec/javascripts/stylesheets"]
+
+  # Fixtures are rendered through a controller, which allows using HAML, RABL/JBuilder, etc. Files in these paths will
+  # be rendered as fixtures.
+  #config.fixture_paths = ["spec/javascripts/fixtures"]
+
+  # SUITES
+  #
+  # You can modify the default suite configuration and create new suites here. Suites are 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 ones defined in the default suite will be used.
+  #
+  # To run a specific suite
+  # - in the browser: http://localhost/teaspoon/[suite_name]
+  # - with the rake task: rake teaspoon suite=[suite_name]
+  # - with the cli: teaspoon --suite=[suite_name]
+  config.suite do |suite|
+
+    # Specify the framework you would like to use. This allows you to select versions, and will do some basic setup for
+    # you -- which you can override with the directives below. This should be specified first, as it can override other
+    # directives.
+    # Note: If no version is specified, the latest is assumed.
+    #
+    # Available: jasmine[1.3.1, 2.0.0], mocha[1.10.0, 1.17.1] qunit[1.12.0, 1.14.0]
+    suite.use_framework :jasmine, "1.3.1"
+
+    # Specify a file matcher as a regular expression and all matching files will be loaded when the suite is run. These
+    # files need to be within an asset path. You can add asset paths using the `config.asset_paths`.
+    #suite.matcher = "{spec/javascripts,app/assets}/**/*_spec.{js,js.coffee,coffee}"
+
+    # This suites spec helper, which can require additional support files. This file is loaded before any of your test
+    # files are loaded.
+    #suite.helper = "spec_helper"
+
+    # The core Teaspoon javascripts. It's recommended to include only the base files here, as you can require support
+    # libraries from your spec helper.
+    # Note: For CoffeeScript files use `"teaspoon/jasmine"` etc.
+    #
+    # Available: teaspoon-jasmine, teaspoon-mocha, teaspoon-qunit
+    #suite.javascripts = ["jasmine/1.3.1", "teaspoon-jasmine"]
+
+    # You can include your own stylesheets if you want to change how Teaspoon looks.
+    # Note: Spec related CSS can and should be loaded using fixtures.
+    #suite.stylesheets = ["teaspoon"]
+
+    # Partial to be rendered in the head tag of the runner. You can use the provided ones or define your own by creating
+    # a `_boot.html.erb` in your fixtures path, and adjust the config to `"/boot"` for instance.
+    #
+    # Available: boot, boot_require_js
+    #suite.boot_partial = "boot"
+
+    # Partial to be rendered in the body tag of the runner. You can define your own to create a custom body structure.
+    #suite.body_partial = "body"
+
+    # Assets to be ignored when generating coverage reports. Accepts an array of filenames or regular expressions. The
+    # default excludes assets from vendor, gems and support libraries.<br/><br/>
+    #suite.no_coverage = [%r{/lib/ruby/gems/}, %r{/vendor/assets/}, %r{/support/}, %r{/(.+)_helper.}]
+
+    # Hooks allow you to use `Teaspoon.hook("fixtures")` before, after, or during your spec run. This will make a
+    # synchronous Ajax request to the server that will call all of the blocks you've defined for that hook name.
+    #suite.hook :fixtures, proc{ }
+
+  end
+
+  # Example suite. Since we're just filtering to files already within the root test/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 = "test/javascripts/targeted/*_test.{js,js.coffee,coffee}"
+  #end
+
+  # CONSOLE RUNNER SPECIFIC
+  #
+  # These configuration directives are applicable only when running via the rake task or command line interface. These
+  # directives can be overridden using the command line interface arguments or with ENV variables when using the rake
+  # task.
+  #
+  # Command Line Interface:
+  # teaspoon --driver=phantomjs --server-port=31337 --fail-fast=true --format=junit --suite=my_suite /spec/file_spec.js
+  #
+  # Rake:
+  # teaspoon DRIVER=phantomjs SERVER_PORT=31337 FAIL_FAST=true FORMATTERS=junit suite=my_suite
+
+  # Specify which headless driver to use. Supports PhantomJS and Selenium Webdriver.
+  #
+  # Available: phantomjs, selenium
+  # PhantomJS: https://github.com/modeset/teaspoon/wiki/Using-PhantomJS
+  # Selenium Webdriver: https://github.com/modeset/teaspoon/wiki/Using-Selenium-WebDriver
+  #config.driver = "phantomjs"
+
+  # Specify additional options for the driver.
+  #
+  # PhantomJS: https://github.com/modeset/teaspoon/wiki/Using-PhantomJS
+  # Selenium Webdriver: https://github.com/modeset/teaspoon/wiki/Using-Selenium-WebDriver
+  #config.driver_options = nil
+
+  # Specify the timeout for the driver. Specs are expected to complete within this time frame or the run will be
+  # considered a failure. This is to avoid issues that can arise where tests stall.
+  #config.driver_timeout = 180
+
+  # Specify a server to use with Rack (e.g. thin, mongrel). If nil is provided Rack::Server is used.
+  #config.server = nil
+
+  # Specify a port to run on a specific port, otherwise Teaspoon will use a random available port.
+  #config.server_port = nil
+
+  # Timeout for starting the server in seconds. If your server is slow to start you may have to bump this, or you may
+  # want to lower this if you know it shouldn't take long to start.
+  #config.server_timeout = 20
+
+  # Force Teaspoon to fail immediately after a failing suite. Can be useful to make Teaspoon fail early if you have
+  # several suites, but in environments like CI this may not be desirable.
+  #config.fail_fast = true
+
+  # Specify the formatters to use when outputting the results.
+  # Note: Output files can be specified by using `"junit>/path/to/output.xml"`.
+  #
+  # Available: dot, documentation, clean, json, junit, pride, snowday, swayze_or_oprah, tap, tap_y, teamcity
+  #config.formatters = ["dot"]
+
+  # Specify if you want color output from the formatters.
+  #config.color = true
+
+  # Teaspoon pipes all console[log/debug/error] to $stdout. This is useful to catch places where you've forgotten to
+  # remove them, but in verbose applications this may not be desirable.
+  #config.suppress_log = false
+
+  # COVERAGE REPORTS / THRESHOLD ASSERTIONS
+  #
+  # Coverage reports requires Istanbul (https://github.com/gotwarlost/istanbul) to add instrumentation to your code and
+  # display coverage statistics.
+  #
+  # Coverage configurations are similar to suites. You can define several, and use different ones under different
+  # conditions.
+  #
+  # To run with a specific coverage configuration
+  # - with the rake task: rake teaspoon USE_COVERAGE=[coverage_name]
+  # - with the cli: teaspoon --coverage=[coverage_name]
+
+  # Specify that you always want a coverage configuration to be used.
+  #config.use_coverage = nil
+
+  config.coverage do |coverage|
+
+    # Which coverage reports Instanbul should generate. Correlates directly to what Istanbul supports.
+    #
+    # Available: text-summary, text, html, lcov, lcovonly, cobertura, teamcity
+    #coverage.reports = ["text-summary", "html"]
+
+    # The path that the coverage should be written to - when there's an artifact to write to disk.
+    # Note: Relative to `config.root`.
+    #coverage.output_dir = "coverage"
+
+    # Various thresholds requirements can be defined, and those thresholds will be checked at the end of a run. If any
+    # aren't met the run will fail with a message. Thresholds can be defined as a percentage (0-100), or nil.
+    #coverage.statements = nil
+    #coverage.functions = nil
+    #coverage.branches = nil
+    #coverage.lines = nil
+
+  end
+
 end