Permalink
Browse files

Remove javascript (jasmine) tests

Moving them to travis-assets, which has the actual javascript files to be
tested.
  • Loading branch information...
1 parent b89f93e commit c7f5b5369f7f431d5fa0509305c70283063b0f73 @henrikhodne henrikhodne committed May 18, 2012
Showing with 1 addition and 5,434 deletions.
  1. +0 −2 .travis.yml
  2. +0 −1 Gemfile
  3. +0 −13 Gemfile.lock
  4. +1 −11 lib/tasks/ci.rake
  5. +0 −84 spec/javascripts/events_spec.js
  6. +0 −130 spec/javascripts/helpers/factories.js
  7. +0 −97 spec/javascripts/helpers/matchers.js
  8. +0 −160 spec/javascripts/helpers/matchers_travis.js
  9. +0 −67 spec/javascripts/helpers/spec_helper.js
  10. +0 −122 spec/javascripts/lib/deansi_spec.js
  11. +0 −41 spec/javascripts/lib/travis/datasource_spec.js
  12. +0 −46 spec/javascripts/lib/travis/log/filter_spec.js
  13. +0 −122 spec/javascripts/lib/travis/log/fold_pattern_spec.js
  14. +0 −230 spec/javascripts/lib/travis/log/incremental_spec.js
  15. +0 −82 spec/javascripts/lib/travis/query_spec.js
  16. +0 −51 spec/javascripts/lib/travis/record_spec.js
  17. +0 −124 spec/javascripts/models/build_spec.js
  18. +0 −165 spec/javascripts/models/job_spec.js
  19. +0 −164 spec/javascripts/models/repository_spec.js
  20. +0 −36 spec/javascripts/support/jasmine.yml
  21. +0 −50 spec/javascripts/support/jasmine_config.rb
  22. +0 −22 spec/javascripts/support/jasmine_reporter.js
  23. +0 −35 spec/javascripts/support/jasmine_runner.rb
  24. +0 −2,476 spec/javascripts/vendor/jasmine-1.1.0.js
  25. +0 −190 spec/javascripts/vendor/jasmine-html-1.1.0.js
  26. +0 −288 spec/javascripts/vendor/jasmine-jquery-1.3.1.js
  27. +0 −207 spec/javascripts/vendor/jasmine_ajax.js
  28. +0 −68 spec/javascripts/views/builds/list_spec.js
  29. +0 −75 spec/javascripts/views/builds/matrix_spec.js
  30. +0 −99 spec/javascripts/views/builds/show_spec.js
  31. +0 −38 spec/javascripts/views/jobs/list_spec.js
  32. +0 −31 spec/javascripts/views/queue/show_spec.js
  33. +0 −39 spec/javascripts/views/repositories/list_spec.js
  34. +0 −42 spec/javascripts/views/repositories/show_spec.js
  35. +0 −26 spec/javascripts/views/workers/list_spec.js
View
@@ -4,8 +4,6 @@ rvm:
bundler_args: "--without development"
before_script:
- "cp config/database.example.yml config/database.yml"
- - "export DISPLAY=:99.0"
- - "sh -e /etc/init.d/xvfb start"
script: "RAILS_ENV=test bundle exec rake test:ci --trace"
notifications:
irc: "irc.freenode.org#travis"
View
@@ -62,7 +62,6 @@ group :development do
end
group :test do
- gem 'jasmine', git: 'git://github.com/pivotal/jasmine-gem', submodules: true
gem 'capybara', '~> 1.1.2'
gem 'database_cleaner', '~> 0.7.0'
gem 'mocha', '~> 0.10.0'
View
@@ -5,17 +5,6 @@ GIT
hubble (0.1.2)
json (~> 1.6.5)
-GIT
- remote: git://github.com/pivotal/jasmine-gem
- revision: 1e075fbf5a69812fcc914c453f002ecf5bed38ab
- submodules: true
- specs:
- jasmine (1.2.0)
- jasmine-core (>= 1.2.0)
- rack (~> 1.0)
- rspec (>= 1.3.1)
- selenium-webdriver (>= 0.1.3)
-
GIT
remote: git://github.com/rack/rack-contrib
revision: 451f029857d655c4a37012564eb49665d2f9313a
@@ -175,7 +164,6 @@ GEM
http_accept_language (1.0.2)
httpauth (0.1)
i18n (0.6.0)
- jasmine-core (1.2.0)
journey (1.0.3)
json (1.6.7)
kgio (2.7.4)
@@ -343,7 +331,6 @@ DEPENDENCIES
gh!
http_accept_language (~> 1.0.2)
hubble!
- jasmine!
json (~> 1.6.3)
lograge (~> 0.0.4)
mocha (~> 0.10.0)
View
@@ -1,19 +1,9 @@
namespace :test do
desc 'a little shortcut for ci testing'
- task :ci => ['ci_env', 'db:drop', 'db:create', 'db:test:load', 'spec', 'jasmine_on_travis']
- task :jasmine => ['jasmine_on_travis']
+ task :ci => ['ci_env', 'db:drop', 'db:create', 'db:test:load', 'spec']
end
task :ci_env do
ENV['CI'] = 'true'
ENV['RAILS_ENV'] = 'test'
-end
-
-task :jasmine_on_travis => ['ci_env'] do
- require 'jasmine'
- load 'jasmine/tasks/jasmine.rake'
- puts "Starting to run jasmine:ci..."
- system("export DISPLAY=:99.0 && bundle exec rake jasmine:ci")
- stat = $?.exitstatus
- exit(stat)
end
@@ -1,84 +0,0 @@
-var EVENTS = {
-
- 'job:log': { id: 9, _log: 'Foo.' },
-
- 'job:created': { id: 21, number: '1.2', repository: { slug: 'travis-ci/test-job' } },
-
- 'job:started': { id: 9 },
-
- 'job:finished': { id: 9 },
-
- 'build:started': { build: { id: 2, repository_id: 2, number: 11 }, repository: { id: 2, slug: 'travis-ci/travis-ci' } },
-
- 'build:finished': { build: { id: 2, repository_id: 2, number: 11, result: 1 }, repository: { id: 2, slug: 'travis-ci/travis-ci-changed' } }
-
-};
-
-describe('Events:', function() {
-
- var events = Travis.Controllers.Events.create();
- var queue;
-
- var receiveEvent = function(event, ix) {
- var data = EVENTS[$.compact([event, ix]).join(':')];
- data = JSON.parse(JSON.stringify(data)); // make sure we pass a clone
- Ember.run(function() { events.receive(event, data); });
- };
-
- describe('job Events', function() {
- it('appends log data to an existing jobs log', function() {
- var test = Test.Factory.Job.single();
- receiveEvent('job:log');
- expect(test.get('log')).toEqual('Done. Build script exited with: 0\nFoo.');
-
- });
-
- it('adds a job when a new job is created', function() {
- var test = Test.Factory.Job.single();
- current = Travis.Job.all().get('length')
- receiveEvent('job:created');
- expect(Travis.Job.all().get('length')).toEqual(current+1);
- });
-
- it('job gets marked as started when it is started', function() {
- var test = Test.Factory.Job.single();
- receiveEvent('job:started');
- expect(test.get('state')).toEqual('started');
- });
-
- it('job gets marked as finished when it is finished', function() {
- var test = Test.Factory.Job.single();
- receiveEvent('job:finished');
- expect(test.get('state')).toEqual('finished');
- });
- });
-
- describe('updateFrom', function() {
- it('creates and updates repositories and builds', function() {
-
- expect(Travis.Repository.all().get('length')).toEqual(0);
- expect(Travis.Build.all().get('length')).toEqual(0);
-
- receiveEvent('build:started');
- var def = EVENTS['build:started']
- //added
- expect(Travis.Repository.all().get('length')).toEqual(1);
- expect(Travis.Build.all().get('length')).toEqual(1);
-
- //accurate
- var build = Travis.store.find(Travis.Build,def.build.id)
- var repo = Travis.store.find(Travis.Repository, def.repository.id)
- expect(build.get('number')).toEqual(def.build.number);
- expect(repo.get('slug')).toEqual(def.repository.slug)
- expect(build.get('result')).toEqual(null);
-
- //updated
- receiveEvent('build:finished');
- def = EVENTS['build:finished']
- build = Travis.store.find(Travis.Build,def.build.id)
- expect(build.get('result')).toEqual(def.build.result);
-
- });
- });
-
-});
@@ -1,130 +0,0 @@
-// TODO extract data and use recorded fixtures to ensure we're in sync with the app
-Test.Factory = {
- Repository: {
- travis: function() {
- Travis.store.loadRecord(Travis.Repository, {
- id: '1',
- slug: 'travis-ci/travis-ci',
- last_build_id: '1',
- last_build_number: '1',
- last_build_result: '0',
- last_build_started_at: '2011-01-01T01:00:10Z',
- last_build_finished_at: '2011-01-01T01:00:20Z',
- event_type: 'push'
- }, 1);
- return Travis.store.find(Travis.Repository, 1);
- },
- worker: function() {
- Travis.store.loadRecord(Travis.Repository, {
- id: '2',
- slug: 'travis-ci/travis-worker',
- last_build_id: '2',
- last_build_number: '2',
- last_build_result: '0',
- last_build_started_at: '2011-01-01T02:00:10Z',
- last_build_finished_at: '2011-01-01T02:00:20Z'
- }, 2);
- return Travis.store.find(Travis.Repository, 2);
- },
- cookbooks: function() {
- Travis.store.loadRecord(Travis.Repository, {
- id: '3',
- slug: 'travis-ci/travis-cookbooks',
- last_build_id: '3',
- last_build_number: '3',
- last_build_result: '0',
- last_build_started_at: '2011-01-01T03:00:10Z',
- last_build_finished_at: '2011-01-01T03:00:20Z'
- }, 3);
- return Travis.store.find(Travis.Repository, 3);
- },
- recent: function() {
- Test.Factory.Repository.travis();
- Test.Factory.Repository.worker();
- return Travis.Repository.recent();
- }
- },
- Build: {
- byRepository: function() {
- Test.Factory.Build.passing();
- return Test.Factory.Repository.travis().get('builds');
- },
- passing: function() {
- Test.Factory.Repository.travis();
- Travis.store.loadRecord(Travis.Build, {
- id: 1,
- repository_id: 1,
- number: '1',
- state: 'finished',
- result: 0,
- started_at: '2011-01-01T01:00:10Z',
- finished_at: '2011-01-01T01:00:20Z',
- config: {
- '.configured': 'true'
- },
- commit: '4d7621e08e1c34e94ad9',
- branch: 'master',
- message: 'correct rules',
- committed_at: '2011-01-01T01:00:00Z',
- committer_name: 'Josh Kalderimis',
- committer_email: 'josh.kalderimis@gmail.com',
- author_name: 'Alex P',
- author_email: 'alexp@coffeenco.de',
- compare_url: 'https://github.com/travis-ci/travis-ci/compare/fe64573...3d1e844',
- event_type: 'push',
- matrix: [
- {
- id: 2,
- repository_id: 1,
- number: '1.1',
- state: 'finished',
- result: 0,
- started_at: '2011-01-01T01:00:10Z',
- finished_at: '2011-01-01T01:00:20Z',
- config: {
- '.configured': 'true'
- },
- log: 'Done. Build script exited with: 0\n',
- parent_id: 123126,
- commit: '3d1e844a359459652268edeeb79ee59bd1709248',
- branch: 'master',
- message: 'correct the refraction redirect rules',
- committed_at: '2011-09-02T22:33:19Z',
- committer_name: 'Josh Kalderimis',
- committer_email: 'josh.kalderimis@gmail.com',
- author_name: 'Alex P',
- author_email: 'alexp@coffeenco.de',
- compare_url: 'https://github.com/travis-ci/travis-ci/compare/fe64573...3d1e844'
- }
- ]
- }, 1);
- return Travis.store.find(Travis.Build, 1);
- }
- },
- Job: {
- all: function() {
- Travis.store.loadRecord(Travis.Job, { id: 1, number: '', repository_id: 1 }, 1);
- Travis.store.loadRecord(Travis.Job, { id: 2, number: '', repository_id: 2 }, 2);
- Travis.store.loadRecord(Travis.Job, { id: 3, number: '1', repository_id: 1 }, 3);
- Travis.store.loadRecord(Travis.Job, { id: 4, number: '2', repository_id: 2 }, 4);
- Travis.store.loadRecord(Travis.Job, { id: 5, number: '1.1', repository_id: 1 }, 5);
- Travis.store.loadRecord(Travis.Job, { id: 6, number: '1.2', repository_id: 1 }, 6);
- Travis.store.loadRecord(Travis.Job, { id: 7, number: '2.1', repository_id: 2 }, 7);
- Travis.store.loadRecord(Travis.Job, { id: 8, number: '2.2', repository_id: 2 }, 8);
- return Travis.store.find(Travis.Job);
- },
- single : function() {
- Travis.store.loadRecord(Travis.Job, { id: 9, number: '1.9', repository_id: 1, started_at: '2011-01-01T01:00:10Z', finished_at: '2011-01-01T01:00:20Z', commit: '4d7621ea359459652268edeeb79ee59bd1709248', branch: 'master', log: 'Done. Build script exited with: 0\n', build_id: 1 }, 9);
- return Travis.store.find(Travis.Job, 9);
- }
- },
- Worker: {
- all: function() {
- Travis.store.loadRecord(Travis.Worker, { id: 'ruby1.worker.travis-ci.org:10000:ruby' }, 1);
- Travis.store.loadRecord(Travis.Worker, { id: 'ruby1.worker.travis-ci.org:10001:ruby' }, 2);
- Travis.store.loadRecord(Travis.Worker, { id: 'ruby2.worker.travis-ci.org:20000:ruby' }, 3);
- Travis.store.loadRecord(Travis.Worker, { id: 'ruby2.worker.travis-ci.org:20001:ruby' }, 4);
- return Travis.store.find(Travis.Worker);
- }
- }
-};
@@ -1,97 +0,0 @@
-beforeEach(function() {
- this.addMatchers({
- toMatch: function(pattern) {
- return this.actual.match(pattern);
- },
-
- toFind: function(selector) {
- this.actual = $(this.actual);
- return this.actual.find(selector).length != 0;
- },
-
- toHaveTexts: function(texts) {
- this.actual = $(this.actual);
- var errors = [];
- _.each(texts, function(text, selector) {
- var actual = $.trim($(this.actual).find(selector).text());
- if(!jasmine.doesMatchText(actual, text)) {
- errors.push('expected the element ' + selector + ' to have the text "' + text +'", but actually has: "' + actual + '".');
- }
- }.bind(this));
- this.message = function() { return errors.join("\n") };
- return errors.length == 0;
- },
-
- toHaveText: function(text) {
- this.actual = $(this.actual);
- var actual = $(this.actual).text().replace(/^\s*|\s(?=\s)|\s*$/g, '').trim();
- this.message = function() {
- return 'expected the element ' + this.actual.selector + ' to have the text "' + text +'", but actually has: "' + actual + '".';
- };
- return jasmine.doesMatchText(actual, text);
- },
-
- toHaveDomAttributes: function(attributes) {
- this.actual = $(this.actual);
- var errors = [];
- _.each(attributes, function(attributes, selector) {
- _.each(attributes, function(value, name) {
- var actual = $.trim($(this.actual).find(selector).attr(name));
- if(typeof actual == 'function' ? !actual.test(value) : actual != value) {
- errors.push('expected the element ' + selector + ' to have the attribute ' + name + '=' + value +', but actually has: "' + actual + '".');
- }
- }.bind(this));
- }.bind(this));
- this.message = function() { return errors.join("\n") };
- return errors.length == 0;
- },
-
- toMatchList: function(list) {
- var actual = $.map($('li', this.actual), function(li) { return $(li).text().replace(/\n/g, '').replace(/^\s*|\s(?=\s)|\s*$/g, '').trim(); });
- var result = Ember.compare(actual, list) == 0;
- if(!result) {
- this.message = function() { return "expected the list to equal \n " + Ember.inspect(list) + ",\n\n but was: \n " + Ember.inspect(actual) + "\n"; }
- }
- return result;
- },
-
- toMatchTable: function(table) {
- // table = $.clone(table);
-
- var actual = $(this.actual);
- var errors = [];
- var headers = table.shift();
-
- $.each(headers, function(ix, text) {
- var selector = 'thead th:nth-child(' + (ix + 1) + ')';
- var current = $.trim($(actual).find(selector).text());
- if(!jasmine.doesMatchText(current, text)) {
- errors.push('expected the header ' + ix + ' to have the text "' + text + '", but actually has: "' + actual + '".');
- }
- });
-
- $.each(table, function(row, cells) {
- $.each(cells, function(cell, text) {
- var selector = 'tbody tr:nth-child(' + (row + 1) + ') td:nth-child(' + (cell + 1) + ')';
- var current = actual.find(selector).text();
- if(!jasmine.doesMatchText(current, text)) {
- errors.push('expected the cell "' + headers[cell] + '" in row ' + row + ' to have the text "' + text + '", but actually has: "' + actual + '".');
- }
- });
- });
-
- this.message = function() { return errors.join("\n"); };
- return errors.length == 0;
- }
- });
-});
-
-jasmine.doesMatchText = function (lft, rgt) {
- if(lft == 'undefined') {
- return rgt === undefined;
- } else if(typeof rgt === 'function') {
- return rgt.test(lft);
- } else {
- return lft == rgt;
- }
-};
Oops, something went wrong.

0 comments on commit c7f5b53

Please sign in to comment.