require 'spec_helper' describe Granite::Form::Model::Attributes::Reflections::Dictionary do def reflection(options = {}) described_class.new(:field, options) end describe '.build' do before { stub_class(:target) } specify do described_class.build(Class.new, Target, :field) expect(Target).to be_method_defined(:field) expect(Target).to be_method_defined(:field=) expect(Target).to be_method_defined(:field?) expect(Target).to be_method_defined(:field_before_type_cast) expect(Target).to be_method_defined(:field_default) expect(Target).to be_method_defined(:field_values) end end describe '#generate_methods' do before { stub_class(:target) } specify do described_class.generate_methods(:field_alias, Target) expect(Target).to be_method_defined(:field_alias) expect(Target).to be_method_defined(:field_alias=) expect(Target).to be_method_defined(:field_alias?) expect(Target).to be_method_defined(:field_alias_before_type_cast) expect(Target).to be_method_defined(:field_alias_default) expect(Target).to be_method_defined(:field_alias_values) end end end