Sha256: e7a435c9b765a9d87d384b3ff98992122abf9f46384dc6c372cf73fa90adaaef
Contents?: true
Size: 1.28 KB
Versions: 13
Compression:
Stored size: 1.28 KB
Contents
require 'spec_helper' require 'protobuf/optionable' describe 'Optionable' do describe '.set_option' do before(:all) do OptionableSetOptionTest = ::Class.new do include ::Protobuf::Optionable end end it 'stores the given option and value' do expect(OptionableSetOptionTest).to respond_to(:set_option) expect(OptionableSetOptionTest.method(:set_option).arity).to eq(-2) expect { OptionableSetOptionTest.set_option(:foo, :bar) }.to_not raise_error end it 'defaults the value to true' do OptionableSetOptionTest.set_option(:baz_enabled) expect(OptionableSetOptionTest.get_option(:baz_enabled)).to be_true end end describe '.get_option' do before(:all) do OptionableGetOptionTest = ::Class.new do include ::Protobuf::Optionable set_option :foo, :bar end end it 'retrieves the option for the given name, if any' do expect(OptionableGetOptionTest.get_option(:foo)).to eq(:bar) expect(OptionableGetOptionTest.get_option(:baz)).to be_nil end it 'retrieves the option in the context of an instance' do expect(OptionableGetOptionTest.new.get_option(:foo)).to eq(:bar) expect(OptionableGetOptionTest.new.get_option(:baz)).to be_nil end end end
Version data entries
13 entries across 13 versions & 2 rubygems