# models/event.rb
class Event < ActiveRecord::Base
# ...
end
# models/event/timeline.rb
class Event::Timeline
# ...
end
# spec/event/timeline_spec.rb
require 'spec_helper'
require 'models/event/timeline' # <- fails since "event" is not required
describe Event::Timeline do
it '' do
# ...
end
end
我不想这样做,require 'event'
因为这意味着还需要它的所有依赖项,这些依赖项对于规范来说不是必需的。