Fix Jasmine tests - first pass

193 specs | 5 failing

The 5 failing specs appear (according to Firebug) to be due to missing
fixtures and/or missing routes in the Jasmine environment. Fixing these
last 5 failures is a task probably best left to a more experienced
Javascript/Jasmine developer.

This commit also moves validation.js and clear-form.js into
app/assets/javascripts and precompiles validation.js
This commit is contained in:
Steven Hancock 2012-03-22 12:10:08 -07:00 committed by Maxwell Salzberg
parent e1607baff4
commit 95d5c9ca68
21 changed files with 68 additions and 95 deletions

View file

@ -123,7 +123,8 @@ gem 'em-synchrony', '1.0.0', :platforms => :ruby_19
# jazzy jasmine
gem 'jasmine', '~> 1.1.2'
# Use the latest Jasmine from github for asset pipeline compatibility
gem 'jasmine', :git => 'git://github.com/pivotal/jasmine-gem.git'
### GROUPS ####

View file

@ -34,6 +34,27 @@ GIT
rack-fiber_pool
sinatra
<<<<<<< HEAD
=======
GIT
remote: git://github.com/pivotal/jasmine-gem.git
revision: 34c1529c3f7b78ebd81ac16006f141fc6b7cf013
specs:
jasmine (1.2.0.rc2)
jasmine-core (>= 1.2.0.rc1)
rack (>= 1.1)
rspec (>= 1.3.1)
selenium-webdriver (>= 0.1.3)
GIT
remote: git://github.com/socialcast/resque-ensure-connected.git
revision: 8ac0f9e4658495097fb333a93db81d54ba9a5311
specs:
resque-ensure-connected (0.2.0)
activerecord (>= 2.3.5)
resque (>= 1.10.0)
>>>>>>> Fix Jasmine tests - first pass
GEM
remote: http://rubygems.org/
specs:
@ -209,6 +230,7 @@ GEM
actionpack (~> 3.0)
i18n-inflector (~> 2.6)
railties (~> 3.0)
<<<<<<< HEAD
jasmine (1.1.2)
jasmine-core (>= 1.1.0)
rack (>= 1.1)
@ -218,6 +240,9 @@ GEM
<<<<<<< HEAD
json (1.6.6)
=======
=======
jasmine-core (1.2.0.rc1)
>>>>>>> Fix Jasmine tests - first pass
jquery-rails (1.0.19)
railties (~> 3.0)
thor (~> 0.14)
@ -489,7 +514,7 @@ DEPENDENCIES
heroku_san
http_accept_language (~> 1.0.2)
i18n-inflector-rails (~> 1.0)
jasmine (~> 1.1.2)
jasmine!
jquery-rails
json
jwt

View file

