Created
March 16, 2014 10:35
-
-
Save n0nick/9581328 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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