Sha256: cbcc331948c331d9cec8049d4ea929a20c5d2d972a8194d839c40d2b1d2fe0b3
Contents?: true
Size: 1.4 KB
Versions: 6
Compression:
Stored size: 1.4 KB
Contents
require 'spec_helper' describe GroupDocs::Api::Helpers::Actions do subject do Object.extend(described_class) end describe 'ACTIONS' do it 'contains hash of actions' do described_class::ACTIONS.should == { none: 0, convert: 1, combine: 2, compress_zip: 4, compress_rar: 8, trace: 16, convert_body: 32, bind_data: 64, print: 128, import_annotations: 256, } end end describe '.convert_actions' do it 'raises error if actions is not an array' do -> { subject.convert_actions(:convert) }.should raise_error(ArgumentError) end it 'raises error if action is unknown' do -> { subject.convert_actions(%w(unknown)) }.should raise_error(ArgumentError) end it 'converts each action to Symbol' do actions = %w(none convert) actions.each do |action| symbol = action.to_sym action.should_receive(:to_sym).and_return(symbol) end subject.convert_actions(actions) end it 'returns correct byte flag' do actions = %w(none convert combine compress_zip compress_rar trace convert_body bind_data print import_annotations) flag = subject.convert_actions(actions) flag.should be_an(Integer) flag.should == 511 end end end
Version data entries
6 entries across 6 versions & 1 rubygems