forked from travis-ci/travis-ci
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates and cleanups to the tests, mostly the test_helper.
- Loading branch information
Showing
20 changed files
with
183 additions
and
210 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 |
---|---|---|
@@ -1,40 +1,40 @@ | ||
Factory.define :repository do |f| | ||
f.name 'minimal' | ||
f.owner_name 'svenfuchs' | ||
f.owner_email 'svenfuchs@artweb-design.de' | ||
f.url { |r| "http://github.com/#{r.owner_name}/#{r.name}" } | ||
f.last_duration 60 | ||
f.created_at { |r| Time.utc(2011, 01, 30, 5, 25) } | ||
f.updated_at { |r| r.created_at + 5.minutes } | ||
end | ||
Factory.define :repository do |f| | ||
f.name 'minimal' | ||
f.owner_name 'svenfuchs' | ||
f.owner_email 'svenfuchs@artweb-design.de' | ||
f.url { |r| "http://github.com/#{r.owner_name}/#{r.name}" } | ||
f.last_duration 60 | ||
f.created_at { |r| Time.utc(2011, 01, 30, 5, 25) } | ||
f.updated_at { |r| r.created_at + 5.minutes } | ||
end | ||
|
||
Factory.define :build do |f| | ||
f.repository { Repository.first || Factory(:repository) } | ||
f.number '1' | ||
f.commit '62aae5f70ceee39123ef' | ||
f.branch 'master' | ||
f.message 'the commit message' | ||
f.committer_name 'Sven Fuchs' | ||
f.committer_email 'svenfuchs@artweb-design.de' | ||
end | ||
Factory.define :build do |f| | ||
f.repository { Repository.first || Factory(:repository) } | ||
f.number '1' | ||
f.commit '62aae5f70ceee39123ef' | ||
f.branch 'master' | ||
f.message 'the commit message' | ||
f.committer_name 'Sven Fuchs' | ||
f.committer_email 'svenfuchs@artweb-design.de' | ||
end | ||
|
||
Factory.define :running_build, :parent => :build do |f| | ||
f.started_at { Time.now } | ||
end | ||
Factory.define :running_build, :parent => :build do |f| | ||
f.started_at { Time.now } | ||
end | ||
|
||
Factory.define :successfull_build, :parent => :build do |f| | ||
f.status 0 | ||
f.finished_at { Time.now } | ||
end | ||
Factory.define :successfull_build, :parent => :build do |f| | ||
f.status 0 | ||
f.finished_at { Time.now } | ||
end | ||
|
||
Factory.define :broken_build, :parent => :build do |f| | ||
f.status 1 | ||
f.started_at { Time.now } | ||
f.finished_at { Time.now } | ||
end | ||
Factory.define :broken_build, :parent => :build do |f| | ||
f.status 1 | ||
f.started_at { Time.now } | ||
f.finished_at { Time.now } | ||
end | ||
|
||
Factory.define :user do |f| | ||
f.name 'Sven Fuchs' | ||
f.login 'svenfuchs' | ||
f.email 'sven@fuchs.com' | ||
end | ||
Factory.define :user do |f| | ||
f.name 'Sven Fuchs' | ||
f.login 'svenfuchs' | ||
f.email 'sven@fuchs.com' | ||
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
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 |
---|---|---|
@@ -1,36 +1,41 @@ | ||
ENV['RAILS_ENV'] ||= 'test' | ||
require File.expand_path('../../config/environment', __FILE__) | ||
require 'rails/test_help' | ||
|
||
begin | ||
require 'ruby-debug' | ||
rescue LoadError => e | ||
puts e.message | ||
end | ||
require 'bundler/setup' | ||
|
||
require 'active_record' | ||
require 'test/unit' | ||
require 'test_declarative' | ||
require 'mocha' | ||
require 'fakeredis' | ||
|
||
require 'travis' | ||
|
||
# load all the test helpers | ||
Dir["#{File.expand_path('../test_helpers/**/*.rb', __FILE__)}"].each do |helper| | ||
require helper | ||
end | ||
|
||
class Test::Unit::TestCase | ||
include Assertions, TestHelper::Redis | ||
|
||
class ActiveSupport::TestCase | ||
include TestHelpers::Assertions | ||
include TestHelpers::Redis | ||
|
||
DatabaseCleaner.strategy = :truncation | ||
|
||
def setup | ||
Mocha::Mockery.instance.verify | ||
Resque.redis = FakeRedis::Redis.new | ||
|
||
Travis.pusher = TestHelpers::Mocks::Pusher.new | ||
Resque.redis = FakeRedis::Redis.new | ||
|
||
DatabaseCleaner.start | ||
|
||
super | ||
end | ||
end | ||
|
||
# class TestMochaTest < ActiveSupport::TestCase | ||
# def test_mocha_expectation | ||
# object = Object.new | ||
# object.expects(:foo) | ||
# end | ||
# end | ||
def teardown | ||
Travis.pusher = nil | ||
|
||
DatabaseCleaner.clean | ||
|
||
super | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,21 +1,23 @@ | ||
require 'webmock/test_unit' | ||
|
||
module GithubApiTestHelper | ||
PATHS = %w( | ||
api/v2/json/repos/show/svenfuchs/gem-release | ||
api/v2/json/repos/show/travis-ci/travis-ci | ||
api/v2/json/user/show/svenfuchs | ||
api/v2/json/organizations/travis-ci/public_members | ||
api/v2/json/user/show/LTe | ||
) | ||
module TestHelpers | ||
module GithubApiTestHelper | ||
PATHS = %w( | ||
api/v2/json/repos/show/svenfuchs/gem-release | ||
api/v2/json/repos/show/travis-ci/travis-ci | ||
api/v2/json/user/show/svenfuchs | ||
api/v2/json/organizations/travis-ci/public_members | ||
api/v2/json/user/show/LTe | ||
) | ||
|
||
def setup | ||
super | ||
PATHS.each do |path| | ||
filename = File.expand_path("../../fixtures/github/#{path}.json", __FILE__) | ||
`curl -so #{filename} --create-dirs http://github.com/#{path}` unless File.exists?(filename) | ||
stub_request(:get, "http://github.com/#{path}"). | ||
to_return(:status => 200, :body => File.read(filename), :headers => {}) | ||
def setup | ||
super | ||
PATHS.each do |path| | ||
filename = File.expand_path("../../fixtures/github/#{path}.json", __FILE__) | ||
`curl -so #{filename} --create-dirs http://github.com/#{path}` unless File.exists?(filename) | ||
stub_request(:get, "http://github.com/#{path}"). | ||
to_return(:status => 200, :body => File.read(filename), :headers => {}) | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.