diff --git a/lib/rspec/parameterized.rb b/lib/rspec/parameterized.rb index 53a2989..2bb5977 100644 --- a/lib/rspec/parameterized.rb +++ b/lib/rspec/parameterized.rb @@ -77,6 +77,7 @@ def with_them(*args, &b) opts = args.last.is_a?(Hash) ? args.pop : {} opts[:caller] = caller unless opts[:caller] args.push(opts) + @parameter ||= nil if @parameter.nil? @parameterized_pending_cases ||= [] @@ -89,12 +90,11 @@ def with_them(*args, &b) private def set_parameters(arg_names, &b) @parameter = Parameter.new(arg_names, &b) + @parameterized_pending_cases ||= [] - if @parameterized_pending_cases - @parameterized_pending_cases.each { |e| - define_cases(@parameter, *e[0], &e[1]) - } - end + @parameterized_pending_cases.each { |e| + define_cases(@parameter, *e[0], &e[1]) + } end def define_cases(parameter, *args, &block)