spec: fix EventStream::Record for rails 3

Change-Id: I3da51be4088f9508e107a06070a971d70e55587f
Reviewed-on: https://gerrit.instructure.com/29630
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Ryan Florence <ryanf@instructure.com>
QA-Review: Ryan Florence <ryanf@instructure.com>
This commit is contained in:
Ryan Florence 2014-02-04 16:48:07 -07:00
parent 8a9a431978
commit 8bc2c176f4
2 changed files with 2 additions and 10 deletions

View File

@ -43,11 +43,7 @@ class EventStream::Record < Struct.new(:attributes)
@page_view = attributes.delete('page_view')
end
if CANVAS_RAILS3
attributes['event_type'] ||= self.class.name.deconstantize.demodulize.underscore
else
attributes['event_type'] ||= self.class.name.gsub("::#{self.class.name.demodulize}", '').demodulize.underscore
end
attributes['event_type'] ||= self.class.name.gsub("::#{self.class.name.demodulize}", '').demodulize.underscore
end
def changes

View File

@ -59,11 +59,7 @@ describe EventStream::Failure do
it "should return page_view when it is available for request_id" do
@event.page_view.should be_nil
@page_view = PageView.new { |p|
p.send(:attributes=, {
:request_id => @request_id
}, false)
}
@page_view = PageView.new { |p| p.request_id = @request_id }
PageView.stubs( :find_by_id => @page_view )
@event.page_view.should == @page_view
end