File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
lib/puppet/parser/functions
spec/unit/puppet/functions Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ module Puppet::Parser::Functions
10
10
EOS
11
11
) do |args |
12
12
13
- return raise ( Puppet ::ParseError , "mysql_table_exists() accept 1 argument - table string like 'database_name.table_name'" ) unless match = args [ 0 ] . match ( /(.*)\. (.*)/ )
13
+ return raise ( Puppet ::ParseError ,
14
+ "mysql_table_exists() accept 1 argument - table string like 'database_name.table_name'" ) unless ( args . size == 1 and match = args [ 0 ] . match ( /(.*)\. (.*)/ ) )
14
15
15
16
db_name , table_name = match . captures
16
17
return true if ( db_name . eql? ( '*' ) or table_name . eql? ( '*' ) ) ## *.* is valid table string, but we shouldn't check it for existence
Original file line number Diff line number Diff line change 15
15
expect { scope . function_mysql_table_exists ( [ ] ) } . to ( raise_error ( Puppet ::ParseError ) )
16
16
end
17
17
18
+ it 'should raise a ParserError if argument doesn\'t look like database_name.table_name' do
19
+ expect { scope . function_mysql_table_exists ( [ 'foo_bar' ] ) } . to ( raise_error ( Puppet ::ParseError ) )
20
+ end
21
+
18
22
it 'should raise a ParseError if there is more than 1 arguments' do
19
- expect { scope . function_mysql_table_exists ( %w( foo bar ) ) } . to ( raise_error ( Puppet ::ParseError ) )
23
+ expect { scope . function_mysql_table_exists ( %w( foo.bar foo. bar) ) } . to ( raise_error ( Puppet ::ParseError ) )
20
24
end
21
25
22
26
end
You can’t perform that action at this time.
0 commit comments