@ -21,7 +21,7 @@ var app = {
baseImageUrl: function(baseUrl){
if(baseUrl) { return this._baseImageUrl = baseUrl }
return this._baseImageUrl || ""
return this._baseImageUrl || "assets/"
},
initialize: function() {

View file

@ -39,7 +39,7 @@ app.views.Photos = Backbone.View.extend({
appendLoader: function(){
$("#paginate").html($("<img>", {
src : "/images/static-loader.png",
src : "/assets/static-loader.png",
"class" : "loader"
}));
},

View file

@ -85,7 +85,7 @@ app.views.Stream = Backbone.View.extend({
appendLoader: function(){
$("#paginate").html($("<img>", {
src : "/images/static-loader.png",
src : "/assets/static-loader.png",
"class" : "loader"
}));
},

View file

@ -56,7 +56,7 @@ $(document).ready(function(){
debug: false,
donetext: "no more.",
loadingText: "",
loadingImg: '/images/ajax-loader.gif'
loadingImg: '/assets/ajax-loader.gif'
}, function(){
$('.conversation', '.stream').bind('mousedown', function(){
bindIt($(this));

View file

@ -0,0 +1,12 @@
//= require jquery
//= require handlebars-1.0.0.beta.6
//= require templates
//= require main
//= require home
//= require finder
//= require inbox
//= require login
//= require mobile
//= require profile
//= require people
//= require photos

View file

@ -2,6 +2,9 @@
* licensed under the Affero General Public License version 3 or later. See
* the COPYRIGHT file.
*/
//= require jquery_ujs
//= require underscore
//= require backbone
//= require rails.validations
//= require jquery.hotkeys
//= require jquery.autoresize
@ -10,7 +13,6 @@
//= require jquery.placeholder
//= require timeago
//= require facebox
//= require underscore
//= require jquery.events.input
//= require jquery.elastic
//= require jquery.mentionsInput
@ -19,9 +21,10 @@
//= require jquery.autocomplete-custom
//= require keycodes
//= require fileuploader-custom
//= require backbone
//= require handlebars-1.0.0.beta.6
//= require markdown
//= require clear-form
//= require validation
//= require app/app
//= require diaspora
//= require_tree ./helpers

View file

@ -2,6 +2,7 @@
* licensed under the Affero General Public License version 3 or later. See
* the COPYRIGHT file.
*/
//= require mailchimp/jquery.form
var View = {
initialize: function() {
/* Buttons */
@ -63,8 +64,8 @@ var View = {
$(document.body).click(this.dropdowns.removeFocus);
/* facebox */
$.facebox.settings.closeImage = '/images/facebox/closelabel.png';
$.facebox.settings.loadingImage = '/images/facebox/loading.gif';
$.facebox.settings.closeImage = '/assets/facebox/closelabel.png';
$.facebox.settings.loadingImage = '/assets/facebox/loading.gif';
$.facebox.settings.opacity = 0.75;
$('a[rel*=facebox]').facebox();

View file

@ -11,7 +11,7 @@
debug: false,
donetext: Diaspora.I18n.t("infinite_scroll.no_more"),
loadingText: "",
loadingImg: "/images/ajax-loader.gif",
loadingImg: "/assets/ajax-loader.gif",
navSelector: "#pagination",
nextSelector: ".paginate",
itemSelector: ".stream_element",

View file

@ -16,7 +16,7 @@ ul.as-selections {
}
ul.as-selections.loading {
background: url("/images/ajax-loader.gif") right center no-repeat;
background: url("/assets/ajax-loader.gif") right center no-repeat;
}
ul.as-selections li {

File diff suppressed because one or more lines are too long

View file

@ -1,4 +0,0 @@
// Workaround to keep "app/templates" out of the template names
// All templates will remain in the JST namespace just as they were
// when we were using Jammit
//= require_tree .

View file

@ -73,7 +73,8 @@ module Diaspora
# Javascripts
config.assets.precompile += [ "finder.js", "home.js", "ie.js", "inbox.js",
"jquery.js", "jquery_ujs.js", "login.js", "mailchimp.js", "main.js",
"mobile.js", "profile.js", "people.js", "photos.js", "templates.js" ]
"mobile.js", "profile.js", "people.js", "photos.js", "templates.js",
"validation.js" ]
# Stylesheets
config.assets.precompile += [ "blueprint.css", "bootstrap.css", "default.css",

View file

@ -41,8 +41,7 @@ namespace :deploy do
end
task :bundle_static_assets do
run "cd #{current_path} && bundle exec sass --update public/stylesheets/sass:public/stylesheets"
run "cd #{current_path} && bundle exec jammit"
run "cd #{current_path} && bundle exec rake assets:precompile"
end
task :restart do

View file

@ -12,7 +12,7 @@ namespace :ci do
system("bundle exec #{cmd}")
raise "#{cmd} failed!" unless $?.exitstatus == 0
end
['jammit', "rake jasmine:ci", "rake cucumber"].each do |cmd|
["rake jasmine:ci", "rake cucumber"].each do |cmd|
puts "Running bundle exec #{cmd}..."
system("export DISPLAY=:99.0 && GROUP=oauth bundle exec #{cmd}")
raise "#{cmd} failed!" unless $?.exitstatus == 0

View file

@ -11,63 +11,8 @@
# - dist/**/*.js
#
src_files:
# load up our outputted templates, bound to window.JST
- public/javascripts/vendor/handlebars-1.0.0.beta.6.js
- public/assets/templates.js
- public/javascripts/vendor/underscore.js
- public/javascripts/vendor/jquery-1.7.1.min.js
- public/javascripts/vendor/jquery-ui-1.8.9.custom.min.js
- public/javascripts/vendor/bootstrap/bootstrap-twipsy.js
- public/javascripts/vendor/bootstrap/bootstrap-popover.js
- public/javascripts/vendor/jquery.tipsy.js
- public/javascripts/vendor/jquery.infinitescroll.min.js
- public/javascripts/vendor/jquery.autoresize.js
- public/javascripts/vendor/jquery.expander.js
- public/javascripts/vendor/jquery.charcount.js
- public/javascripts/vendor/jquery.mentionsInput.js
- public/javascripts/vendor/jquery.idle-timer.js
- public/javascripts/vendor/timeago.js
- public/javascripts/vendor/facebox.js
- public/javascripts/vendor/markdown/*
- public/javascripts/vendor/punycode.js
- public/javascripts/vendor/jquery.placeholder.js
- public/javascripts/vendor/backbone.js
- public/javascripts/fileuploader-custom.js
- public/javascripts/jquery.autocomplete-custom.js
- public/javascripts/diaspora.js
- public/javascripts/keycodes.js
- public/javascripts/pages/*
- public/javascripts/helpers/*
- public/javascripts/widgets/*
- public/javascripts/app/app.js
- public/javascripts/app/helpers/*
- public/javascripts/app/router.js
- public/javascripts/app/views.js
- public/javascripts/app/forms.js
- public/javascripts/app/models/post.js
- public/javascripts/app/models/*
- public/javascripts/app/collections/*
- public/javascripts/app/views/stream_object_view.js
- public/javascripts/app/views/content_view.js
- public/javascripts/app/views/*.js
- public/javascripts/app/views/**/*.js
- public/javascripts/app/pages/**/*.js
- public/javascripts/app/forms/**/*.js
- public/javascripts/mobile.js
- public/javascripts/contact-list.js
- public/javascripts/view.js
- public/javascripts/mentions.js
- public/javascripts/publisher.js
- public/javascripts/stream.js
- public/javascripts/validation.js
- public/javascripts/rails.js
- public/javascripts/aspects-dropdown.js
- public/javascripts/content-updater.js
- public/javascripts/tag-followings.js
# Precompile all scripts together for the test environment
- assets/jasmine-load-all.js
# stylesheets
#
@ -81,7 +26,13 @@ src_files:
# - stylesheets/*.css
#
stylesheets:
- stylesheets/**/*.css
- assets/blueprint.css
- assets/bootstrap.css
- assets/default.css
- assets/login.css
#- assets/mobile.css
- assets/new_templates.css
#- assets/rtl.css
# helpers
#

View file

@ -1,7 +0,0 @@
require 'jammit'
module Jasmine
class Config
Jammit.reload!
Jammit.package!
end
end

View file

@ -6,15 +6,6 @@ require 'rubygems'
require 'json'
require 'jasmine'
require 'rspec'
jasmine_config_overrides = File.expand_path(File.join(File.dirname(__FILE__), 'jasmine_config.rb'))
begin
require jasmine_config_overrides if File.exists?(jasmine_config_overrides)
rescue Exception => e
#we do this because when we are locally developing JS, our local jammit
# helps us re-run jasmine tests by jammiting every time.
#on ci, this causes problems, but we only need to jammit once
end
jasmine_config = Jasmine::Config.new
spec_builder = Jasmine::SpecBuilder.new(jasmine_config)