Skip to content

Instantly share code, notes, and snippets.

@n0nick
Created March 16, 2014 10:35
Show Gist options
  • Save n0nick/9581328 to your computer and use it in GitHub Desktop.
Save n0nick/9581328 to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe Reports::ReportModelBase do
describe '#get_handler_type_name' do
describe 'when type is string' do
it 'returns string\'s value' do
Reports::ReportModelBase.get_handler_type_name({'type' => 'some_value_1'}).should == 'some_value_1'
end
end
describe 'when type is object' do
it 'returns value in object#name' do
Reports::ReportModelBase.get_handler_type_name({'type' => {'name' => 'some_value_2', 'foo' => 'bar'}}).should == 'some_value_2'
end
it 'returns default value if no #name defined' do
Reports::ReportModelBase.get_handler_type_name({'type' => {'key' => 'something'}}).should == Reports::ReportModelBase::DEFAULT_REPORT_TYPE
end
end
describe 'when no type is defined' do
it 'returns default value' do
Reports::ReportModelBase.get_handler_type_name({'type' => nil}).should == Reports::ReportModelBase::DEFAULT_REPORT_TYPE
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment