forked from travis-ci/travis-ci
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a test for events on matrix build pages.
surprisingly this passes, even though there are issues on this page, so the test isn't really useful, yet
- Loading branch information
Sven Fuchs
committed
Apr 10, 2011
1 parent
31ebc9b
commit 4af3d29
Showing
5 changed files
with
101 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env ruby | ||
|
||
# https://gist.github.com/raw/909740/102dc1f17d605f299d6d91d5462f73a56a10c7e3/ruby_rvm_system_invocation.rb | ||
|
||
# How to run a system command from ruby within a clean bash that has never sourced rvm using a custom ruby version | ||
|
||
# 1) install rvm as the correct user | ||
# 2) do NOT follow the instructions about sourcing and adding this to your .bashrc | ||
# 3) run the following (change the versions accordingly) | ||
|
||
ruby_versions = %w(ruby-1.8.7-p302 ruby-1.9.2-p0) | ||
|
||
ruby_versions.each do |version| | ||
puts ('>' * 20) + " #{version}" | ||
%w(true false).each do |bool| | ||
puts %Q~the following should output "#{bool}"~ | ||
p system(%(bash -c 'FOO=#{version}; source "/Volumes/Users/sven/.rvm/scripts/rvm"; rvm use #{version}; ruby -v; echo "echo $FOO"; #{bool}')) | ||
puts ('=' * 20) | ||
end | ||
puts ('<' * 20) | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
describe('Running a build matrix', function() { | ||
var PAYLOADS = { | ||
'build:queued:1': { repository: { id: 1, slug: 'svenfuchs/minimal' }, build: { id: 3, number: 3, } }, | ||
'build:started:1': { repository: { id: 1, slug: 'svenfuchs/minimal' }, build: { id: 3, number: 3, started_at: '2010-11-12T17:00:00Z', commit: '1111111', committer_name: 'Sven Fuchs', message: 'gem-minimal commit' } }, | ||
'build:expanded:1': { repository: { id: 1 }, build: { id: 3, config: { rvm: ['1.8.7', '1.9.2'] }, matrix: [ { id: 4, parent_id: 3, number: '3.1', config: { gemfile: 'test/Gemfile.rails-2.3.x', rvm: '1.8.7' } }, { id: 5, parent_id: 3, number: '3.2', config: { gemfile: 'test/Gemfile.rails-3.0.x', rvm: '1.8.7' } }, { id: 6, parent_id: 3, number: '3.3', config: { gemfile: 'test/Gemfile.rails-2.3.x', rvm: '1.9.2' } }, { id: 7, parent_id: 3, number: '3.4', config: { gemfile: 'test/Gemfile.rails-3.0.x', rvm: '1.9.2' } } ] } }, | ||
'build:log:1': { repository: { id: 1 }, build: { id: 4, }, log: ' with appended chars' }, | ||
'build:finished:1': { repository: { id: 1 }, build: { id: 4, status: 0, finished_at: '2010-11-12T17:00:10Z' } }, | ||
}; | ||
var trigger = function(event, payload, expectations) { | ||
runs(function() { Travis.trigger(event, payload); }); | ||
waits(50); | ||
if(expectations) runs(expectations); | ||
}; | ||
|
||
beforeEach(function() { | ||
startApp(); | ||
goTo('/'); | ||
waitsFor(repositoriesListPopulated()); | ||
}); | ||
|
||
afterEach(function() { | ||
stopApp(); | ||
}); | ||
|
||
it('schedules the build job, expands the matrix and runs each build', function() { | ||
trigger('build:queued', PAYLOADS['build:queued:1'], function() { | ||
// expect job list to contain job | ||
expectText('#jobs li:nth-child(3)', 'svenfuchs/minimal #3'); | ||
}); | ||
|
||
trigger('build:started', PAYLOADS['build:started:1'], function() { | ||
expect($('#jobs').html()).not.toHaveText(/svenfuchs\/minimal #3/); | ||
// expect repository list to contain the repo | ||
expect('#repositories li:nth-child(1)').toListRepository({ slug: 'svenfuchs/minimal', build: 3, selected: true, color: undefined, finished_at: '-', duration: '4 hrs 30 sec' }); | ||
// expect the current tab to show the build | ||
expect($('#tab_current')).toShowBuildSummary({ build: 3, commit: '1111111', committer: 'Sven Fuchs', finished_at: '-', duration: '30 sec' }); | ||
}); | ||
|
||
trigger('build:expanded', PAYLOADS['build:expanded:1'], function() { | ||
// expect the current tab to show the build matrix | ||
expect('#tab_current #matrix').toMatchTable([ | ||
['Build', 'Gemfile', 'Rvm' ], | ||
['3.1', 'test/Gemfile.rails-2.3.x', '1.8.7'], | ||
['3.2', 'test/Gemfile.rails-3.0.x', '1.8.7'], | ||
]); | ||
}); | ||
|
||
goTo('svenfuchs/minimal/builds/4'); | ||
runsAfter(10, function() { | ||
// expect the build child tab to be active and show the child build #3.1 | ||
expect($('#tab_build.active h5')).toHaveText('Build 3.1'); | ||
// expect the build child tab to show the build details | ||
expect($('#tab_build.active .summary')).not.toBeEmpty(); | ||
}) | ||
|
||
trigger('build:log', PAYLOADS['build:log:1'], function() { | ||
// expect the build child tab to be active | ||
expect($('#tab_build.active h5')).toHaveText('Build 3.1'); | ||
// expect the build child tab to show the details | ||
expect($('#tab_build.active .summary')).not.toBeEmpty(); | ||
// expect the build child tab to show the updated log | ||
expect($('#tab_build.active .log')).toHaveText('minimal build 3 log ... with appended chars'); | ||
}); | ||
|
||
trigger('build:finished', PAYLOADS['build:finished:1'], function() { | ||
// expect the build child tab to be active | ||
expect($('#tab_build.active h5')).toHaveText('Build 3.1'); | ||
// expect the build log to show the log | ||
expect($('#tab_build.active .log')).toHaveText('minimal build 3 log ... with appended chars'); | ||
// expect the build to be finished | ||
expect($('#tab_build .finished_at').attr('title')).toBe('2010-11-12T17:00:10Z') | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters