Skip to content

Commit

Permalink
Added a field test for merging the mapping keyword with other keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
Clinton Gormley committed Jun 24, 2012
1 parent 906da37 commit ea3274c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Elastic/Model/TypeMap/Base.pm
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ sub attribute_mapping {
my $mapping = $attr->can('mapping') && $attr->mapping
|| { $map->find_mapper($attr) };

my $type = $mapping->{type};
my $type = $mapping->{type} || '';
if ( $attr->can('type') ) {
my $new_type = $attr->type;
my $new_type = $attr->type ;
if ( $new_type and $new_type ne $type ) {
delete $mapping->{enabled}
if $type eq 'object';
Expand Down
1 change: 1 addition & 0 deletions t/10_typemaps/21_type_string.t
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ our @mapping = (
},
},

mapping => { type => 'integer', store => 1 },
bad_opt => qr/doesn't understand 'precision_step'/,
bad_multi => qr/doesn't understand 'format'/

Expand Down
11 changes: 11 additions & 0 deletions t/lib/FieldTest/String.pm
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ has 'multi_attr' => (
}
);

#===================================
has 'mapping_attr' => (
#===================================
is => 'ro',
isa => 'Str',
type =>'integer',
mapping => {
store =>1
}
);

#===================================
has 'bad_opt_attr' => (
#===================================
Expand Down

0 comments on commit ea3274c

Please sign in to comment.