Factor out loading of the various fixtures needed to test API calls
into a shared method.
This commit is contained in:
parent
c1089f6149
commit
79457cd43e
3 changed files with 25 additions and 14 deletions
|
@ -5,11 +5,7 @@ require 'node_controller'
|
|||
class NodeController; def rescue_action(e) raise e end; end
|
||||
|
||||
class NodeControllerTest < Test::Unit::TestCase
|
||||
fixtures :current_nodes, :nodes, :users, :current_segments, :segments
|
||||
set_fixture_class :current_nodes => :Node
|
||||
set_fixture_class :nodes => :OldNode
|
||||
set_fixture_class :current_segments => :Segment
|
||||
set_fixture_class :segments => :OldSegment
|
||||
api_fixtures
|
||||
|
||||
def setup
|
||||
@controller = NodeController.new
|
||||
|
|
|
@ -5,15 +5,7 @@ require 'segment_controller'
|
|||
class SegmentController; def rescue_action(e) raise e end; end
|
||||
|
||||
class SegmentControllerTest < Test::Unit::TestCase
|
||||
fixtures :current_nodes, :nodes, :users, :current_segments, :segments, :current_ways, :ways, :current_way_segments, :way_segments
|
||||
set_fixture_class :current_nodes => :Node
|
||||
set_fixture_class :nodes => :OldNode
|
||||
set_fixture_class :current_segments => :Segment
|
||||
set_fixture_class :segments => :OldSegment
|
||||
set_fixture_class :current_ways => :Way
|
||||
set_fixture_class :ways => :OldWay
|
||||
set_fixture_class :current_way_segments => :WaySegment
|
||||
set_fixture_class :way_segments => :OldWaySegment
|
||||
api_fixtures
|
||||
|
||||
def setup
|
||||
@controller = SegmentController.new
|
||||
|
|
|
@ -24,5 +24,28 @@ class Test::Unit::TestCase
|
|||
# then set this back to true.
|
||||
self.use_instantiated_fixtures = false
|
||||
|
||||
# Load standard fixtures needed to test API methods
|
||||
def self.api_fixtures
|
||||
fixtures :users
|
||||
|
||||
fixtures :current_nodes, :nodes
|
||||
set_fixture_class :current_nodes => :Node
|
||||
set_fixture_class :nodes => :OldNode
|
||||
|
||||
fixtures :current_segments, :segments
|
||||
set_fixture_class :current_segments => :Segment
|
||||
set_fixture_class :segments => :OldSegment
|
||||
|
||||
fixtures :current_ways, :current_way_segments, :current_way_tags
|
||||
set_fixture_class :current_ways => :Way
|
||||
set_fixture_class :current_way_segments => :WaySegment
|
||||
set_fixture_class :current_way_tags => :WayTag
|
||||
|
||||
fixtures :ways, :way_segments, :way_tags
|
||||
set_fixture_class :ways => :OldWay
|
||||
set_fixture_class :way_segments => :OldWaySegment
|
||||
set_fixture_class :way_tags => :OldWayTag
|
||||
end
|
||||
|
||||
# Add more helper methods to be used by all tests here...
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue