Some infrastructure for AR and accompanying unit tests
This commit is contained in:
parent
6d8190c096
commit
1b8baa3d03
18 changed files with 155 additions and 187 deletions
2
test/fixtures/pages.yml
vendored
Normal file
2
test/fixtures/pages.yml
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
home_page:
|
||||
id: 1
|
2
test/fixtures/revisions.yml
vendored
Normal file
2
test/fixtures/revisions.yml
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
home_page_first_revision:
|
||||
id: 1
|
2
test/fixtures/webs.yml
vendored
Normal file
2
test/fixtures/webs.yml
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
test_wiki:
|
||||
id: 1
|
26
test/test_helper.rb
Normal file
26
test/test_helper.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
ENV["RAILS_ENV"] = "test"
|
||||
|
||||
# Expand the path to environment so that Ruby does not load it multiple times
|
||||
# File.expand_path can be removed if Ruby 1.9 is in use.
|
||||
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
||||
require 'application'
|
||||
|
||||
require 'test/unit'
|
||||
require 'active_record/fixtures'
|
||||
require 'action_controller/test_process'
|
||||
require 'action_web_service/test_invoke'
|
||||
require 'breakpoint'
|
||||
|
||||
Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + "/fixtures/"
|
||||
|
||||
class Test::Unit::TestCase
|
||||
# Turn these on to use transactional fixtures with table_name(:fixture_name) instantiation of fixtures
|
||||
# self.use_transactional_fixtures = true
|
||||
# self.use_instantiated_fixtures = false
|
||||
|
||||
def create_fixtures(*table_names)
|
||||
Fixtures.create_fixtures(File.dirname(__FILE__) + "/fixtures", table_names)
|
||||
end
|
||||
|
||||
# Add more helper methods to be used by all tests here...
|
||||
end
|
7
test/unit/page_test.rb
Normal file
7
test/unit/page_test.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
|
||||
class PageTest < Test::Unit::TestCase
|
||||
|
||||
fixtures 'webs', 'pages', 'revisions'
|
||||
|
||||
end
|
7
test/unit/revision_test.rb
Normal file
7
test/unit/revision_test.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
|
||||
class RevisionTest < Test::Unit::TestCase
|
||||
|
||||
fixtures 'webs', 'pages', 'revisions'
|
||||
|
||||
end
|
7
test/unit/web_test.rb
Normal file
7
test/unit/web_test.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
|
||||
class WebTest < Test::Unit::TestCase
|
||||
|
||||
fixtures 'webs', 'pages', 'revisions'
|
||||
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue