summaryrefslogtreecommitdiff
path: root/spec/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby')
-rw-r--r--spec/ruby/.mspec.constants1
-rw-r--r--spec/ruby/.rubocop.yml15
-rw-r--r--spec/ruby/.rubocop_todo.yml3
-rw-r--r--spec/ruby/core/argf/close_spec.rb4
-rw-r--r--spec/ruby/core/argf/read_nonblock_spec.rb2
-rw-r--r--spec/ruby/core/argf/readchar_spec.rb2
-rw-r--r--spec/ruby/core/argf/readline_spec.rb2
-rw-r--r--spec/ruby/core/argf/readpartial_spec.rb6
-rw-r--r--spec/ruby/core/argf/rewind_spec.rb2
-rw-r--r--spec/ruby/core/argf/seek_spec.rb2
-rw-r--r--spec/ruby/core/argf/shared/eof.rb2
-rw-r--r--spec/ruby/core/argf/shared/fileno.rb2
-rw-r--r--spec/ruby/core/argf/shared/pos.rb2
-rw-r--r--spec/ruby/core/argf/skip_spec.rb2
-rw-r--r--spec/ruby/core/array/allocate_spec.rb2
-rw-r--r--spec/ruby/core/array/append_spec.rb2
-rw-r--r--spec/ruby/core/array/at_spec.rb4
-rw-r--r--spec/ruby/core/array/bsearch_index_spec.rb2
-rw-r--r--spec/ruby/core/array/bsearch_spec.rb4
-rw-r--r--spec/ruby/core/array/clear_spec.rb4
-rw-r--r--spec/ruby/core/array/compact_spec.rb2
-rw-r--r--spec/ruby/core/array/concat_spec.rb4
-rw-r--r--spec/ruby/core/array/cycle_spec.rb16
-rw-r--r--spec/ruby/core/array/delete_at_spec.rb2
-rw-r--r--spec/ruby/core/array/delete_if_spec.rb4
-rw-r--r--spec/ruby/core/array/delete_spec.rb2
-rw-r--r--spec/ruby/core/array/dig_spec.rb6
-rw-r--r--spec/ruby/core/array/drop_spec.rb2
-rw-r--r--spec/ruby/core/array/element_set_spec.rb48
-rw-r--r--spec/ruby/core/array/fetch_spec.rb10
-rw-r--r--spec/ruby/core/array/fill_spec.rb72
-rw-r--r--spec/ruby/core/array/first_spec.rb10
-rw-r--r--spec/ruby/core/array/flatten_spec.rb22
-rw-r--r--spec/ruby/core/array/hash_spec.rb4
-rw-r--r--spec/ruby/core/array/initialize_spec.rb24
-rw-r--r--spec/ruby/core/array/insert_spec.rb10
-rw-r--r--spec/ruby/core/array/join_spec.rb4
-rw-r--r--spec/ruby/core/array/last_spec.rb8
-rw-r--r--spec/ruby/core/array/max_spec.rb6
-rw-r--r--spec/ruby/core/array/min_spec.rb6
-rw-r--r--spec/ruby/core/array/multiply_spec.rb12
-rw-r--r--spec/ruby/core/array/new_spec.rb20
-rw-r--r--spec/ruby/core/array/pack/buffer_spec.rb2
-rw-r--r--spec/ruby/core/array/pack/m_spec.rb8
-rw-r--r--spec/ruby/core/array/pack/percent_spec.rb2
-rw-r--r--spec/ruby/core/array/pack/shared/basic.rb10
-rw-r--r--spec/ruby/core/array/pack/shared/encodings.rb4
-rw-r--r--spec/ruby/core/array/pack/shared/float.rb8
-rw-r--r--spec/ruby/core/array/pack/shared/numeric_basic.rb14
-rw-r--r--spec/ruby/core/array/pack/shared/string.rb6
-rw-r--r--spec/ruby/core/array/pack/shared/unicode.rb6
-rw-r--r--spec/ruby/core/array/pack/u_spec.rb8
-rw-r--r--spec/ruby/core/array/pack/w_spec.rb2
-rw-r--r--spec/ruby/core/array/pack/x_spec.rb4
-rw-r--r--spec/ruby/core/array/pop_spec.rb16
-rw-r--r--spec/ruby/core/array/product_spec.rb6
-rw-r--r--spec/ruby/core/array/reject_spec.rb4
-rw-r--r--spec/ruby/core/array/reverse_spec.rb2
-rw-r--r--spec/ruby/core/array/rotate_spec.rb16
-rw-r--r--spec/ruby/core/array/sample_spec.rb12
-rw-r--r--spec/ruby/core/array/shared/collect.rb10
-rw-r--r--spec/ruby/core/array/shared/difference.rb2
-rw-r--r--spec/ruby/core/array/shared/inspect.rb2
-rw-r--r--spec/ruby/core/array/shared/join.rb10
-rw-r--r--spec/ruby/core/array/shared/keep_if.rb8
-rw-r--r--spec/ruby/core/array/shared/push.rb4
-rw-r--r--spec/ruby/core/array/shared/replace.rb2
-rw-r--r--spec/ruby/core/array/shared/slice.rb16
-rw-r--r--spec/ruby/core/array/shared/unshift.rb4
-rw-r--r--spec/ruby/core/array/shift_spec.rb12
-rw-r--r--spec/ruby/core/array/shuffle_spec.rb10
-rw-r--r--spec/ruby/core/array/slice_spec.rb6
-rw-r--r--spec/ruby/core/array/sort_by_spec.rb4
-rw-r--r--spec/ruby/core/array/sort_spec.rb10
-rw-r--r--spec/ruby/core/array/sum_spec.rb4
-rw-r--r--spec/ruby/core/array/take_spec.rb2
-rw-r--r--spec/ruby/core/array/to_h_spec.rb6
-rw-r--r--spec/ruby/core/array/transpose_spec.rb4
-rw-r--r--spec/ruby/core/array/try_convert_spec.rb4
-rw-r--r--spec/ruby/core/array/uniq_spec.rb8
-rw-r--r--spec/ruby/core/basicobject/basicobject_spec.rb4
-rw-r--r--spec/ruby/core/basicobject/initialize_spec.rb2
-rw-r--r--spec/ruby/core/basicobject/instance_eval_spec.rb14
-rw-r--r--spec/ruby/core/basicobject/instance_exec_spec.rb14
-rw-r--r--spec/ruby/core/binding/local_variable_defined_spec.rb2
-rw-r--r--spec/ruby/core/binding/local_variable_get_spec.rb12
-rw-r--r--spec/ruby/core/binding/local_variable_set_spec.rb8
-rw-r--r--spec/ruby/core/class/allocate_spec.rb4
-rw-r--r--spec/ruby/core/class/inherited_spec.rb4
-rw-r--r--spec/ruby/core/class/initialize_spec.rb8
-rw-r--r--spec/ruby/core/class/new_spec.rb12
-rw-r--r--spec/ruby/core/comparable/clamp_spec.rb8
-rw-r--r--spec/ruby/core/comparable/equal_value_spec.rb8
-rw-r--r--spec/ruby/core/comparable/gt_spec.rb2
-rw-r--r--spec/ruby/core/comparable/gte_spec.rb2
-rw-r--r--spec/ruby/core/comparable/lt_spec.rb2
-rw-r--r--spec/ruby/core/comparable/lte_spec.rb2
-rw-r--r--spec/ruby/core/complex/coerce_spec.rb8
-rw-r--r--spec/ruby/core/complex/fdiv_spec.rb18
-rw-r--r--spec/ruby/core/complex/negative_spec.rb2
-rw-r--r--spec/ruby/core/complex/polar_spec.rb4
-rw-r--r--spec/ruby/core/complex/positive_spec.rb2
-rw-r--r--spec/ruby/core/complex/rationalize_spec.rb8
-rw-r--r--spec/ruby/core/complex/shared/divide.rb2
-rw-r--r--spec/ruby/core/complex/shared/rect.rb10
-rw-r--r--spec/ruby/core/complex/to_f_spec.rb4
-rw-r--r--spec/ruby/core/complex/to_i_spec.rb4
-rw-r--r--spec/ruby/core/complex/to_r_spec.rb4
-rw-r--r--spec/ruby/core/dir/chdir_spec.rb6
-rw-r--r--spec/ruby/core/dir/children_spec.rb2
-rw-r--r--spec/ruby/core/dir/chroot_spec.rb6
-rw-r--r--spec/ruby/core/dir/close_spec.rb2
-rw-r--r--spec/ruby/core/dir/each_child_spec.rb2
-rw-r--r--spec/ruby/core/dir/empty_spec.rb2
-rw-r--r--spec/ruby/core/dir/entries_spec.rb2
-rw-r--r--spec/ruby/core/dir/fileno_spec.rb2
-rw-r--r--spec/ruby/core/dir/foreach_spec.rb2
-rw-r--r--spec/ruby/core/dir/home_spec.rb2
-rw-r--r--spec/ruby/core/dir/mkdir_spec.rb8
-rw-r--r--spec/ruby/core/dir/shared/chroot.rb4
-rw-r--r--spec/ruby/core/dir/shared/closed.rb2
-rw-r--r--spec/ruby/core/dir/shared/delete.rb10
-rw-r--r--spec/ruby/core/dir/shared/glob.rb2
-rw-r--r--spec/ruby/core/dir/shared/open.rb8
-rw-r--r--spec/ruby/core/encoding/converter/asciicompat_encoding_spec.rb2
-rw-r--r--spec/ruby/core/encoding/converter/convert_spec.rb4
-rw-r--r--spec/ruby/core/encoding/converter/new_spec.rb10
-rw-r--r--spec/ruby/core/encoding/converter/primitive_convert_spec.rb24
-rw-r--r--spec/ruby/core/encoding/converter/primitive_errinfo_spec.rb4
-rw-r--r--spec/ruby/core/encoding/converter/replacement_spec.rb6
-rw-r--r--spec/ruby/core/encoding/converter/search_convpath_spec.rb2
-rw-r--r--spec/ruby/core/encoding/default_external_spec.rb4
-rw-r--r--spec/ruby/core/encoding/default_internal_spec.rb4
-rw-r--r--spec/ruby/core/encoding/find_spec.rb4
-rw-r--r--spec/ruby/core/enumerable/all_spec.rb24
-rw-r--r--spec/ruby/core/enumerable/any_spec.rb24
-rw-r--r--spec/ruby/core/enumerable/chunk_spec.rb4
-rw-r--r--spec/ruby/core/enumerable/chunk_while_spec.rb2
-rw-r--r--spec/ruby/core/enumerable/cycle_spec.rb4
-rw-r--r--spec/ruby/core/enumerable/drop_spec.rb10
-rw-r--r--spec/ruby/core/enumerable/each_cons_spec.rb16
-rw-r--r--spec/ruby/core/enumerable/each_entry_spec.rb4
-rw-r--r--spec/ruby/core/enumerable/each_slice_spec.rb16
-rw-r--r--spec/ruby/core/enumerable/first_spec.rb2
-rw-r--r--spec/ruby/core/enumerable/grep_spec.rb22
-rw-r--r--spec/ruby/core/enumerable/grep_v_spec.rb22
-rw-r--r--spec/ruby/core/enumerable/max_by_spec.rb2
-rw-r--r--spec/ruby/core/enumerable/max_spec.rb8
-rw-r--r--spec/ruby/core/enumerable/min_by_spec.rb2
-rw-r--r--spec/ruby/core/enumerable/min_spec.rb8
-rw-r--r--spec/ruby/core/enumerable/minmax_spec.rb6
-rw-r--r--spec/ruby/core/enumerable/none_spec.rb24
-rw-r--r--spec/ruby/core/enumerable/one_spec.rb24
-rw-r--r--spec/ruby/core/enumerable/shared/collect_concat.rb2
-rw-r--r--spec/ruby/core/enumerable/shared/find.rb10
-rw-r--r--spec/ruby/core/enumerable/shared/take.rb8
-rw-r--r--spec/ruby/core/enumerable/slice_after_spec.rb6
-rw-r--r--spec/ruby/core/enumerable/slice_before_spec.rb6
-rw-r--r--spec/ruby/core/enumerable/slice_when_spec.rb2
-rw-r--r--spec/ruby/core/enumerable/sort_spec.rb6
-rw-r--r--spec/ruby/core/enumerable/take_spec.rb2
-rw-r--r--spec/ruby/core/enumerable/to_h_spec.rb4
-rw-r--r--spec/ruby/core/enumerator/arithmetic_sequence/new_spec.rb4
-rw-r--r--spec/ruby/core/enumerator/chain/initialize_spec.rb2
-rw-r--r--spec/ruby/core/enumerator/chain/rewind_spec.rb4
-rw-r--r--spec/ruby/core/enumerator/each_spec.rb2
-rw-r--r--spec/ruby/core/enumerator/each_with_index_spec.rb2
-rw-r--r--spec/ruby/core/enumerator/feed_spec.rb4
-rw-r--r--spec/ruby/core/enumerator/generator/each_spec.rb2
-rw-r--r--spec/ruby/core/enumerator/generator/initialize_spec.rb2
-rw-r--r--spec/ruby/core/enumerator/initialize_spec.rb4
-rw-r--r--spec/ruby/core/enumerator/lazy/drop_while_spec.rb2
-rw-r--r--spec/ruby/core/enumerator/lazy/grep_spec.rb33
-rw-r--r--spec/ruby/core/enumerator/lazy/grep_v_spec.rb33
-rw-r--r--spec/ruby/core/enumerator/lazy/initialize_spec.rb6
-rw-r--r--spec/ruby/core/enumerator/lazy/reject_spec.rb2
-rw-r--r--spec/ruby/core/enumerator/lazy/shared/collect_concat.rb2
-rw-r--r--spec/ruby/core/enumerator/lazy/shared/select.rb2
-rw-r--r--spec/ruby/core/enumerator/lazy/take_while_spec.rb2
-rw-r--r--spec/ruby/core/enumerator/lazy/zip_spec.rb2
-rw-r--r--spec/ruby/core/enumerator/next_spec.rb8
-rw-r--r--spec/ruby/core/enumerator/next_values_spec.rb2
-rw-r--r--spec/ruby/core/enumerator/peek_spec.rb2
-rw-r--r--spec/ruby/core/enumerator/peek_values_spec.rb2
-rw-r--r--spec/ruby/core/enumerator/rewind_spec.rb2
-rw-r--r--spec/ruby/core/enumerator/size_spec.rb2
-rw-r--r--spec/ruby/core/enumerator/with_index_spec.rb6
-rw-r--r--spec/ruby/core/env/fetch_spec.rb6
-rw-r--r--spec/ruby/core/env/reject_spec.rb4
-rw-r--r--spec/ruby/core/env/shared/store.rb8
-rw-r--r--spec/ruby/core/exception/dup_spec.rb6
-rw-r--r--spec/ruby/core/exception/result_spec.rb2
-rw-r--r--spec/ruby/core/exception/set_backtrace_spec.rb8
-rw-r--r--spec/ruby/core/exception/signal_exception_spec.rb8
-rw-r--r--spec/ruby/core/exception/system_call_error_spec.rb2
-rw-r--r--spec/ruby/core/false/falseclass_spec.rb4
-rw-r--r--spec/ruby/core/fiber/new_spec.rb2
-rw-r--r--spec/ruby/core/fiber/yield_spec.rb2
-rw-r--r--spec/ruby/core/file/atime_spec.rb2
-rw-r--r--spec/ruby/core/file/basename_spec.rb10
-rw-r--r--spec/ruby/core/file/birthtime_spec.rb6
-rw-r--r--spec/ruby/core/file/chmod_spec.rb4
-rw-r--r--spec/ruby/core/file/chown_spec.rb2
-rw-r--r--spec/ruby/core/file/ctime_spec.rb2
-rw-r--r--spec/ruby/core/file/dirname_spec.rb8
-rw-r--r--spec/ruby/core/file/expand_path_spec.rb14
-rw-r--r--spec/ruby/core/file/extname_spec.rb12
-rw-r--r--spec/ruby/core/file/flock_spec.rb4
-rw-r--r--spec/ruby/core/file/ftype_spec.rb6
-rw-r--r--spec/ruby/core/file/join_spec.rb8
-rw-r--r--spec/ruby/core/file/lchmod_spec.rb2
-rw-r--r--spec/ruby/core/file/link_spec.rb12
-rw-r--r--spec/ruby/core/file/mkfifo_spec.rb4
-rw-r--r--spec/ruby/core/file/mtime_spec.rb2
-rw-r--r--spec/ruby/core/file/new_spec.rb14
-rw-r--r--spec/ruby/core/file/open_spec.rb84
-rw-r--r--spec/ruby/core/file/printf_spec.rb2
-rw-r--r--spec/ruby/core/file/readlink_spec.rb4
-rw-r--r--spec/ruby/core/file/realdirpath_spec.rb6
-rw-r--r--spec/ruby/core/file/realpath_spec.rb6
-rw-r--r--spec/ruby/core/file/rename_spec.rb8
-rw-r--r--spec/ruby/core/file/shared/fnmatch.rb14
-rw-r--r--spec/ruby/core/file/shared/read.rb4
-rw-r--r--spec/ruby/core/file/shared/stat.rb2
-rw-r--r--spec/ruby/core/file/shared/unlink.rb4
-rw-r--r--spec/ruby/core/file/size_spec.rb2
-rw-r--r--spec/ruby/core/file/split_spec.rb6
-rw-r--r--spec/ruby/core/file/stat/birthtime_spec.rb2
-rw-r--r--spec/ruby/core/file/stat/new_spec.rb2
-rw-r--r--spec/ruby/core/file/symlink_spec.rb12
-rw-r--r--spec/ruby/core/file/truncate_spec.rb24
-rw-r--r--spec/ruby/core/file/umask_spec.rb2
-rw-r--r--spec/ruby/core/float/divide_spec.rb4
-rw-r--r--spec/ruby/core/float/divmod_spec.rb10
-rw-r--r--spec/ruby/core/float/float_spec.rb4
-rw-r--r--spec/ruby/core/float/gt_spec.rb4
-rw-r--r--spec/ruby/core/float/gte_spec.rb4
-rw-r--r--spec/ruby/core/float/lt_spec.rb4
-rw-r--r--spec/ruby/core/float/lte_spec.rb4
-rw-r--r--spec/ruby/core/float/multiply_spec.rb4
-rw-r--r--spec/ruby/core/float/rationalize_spec.rb8
-rw-r--r--spec/ruby/core/float/round_spec.rb30
-rw-r--r--spec/ruby/core/float/shared/modulo.rb4
-rw-r--r--spec/ruby/core/float/shared/quo.rb4
-rw-r--r--spec/ruby/core/hash/clear_spec.rb4
-rw-r--r--spec/ruby/core/hash/compare_by_identity_spec.rb2
-rw-r--r--spec/ruby/core/hash/constructor_spec.rb6
-rw-r--r--spec/ruby/core/hash/default_proc_spec.rb18
-rw-r--r--spec/ruby/core/hash/default_spec.rb6
-rw-r--r--spec/ruby/core/hash/delete_if_spec.rb4
-rw-r--r--spec/ruby/core/hash/delete_spec.rb4
-rw-r--r--spec/ruby/core/hash/dig_spec.rb6
-rw-r--r--spec/ruby/core/hash/fetch_spec.rb14
-rw-r--r--spec/ruby/core/hash/fetch_values_spec.rb2
-rw-r--r--spec/ruby/core/hash/flatten_spec.rb2
-rw-r--r--spec/ruby/core/hash/initialize_spec.rb8
-rw-r--r--spec/ruby/core/hash/keep_if_spec.rb4
-rw-r--r--spec/ruby/core/hash/merge_spec.rb2
-rw-r--r--spec/ruby/core/hash/new_spec.rb6
-rw-r--r--spec/ruby/core/hash/rehash_spec.rb4
-rw-r--r--spec/ruby/core/hash/reject_spec.rb4
-rw-r--r--spec/ruby/core/hash/shared/comparison.rb6
-rw-r--r--spec/ruby/core/hash/shared/replace.rb6
-rw-r--r--spec/ruby/core/hash/shared/select.rb4
-rw-r--r--spec/ruby/core/hash/shared/store.rb2
-rw-r--r--spec/ruby/core/hash/shared/to_s.rb2
-rw-r--r--spec/ruby/core/hash/shared/update.rb6
-rw-r--r--spec/ruby/core/hash/shift_spec.rb4
-rw-r--r--spec/ruby/core/hash/to_proc_spec.rb6
-rw-r--r--spec/ruby/core/hash/try_convert_spec.rb4
-rw-r--r--spec/ruby/core/integer/allbits_spec.rb6
-rw-r--r--spec/ruby/core/integer/anybits_spec.rb6
-rw-r--r--spec/ruby/core/integer/bit_and_spec.rb8
-rw-r--r--spec/ruby/core/integer/bit_or_spec.rb10
-rw-r--r--spec/ruby/core/integer/bit_xor_spec.rb10
-rw-r--r--spec/ruby/core/integer/chr_spec.rb20
-rw-r--r--spec/ruby/core/integer/coerce_spec.rb33
-rw-r--r--spec/ruby/core/integer/comparison_spec.rb6
-rw-r--r--spec/ruby/core/integer/digits_spec.rb6
-rw-r--r--spec/ruby/core/integer/div_spec.rb32
-rw-r--r--spec/ruby/core/integer/divide_spec.rb16
-rw-r--r--spec/ruby/core/integer/divmod_spec.rb34
-rw-r--r--spec/ruby/core/integer/downto_spec.rb8
-rw-r--r--spec/ruby/core/integer/element_reference_spec.rb8
-rw-r--r--spec/ruby/core/integer/fdiv_spec.rb4
-rw-r--r--spec/ruby/core/integer/gcd_spec.rb8
-rw-r--r--spec/ruby/core/integer/gcdlcm_spec.rb8
-rw-r--r--spec/ruby/core/integer/gt_spec.rb8
-rw-r--r--spec/ruby/core/integer/gte_spec.rb8
-rw-r--r--spec/ruby/core/integer/lcm_spec.rb8
-rw-r--r--spec/ruby/core/integer/left_shift_spec.rb12
-rw-r--r--spec/ruby/core/integer/lt_spec.rb8
-rw-r--r--spec/ruby/core/integer/lte_spec.rb8
-rw-r--r--spec/ruby/core/integer/minus_spec.rb12
-rw-r--r--spec/ruby/core/integer/multiply_spec.rb12
-rw-r--r--spec/ruby/core/integer/nobits_spec.rb6
-rw-r--r--spec/ruby/core/integer/plus_spec.rb12
-rw-r--r--spec/ruby/core/integer/rationalize_spec.rb4
-rw-r--r--spec/ruby/core/integer/remainder_spec.rb6
-rw-r--r--spec/ruby/core/integer/right_shift_spec.rb12
-rw-r--r--spec/ruby/core/integer/round_spec.rb16
-rw-r--r--spec/ruby/core/integer/shared/exponent.rb6
-rw-r--r--spec/ruby/core/integer/shared/modulo.rb32
-rw-r--r--spec/ruby/core/integer/sqrt_spec.rb4
-rw-r--r--spec/ruby/core/integer/to_r_spec.rb4
-rw-r--r--spec/ruby/core/integer/to_s_spec.rb16
-rw-r--r--spec/ruby/core/integer/upto_spec.rb8
-rw-r--r--spec/ruby/core/io/advise_spec.rb14
-rw-r--r--spec/ruby/core/io/binmode_spec.rb2
-rw-r--r--spec/ruby/core/io/binread_spec.rb4
-rw-r--r--spec/ruby/core/io/bytes_spec.rb4
-rw-r--r--spec/ruby/core/io/close_on_exec_spec.rb4
-rw-r--r--spec/ruby/core/io/close_read_spec.rb6
-rw-r--r--spec/ruby/core/io/close_spec.rb10
-rw-r--r--spec/ruby/core/io/close_write_spec.rb6
-rw-r--r--spec/ruby/core/io/copy_stream_spec.rb10
-rw-r--r--spec/ruby/core/io/dup_spec.rb6
-rw-r--r--spec/ruby/core/io/each_byte_spec.rb2
-rw-r--r--spec/ruby/core/io/each_codepoint_spec.rb2
-rw-r--r--spec/ruby/core/io/eof_spec.rb6
-rw-r--r--spec/ruby/core/io/fcntl_spec.rb2
-rw-r--r--spec/ruby/core/io/fileno_spec.rb2
-rw-r--r--spec/ruby/core/io/flush_spec.rb31
-rw-r--r--spec/ruby/core/io/fsync_spec.rb2
-rw-r--r--spec/ruby/core/io/getbyte_spec.rb2
-rw-r--r--spec/ruby/core/io/getc_spec.rb2
-rw-r--r--spec/ruby/core/io/gets_spec.rb6
-rw-r--r--spec/ruby/core/io/initialize_spec.rb10
-rw-r--r--spec/ruby/core/io/ioctl_spec.rb4
-rw-r--r--spec/ruby/core/io/lineno_spec.rb6
-rw-r--r--spec/ruby/core/io/open_spec.rb4
-rw-r--r--spec/ruby/core/io/output_spec.rb8
-rw-r--r--spec/ruby/core/io/pid_spec.rb2
-rw-r--r--spec/ruby/core/io/pipe_spec.rb2
-rw-r--r--spec/ruby/core/io/popen_spec.rb4
-rw-r--r--spec/ruby/core/io/pread_spec.rb6
-rw-r--r--spec/ruby/core/io/print_spec.rb2
-rw-r--r--spec/ruby/core/io/printf_spec.rb2
-rw-r--r--spec/ruby/core/io/puts_spec.rb4
-rw-r--r--spec/ruby/core/io/pwrite_spec.rb4
-rw-r--r--spec/ruby/core/io/read_nonblock_spec.rb6
-rw-r--r--spec/ruby/core/io/read_spec.rb20
-rw-r--r--spec/ruby/core/io/readbyte_spec.rb2
-rw-r--r--spec/ruby/core/io/readchar_spec.rb6
-rw-r--r--spec/ruby/core/io/readline_spec.rb4
-rw-r--r--spec/ruby/core/io/readlines_spec.rb6
-rw-r--r--spec/ruby/core/io/readpartial_spec.rb12
-rw-r--r--spec/ruby/core/io/reopen_spec.rb12
-rw-r--r--spec/ruby/core/io/rewind_spec.rb2
-rw-r--r--spec/ruby/core/io/seek_spec.rb2
-rw-r--r--spec/ruby/core/io/select_spec.rb18
-rw-r--r--spec/ruby/core/io/shared/binwrite.rb2
-rw-r--r--spec/ruby/core/io/shared/chars.rb4
-rw-r--r--spec/ruby/core/io/shared/codepoints.rb4
-rw-r--r--spec/ruby/core/io/shared/each.rb4
-rw-r--r--spec/ruby/core/io/shared/new.rb48
-rw-r--r--spec/ruby/core/io/shared/pos.rb6
-rw-r--r--spec/ruby/core/io/shared/readlines.rb18
-rw-r--r--spec/ruby/core/io/shared/tty.rb2
-rw-r--r--spec/ruby/core/io/shared/write.rb16
-rw-r--r--spec/ruby/core/io/stat_spec.rb2
-rw-r--r--spec/ruby/core/io/sync_spec.rb4
-rw-r--r--spec/ruby/core/io/sysopen_spec.rb2
-rw-r--r--spec/ruby/core/io/sysread_spec.rb6
-rw-r--r--spec/ruby/core/io/sysseek_spec.rb4
-rw-r--r--spec/ruby/core/io/syswrite_spec.rb4
-rw-r--r--spec/ruby/core/io/to_i_spec.rb2
-rw-r--r--spec/ruby/core/io/try_convert_spec.rb4
-rw-r--r--spec/ruby/core/io/ungetbyte_spec.rb6
-rw-r--r--spec/ruby/core/io/ungetc_spec.rb4
-rw-r--r--spec/ruby/core/io/write_nonblock_spec.rb4
-rw-r--r--spec/ruby/core/io/write_spec.rb4
-rw-r--r--spec/ruby/core/kernel/Array_spec.rb4
-rw-r--r--spec/ruby/core/kernel/Complex_spec.rb12
-rw-r--r--spec/ruby/core/kernel/Float_spec.rb82
-rw-r--r--spec/ruby/core/kernel/Hash_spec.rb4
-rw-r--r--spec/ruby/core/kernel/Integer_spec.rb200
-rw-r--r--spec/ruby/core/kernel/String_spec.rb8
-rw-r--r--spec/ruby/core/kernel/backtick_spec.rb4
-rw-r--r--spec/ruby/core/kernel/binding_spec.rb2
-rw-r--r--spec/ruby/core/kernel/catch_spec.rb6
-rw-r--r--spec/ruby/core/kernel/define_singleton_method_spec.rb16
-rw-r--r--spec/ruby/core/kernel/dup_spec.rb6
-rw-r--r--spec/ruby/core/kernel/eval_spec.rb12
-rw-r--r--spec/ruby/core/kernel/extend_spec.rb8
-rw-r--r--spec/ruby/core/kernel/fail_spec.rb8
-rw-r--r--spec/ruby/core/kernel/fixtures/classes.rb25
-rw-r--r--spec/ruby/core/kernel/fixtures/eval_return_with_lambda.rb2
-rw-r--r--spec/ruby/core/kernel/freeze_spec.rb4
-rw-r--r--spec/ruby/core/kernel/gsub_spec.rb2
-rw-r--r--spec/ruby/core/kernel/instance_of_spec.rb6
-rw-r--r--spec/ruby/core/kernel/instance_variable_defined_spec.rb2
-rw-r--r--spec/ruby/core/kernel/instance_variable_get_spec.rb24
-rw-r--r--spec/ruby/core/kernel/instance_variable_set_spec.rb20
-rw-r--r--spec/ruby/core/kernel/instance_variables_spec.rb2
-rw-r--r--spec/ruby/core/kernel/loop_spec.rb2
-rw-r--r--spec/ruby/core/kernel/open_spec.rb8
-rw-r--r--spec/ruby/core/kernel/p_spec.rb18
-rw-r--r--spec/ruby/core/kernel/printf_spec.rb4
-rw-r--r--spec/ruby/core/kernel/proc_spec.rb2
-rw-r--r--spec/ruby/core/kernel/public_method_spec.rb6
-rw-r--r--spec/ruby/core/kernel/public_send_spec.rb12
-rw-r--r--spec/ruby/core/kernel/rand_spec.rb6
-rw-r--r--spec/ruby/core/kernel/remove_instance_variable_spec.rb6
-rw-r--r--spec/ruby/core/kernel/require_relative_spec.rb36
-rw-r--r--spec/ruby/core/kernel/respond_to_spec.rb4
-rw-r--r--spec/ruby/core/kernel/shared/dup_clone.rb4
-rw-r--r--spec/ruby/core/kernel/shared/kind_of.rb8
-rw-r--r--spec/ruby/core/kernel/shared/lambda.rb2
-rw-r--r--spec/ruby/core/kernel/shared/load.rb4
-rw-r--r--spec/ruby/core/kernel/shared/method.rb4
-rw-r--r--spec/ruby/core/kernel/shared/require.rb32
-rw-r--r--spec/ruby/core/kernel/shared/sprintf.rb24
-rw-r--r--spec/ruby/core/kernel/shared/sprintf_encoding.rb2
-rw-r--r--spec/ruby/core/kernel/singleton_class_spec.rb4
-rw-r--r--spec/ruby/core/kernel/sleep_spec.rb8
-rw-r--r--spec/ruby/core/kernel/spawn_spec.rb4
-rw-r--r--spec/ruby/core/kernel/sprintf_spec.rb8
-rw-r--r--spec/ruby/core/kernel/srand_spec.rb6
-rw-r--r--spec/ruby/core/kernel/system_spec.rb18
-rw-r--r--spec/ruby/core/kernel/taint_spec.rb6
-rw-r--r--spec/ruby/core/kernel/tap_spec.rb2
-rw-r--r--spec/ruby/core/kernel/throw_spec.rb10
-rw-r--r--spec/ruby/core/kernel/trace_var_spec.rb2
-rw-r--r--spec/ruby/core/kernel/trust_spec.rb2
-rw-r--r--spec/ruby/core/kernel/untaint_spec.rb2
-rw-r--r--spec/ruby/core/kernel/untrust_spec.rb2
-rw-r--r--spec/ruby/core/kernel/untrusted_spec.rb2
-rw-r--r--spec/ruby/core/kernel/warn_spec.rb18
-rw-r--r--spec/ruby/core/main/private_spec.rb2
-rw-r--r--spec/ruby/core/main/public_spec.rb2
-rw-r--r--spec/ruby/core/main/using_spec.rb8
-rw-r--r--spec/ruby/core/marshal/dump_spec.rb36
-rw-r--r--spec/ruby/core/marshal/shared/load.rb32
-rw-r--r--spec/ruby/core/matchdata/element_reference_spec.rb4
-rw-r--r--spec/ruby/core/math/acos_spec.rb10
-rw-r--r--spec/ruby/core/math/acosh_spec.rb10
-rw-r--r--spec/ruby/core/math/asin_spec.rb8
-rw-r--r--spec/ruby/core/math/asinh_spec.rb4
-rw-r--r--spec/ruby/core/math/atan2_spec.rb12
-rw-r--r--spec/ruby/core/math/atan_spec.rb4
-rw-r--r--spec/ruby/core/math/cbrt_spec.rb4
-rw-r--r--spec/ruby/core/math/cos_spec.rb4
-rw-r--r--spec/ruby/core/math/cosh_spec.rb4
-rw-r--r--spec/ruby/core/math/erf_spec.rb4
-rw-r--r--spec/ruby/core/math/erfc_spec.rb4
-rw-r--r--spec/ruby/core/math/exp_spec.rb4
-rw-r--r--spec/ruby/core/math/frexp_spec.rb4
-rw-r--r--spec/ruby/core/math/gamma_spec.rb4
-rw-r--r--spec/ruby/core/math/hypot_spec.rb4
-rw-r--r--spec/ruby/core/math/ldexp_spec.rb10
-rw-r--r--spec/ruby/core/math/lgamma_spec.rb2
-rw-r--r--spec/ruby/core/math/log10_spec.rb6
-rw-r--r--spec/ruby/core/math/log2_spec.rb8
-rw-r--r--spec/ruby/core/math/log_spec.rb12
-rw-r--r--spec/ruby/core/math/sin_spec.rb4
-rw-r--r--spec/ruby/core/math/sinh_spec.rb4
-rw-r--r--spec/ruby/core/math/sqrt_spec.rb4
-rw-r--r--spec/ruby/core/math/tan_spec.rb4
-rw-r--r--spec/ruby/core/math/tanh_spec.rb4
-rw-r--r--spec/ruby/core/method/curry_spec.rb10
-rw-r--r--spec/ruby/core/method/parameters_spec.rb2
-rw-r--r--spec/ruby/core/method/shared/call.rb4
-rw-r--r--spec/ruby/core/module/alias_method_spec.rb16
-rw-r--r--spec/ruby/core/module/append_features_spec.rb8
-rw-r--r--spec/ruby/core/module/attr_accessor_spec.rb10
-rw-r--r--spec/ruby/core/module/attr_reader_spec.rb8
-rw-r--r--spec/ruby/core/module/attr_spec.rb14
-rw-r--r--spec/ruby/core/module/attr_writer_spec.rb8
-rw-r--r--spec/ruby/core/module/autoload_spec.rb32
-rw-r--r--spec/ruby/core/module/class_variable_defined_spec.rb8
-rw-r--r--spec/ruby/core/module/class_variable_get_spec.rb16
-rw-r--r--spec/ruby/core/module/class_variable_set_spec.rb12
-rw-r--r--spec/ruby/core/module/const_defined_spec.rb16
-rw-r--r--spec/ruby/core/module/const_get_spec.rb44
-rw-r--r--spec/ruby/core/module/const_missing_spec.rb2
-rw-r--r--spec/ruby/core/module/const_set_spec.rb20
-rw-r--r--spec/ruby/core/module/define_method_spec.rb92
-rw-r--r--spec/ruby/core/module/define_singleton_method_spec.rb2
-rw-r--r--spec/ruby/core/module/deprecate_constant_spec.rb14
-rw-r--r--spec/ruby/core/module/extend_object_spec.rb4
-rw-r--r--spec/ruby/core/module/gt_spec.rb2
-rw-r--r--spec/ruby/core/module/gte_spec.rb2
-rw-r--r--spec/ruby/core/module/include_spec.rb12
-rw-r--r--spec/ruby/core/module/instance_method_spec.rb12
-rw-r--r--spec/ruby/core/module/lt_spec.rb2
-rw-r--r--spec/ruby/core/module/lte_spec.rb2
-rw-r--r--spec/ruby/core/module/method_defined_spec.rb4
-rw-r--r--spec/ruby/core/module/module_function_spec.rb10
-rw-r--r--spec/ruby/core/module/prepend_features_spec.rb4
-rw-r--r--spec/ruby/core/module/prepend_spec.rb10
-rw-r--r--spec/ruby/core/module/private_class_method_spec.rb20
-rw-r--r--spec/ruby/core/module/private_constant_spec.rb8
-rw-r--r--spec/ruby/core/module/private_method_defined_spec.rb10
-rw-r--r--spec/ruby/core/module/private_spec.rb6
-rw-r--r--spec/ruby/core/module/protected_method_defined_spec.rb10
-rw-r--r--spec/ruby/core/module/protected_spec.rb4
-rw-r--r--spec/ruby/core/module/public_class_method_spec.rb14
-rw-r--r--spec/ruby/core/module/public_constant_spec.rb2
-rw-r--r--spec/ruby/core/module/public_instance_method_spec.rb10
-rw-r--r--spec/ruby/core/module/public_method_defined_spec.rb10
-rw-r--r--spec/ruby/core/module/public_spec.rb2
-rw-r--r--spec/ruby/core/module/refine_spec.rb20
-rw-r--r--spec/ruby/core/module/remove_class_variable_spec.rb8
-rw-r--r--spec/ruby/core/module/remove_const_spec.rb26
-rw-r--r--spec/ruby/core/module/remove_method_spec.rb6
-rw-r--r--spec/ruby/core/module/shared/class_eval.rb14
-rw-r--r--spec/ruby/core/module/shared/class_exec.rb4
-rw-r--r--spec/ruby/core/module/undef_method_spec.rb20
-rw-r--r--spec/ruby/core/module/using_spec.rb10
-rw-r--r--spec/ruby/core/mutex/lock_spec.rb4
-rw-r--r--spec/ruby/core/mutex/sleep_spec.rb10
-rw-r--r--spec/ruby/core/mutex/synchronize_spec.rb10
-rw-r--r--spec/ruby/core/mutex/unlock_spec.rb6
-rw-r--r--spec/ruby/core/nil/nilclass_spec.rb4
-rw-r--r--spec/ruby/core/nil/rationalize_spec.rb4
-rw-r--r--spec/ruby/core/numeric/coerce_spec.rb12
-rw-r--r--spec/ruby/core/numeric/div_spec.rb6
-rw-r--r--spec/ruby/core/numeric/quo_spec.rb18
-rw-r--r--spec/ruby/core/numeric/real_spec.rb2
-rw-r--r--spec/ruby/core/numeric/shared/imag.rb2
-rw-r--r--spec/ruby/core/numeric/shared/rect.rb2
-rw-r--r--spec/ruby/core/numeric/shared/step.rb38
-rw-r--r--spec/ruby/core/numeric/singleton_method_added_spec.rb8
-rw-r--r--spec/ruby/core/numeric/step_spec.rb26
-rw-r--r--spec/ruby/core/objectspace/define_finalizer_spec.rb6
-rw-r--r--spec/ruby/core/objectspace/fixtures/classes.rb2
-rw-r--r--spec/ruby/core/objectspace/garbage_collect_spec.rb6
-rw-r--r--spec/ruby/core/proc/allocate_spec.rb2
-rw-r--r--spec/ruby/core/proc/binding_spec.rb4
-rw-r--r--spec/ruby/core/proc/compose_spec.rb16
-rw-r--r--spec/ruby/core/proc/curry_spec.rb60
-rw-r--r--spec/ruby/core/proc/fixtures/source_location.rb6
-rw-r--r--spec/ruby/core/proc/hash_spec.rb2
-rw-r--r--spec/ruby/core/proc/lambda_spec.rb14
-rw-r--r--spec/ruby/core/proc/new_spec.rb12
-rw-r--r--spec/ruby/core/proc/parameters_spec.rb36
-rw-r--r--spec/ruby/core/proc/shared/call.rb28
-rw-r--r--spec/ruby/core/proc/shared/call_arguments.rb2
-rw-r--r--spec/ruby/core/proc/shared/dup.rb2
-rw-r--r--spec/ruby/core/proc/shared/equal.rb20
-rw-r--r--spec/ruby/core/proc/shared/to_s.rb4
-rw-r--r--spec/ruby/core/proc/source_location_spec.rb2
-rw-r--r--spec/ruby/core/proc/to_proc_spec.rb2
-rw-r--r--spec/ruby/core/process/clock_gettime_spec.rb2
-rw-r--r--spec/ruby/core/process/daemon_spec.rb2
-rw-r--r--spec/ruby/core/process/detach_spec.rb2
-rw-r--r--spec/ruby/core/process/euid_spec.rb6
-rw-r--r--spec/ruby/core/process/exec_spec.rb20
-rw-r--r--spec/ruby/core/process/getrlimit_spec.rb6
-rw-r--r--spec/ruby/core/process/groups_spec.rb4
-rw-r--r--spec/ruby/core/process/initgroups_spec.rb2
-rw-r--r--spec/ruby/core/process/kill_spec.rb8
-rw-r--r--spec/ruby/core/process/setrlimit_spec.rb10
-rw-r--r--spec/ruby/core/process/spawn_spec.rb126
-rw-r--r--spec/ruby/core/process/uid_spec.rb6
-rw-r--r--spec/ruby/core/process/wait2_spec.rb4
-rw-r--r--spec/ruby/core/process/wait_spec.rb12
-rw-r--r--spec/ruby/core/process/waitall_spec.rb4
-rw-r--r--spec/ruby/core/random/fixtures/classes.rb15
-rw-r--r--spec/ruby/core/random/new_spec.rb2
-rw-r--r--spec/ruby/core/random/rand_spec.rb19
-rw-r--r--spec/ruby/core/random/shared/urandom.rb2
-rw-r--r--spec/ruby/core/range/bsearch_spec.rb8
-rw-r--r--spec/ruby/core/range/case_compare_spec.rb2
-rw-r--r--spec/ruby/core/range/each_spec.rb6
-rw-r--r--spec/ruby/core/range/first_spec.rb8
-rw-r--r--spec/ruby/core/range/initialize_spec.rb18
-rw-r--r--spec/ruby/core/range/last_spec.rb8
-rw-r--r--spec/ruby/core/range/max_spec.rb4
-rw-r--r--spec/ruby/core/range/new_spec.rb6
-rw-r--r--spec/ruby/core/range/shared/cover_and_include.rb4
-rw-r--r--spec/ruby/core/range/step_spec.rb30
-rw-r--r--spec/ruby/core/range/to_a_spec.rb2
-rw-r--r--spec/ruby/core/rational/rationalize_spec.rb4
-rw-r--r--spec/ruby/core/rational/to_r_spec.rb4
-rw-r--r--spec/ruby/core/regexp/initialize_spec.rb4
-rw-r--r--spec/ruby/core/regexp/match_spec.rb10
-rw-r--r--spec/ruby/core/regexp/new_spec.rb4
-rw-r--r--spec/ruby/core/regexp/options_spec.rb2
-rw-r--r--spec/ruby/core/regexp/shared/new.rb22
-rw-r--r--spec/ruby/core/regexp/union_spec.rb28
-rw-r--r--spec/ruby/core/signal/signame_spec.rb2
-rw-r--r--spec/ruby/core/sizedqueue/append_spec.rb2
-rw-r--r--spec/ruby/core/sizedqueue/enq_spec.rb2
-rw-r--r--spec/ruby/core/sizedqueue/max_spec.rb4
-rw-r--r--spec/ruby/core/sizedqueue/new_spec.rb2
-rw-r--r--spec/ruby/core/sizedqueue/num_waiting_spec.rb2
-rw-r--r--spec/ruby/core/sizedqueue/push_spec.rb2
-rw-r--r--spec/ruby/core/string/capitalize_spec.rb18
-rw-r--r--spec/ruby/core/string/casecmp_spec.rb4
-rw-r--r--spec/ruby/core/string/center_spec.rb20
-rw-r--r--spec/ruby/core/string/chomp_spec.rb10
-rw-r--r--spec/ruby/core/string/chop_spec.rb4
-rw-r--r--spec/ruby/core/string/clear_spec.rb4
-rw-r--r--spec/ruby/core/string/codepoints_spec.rb2
-rw-r--r--spec/ruby/core/string/count_spec.rb12
-rw-r--r--spec/ruby/core/string/crypt_spec.rb18
-rw-r--r--spec/ruby/core/string/delete_prefix_spec.rb6
-rw-r--r--spec/ruby/core/string/delete_spec.rb18
-rw-r--r--spec/ruby/core/string/delete_suffix_spec.rb6
-rw-r--r--spec/ruby/core/string/downcase_spec.rb16
-rw-r--r--spec/ruby/core/string/dup_spec.rb6
-rw-r--r--spec/ruby/core/string/element_set_spec.rb76
-rw-r--r--spec/ruby/core/string/encode_spec.rb4
-rw-r--r--spec/ruby/core/string/end_with_spec.rb8
-rw-r--r--spec/ruby/core/string/force_encoding_spec.rb6
-rw-r--r--spec/ruby/core/string/getbyte_spec.rb6
-rw-r--r--spec/ruby/core/string/gsub_spec.rb40
-rw-r--r--spec/ruby/core/string/include_spec.rb8
-rw-r--r--spec/ruby/core/string/index_spec.rb12
-rw-r--r--spec/ruby/core/string/insert_spec.rb16
-rw-r--r--spec/ruby/core/string/ljust_spec.rb18
-rw-r--r--spec/ruby/core/string/lstrip_spec.rb6
-rw-r--r--spec/ruby/core/string/match_spec.rb8
-rw-r--r--spec/ruby/core/string/modulo_spec.rb130
-rw-r--r--spec/ruby/core/string/multiply_spec.rb2
-rw-r--r--spec/ruby/core/string/new_spec.rb4
-rw-r--r--spec/ruby/core/string/ord_spec.rb2
-rw-r--r--spec/ruby/core/string/partition_spec.rb4
-rw-r--r--spec/ruby/core/string/percent_spec.rb4
-rw-r--r--spec/ruby/core/string/plus_spec.rb4
-rw-r--r--spec/ruby/core/string/prepend_spec.rb8
-rw-r--r--spec/ruby/core/string/reverse_spec.rb6
-rw-r--r--spec/ruby/core/string/rindex_spec.rb12
-rw-r--r--spec/ruby/core/string/rjust_spec.rb18
-rw-r--r--spec/ruby/core/string/rpartition_spec.rb4
-rw-r--r--spec/ruby/core/string/rstrip_spec.rb6
-rw-r--r--spec/ruby/core/string/scan_spec.rb6
-rw-r--r--spec/ruby/core/string/scrub_spec.rb4
-rw-r--r--spec/ruby/core/string/setbyte_spec.rb8
-rw-r--r--spec/ruby/core/string/shared/codepoints.rb4
-rw-r--r--spec/ruby/core/string/shared/concat.rb28
-rw-r--r--spec/ruby/core/string/shared/each_line.rb6
-rw-r--r--spec/ruby/core/string/shared/encode.rb14
-rw-r--r--spec/ruby/core/string/shared/replace.rb10
-rw-r--r--spec/ruby/core/string/shared/slice.rb48
-rw-r--r--spec/ruby/core/string/shared/succ.rb4
-rw-r--r--spec/ruby/core/string/slice_spec.rb42
-rw-r--r--spec/ruby/core/string/split_spec.rb8
-rw-r--r--spec/ruby/core/string/squeeze_spec.rb18
-rw-r--r--spec/ruby/core/string/start_with_spec.rb6
-rw-r--r--spec/ruby/core/string/strip_spec.rb6
-rw-r--r--spec/ruby/core/string/sub_spec.rb32
-rw-r--r--spec/ruby/core/string/swapcase_spec.rb18
-rw-r--r--spec/ruby/core/string/to_i_spec.rb6
-rw-r--r--spec/ruby/core/string/tr_s_spec.rb6
-rw-r--r--spec/ruby/core/string/tr_spec.rb10
-rw-r--r--spec/ruby/core/string/try_convert_spec.rb4
-rw-r--r--spec/ruby/core/string/unicode_normalize_spec.rb8
-rw-r--r--spec/ruby/core/string/unicode_normalized_spec.rb4
-rw-r--r--spec/ruby/core/string/unpack/at_spec.rb2
-rw-r--r--spec/ruby/core/string/unpack/p_spec.rb4
-rw-r--r--spec/ruby/core/string/unpack/percent_spec.rb2
-rw-r--r--spec/ruby/core/string/unpack/shared/basic.rb8
-rw-r--r--spec/ruby/core/string/unpack/u_spec.rb4
-rw-r--r--spec/ruby/core/string/unpack/x_spec.rb6
-rw-r--r--spec/ruby/core/string/upcase_spec.rb20
-rw-r--r--spec/ruby/core/string/upto_spec.rb6
-rw-r--r--spec/ruby/core/struct/dig_spec.rb4
-rw-r--r--spec/ruby/core/struct/element_reference_spec.rb12
-rw-r--r--spec/ruby/core/struct/element_set_spec.rb8
-rw-r--r--spec/ruby/core/struct/new_spec.rb26
-rw-r--r--spec/ruby/core/struct/struct_spec.rb2
-rw-r--r--spec/ruby/core/struct/values_at_spec.rb2
-rw-r--r--spec/ruby/core/symbol/shared/slice.rb24
-rw-r--r--spec/ruby/core/symbol/symbol_spec.rb4
-rw-r--r--spec/ruby/core/symbol/to_proc_spec.rb2
-rw-r--r--spec/ruby/core/thread/abort_on_exception_spec.rb2
-rw-r--r--spec/ruby/core/thread/allocate_spec.rb2
-rw-r--r--spec/ruby/core/thread/backtrace/location/fixtures/main.rb4
-rw-r--r--spec/ruby/core/thread/element_reference_spec.rb4
-rw-r--r--spec/ruby/core/thread/element_set_spec.rb4
-rw-r--r--spec/ruby/core/thread/exclusive_spec.rb4
-rw-r--r--spec/ruby/core/thread/fixtures/classes.rb9
-rw-r--r--spec/ruby/core/thread/initialize_spec.rb2
-rw-r--r--spec/ruby/core/thread/join_spec.rb20
-rw-r--r--spec/ruby/core/thread/key_spec.rb4
-rw-r--r--spec/ruby/core/thread/list_spec.rb6
-rw-r--r--spec/ruby/core/thread/name_spec.rb2
-rw-r--r--spec/ruby/core/thread/new_spec.rb12
-rw-r--r--spec/ruby/core/thread/priority_spec.rb2
-rw-r--r--spec/ruby/core/thread/shared/exit.rb2
-rw-r--r--spec/ruby/core/thread/shared/start.rb2
-rw-r--r--spec/ruby/core/thread/shared/wakeup.rb2
-rw-r--r--spec/ruby/core/thread/value_spec.rb12
-rw-r--r--spec/ruby/core/threadgroup/add_spec.rb9
-rw-r--r--spec/ruby/core/threadgroup/enclose_spec.rb11
-rw-r--r--spec/ruby/core/threadgroup/fixtures/classes.rb6
-rw-r--r--spec/ruby/core/threadgroup/list_spec.rb11
-rw-r--r--spec/ruby/core/time/at_spec.rb18
-rw-r--r--spec/ruby/core/time/getlocal_spec.rb16
-rw-r--r--spec/ruby/core/time/localtime_spec.rb10
-rw-r--r--spec/ruby/core/time/minus_spec.rb12
-rw-r--r--spec/ruby/core/time/new_spec.rb36
-rw-r--r--spec/ruby/core/time/plus_spec.rb14
-rw-r--r--spec/ruby/core/time/shared/gmtime.rb2
-rw-r--r--spec/ruby/core/time/shared/time_params.rb28
-rw-r--r--spec/ruby/core/time/strftime_spec.rb10
-rw-r--r--spec/ruby/core/time/succ_spec.rb2
-rw-r--r--spec/ruby/core/time/zone_spec.rb2
-rw-r--r--spec/ruby/core/tracepoint/enable_spec.rb22
-rw-r--r--spec/ruby/core/tracepoint/parameters_spec.rb2
-rw-r--r--spec/ruby/core/true/trueclass_spec.rb4
-rw-r--r--spec/ruby/core/unboundmethod/bind_spec.rb16
-rw-r--r--spec/ruby/fixtures/class.rb2
-rw-r--r--spec/ruby/language/BEGIN_spec.rb2
-rw-r--r--spec/ruby/language/alias_spec.rb12
-rw-r--r--spec/ruby/language/block_spec.rb48
-rw-r--r--spec/ruby/language/break_spec.rb16
-rw-r--r--spec/ruby/language/case_spec.rb4
-rw-r--r--spec/ruby/language/class_spec.rb26
-rw-r--r--spec/ruby/language/class_variable_spec.rb4
-rw-r--r--spec/ruby/language/constants_spec.rb58
-rw-r--r--spec/ruby/language/def_spec.rb62
-rw-r--r--spec/ruby/language/encoding_spec.rb2
-rw-r--r--spec/ruby/language/ensure_spec.rb10
-rw-r--r--spec/ruby/language/file_spec.rb2
-rw-r--r--spec/ruby/language/fixtures/break.rb10
-rw-r--r--spec/ruby/language/fixtures/break_lambda_toplevel.rb2
-rw-r--r--spec/ruby/language/fixtures/break_lambda_toplevel_block.rb2
-rw-r--r--spec/ruby/language/fixtures/break_lambda_toplevel_method.rb2
-rw-r--r--spec/ruby/language/fixtures/super.rb6
-rw-r--r--spec/ruby/language/hash_spec.rb6
-rw-r--r--spec/ruby/language/lambda_spec.rb16
-rw-r--r--spec/ruby/language/line_spec.rb2
-rw-r--r--spec/ruby/language/loop_spec.rb2
-rw-r--r--spec/ruby/language/metaclass_spec.rb12
-rw-r--r--spec/ruby/language/method_spec.rb58
-rw-r--r--spec/ruby/language/module_spec.rb12
-rw-r--r--spec/ruby/language/next_spec.rb12
-rw-r--r--spec/ruby/language/numbers_spec.rb6
-rw-r--r--spec/ruby/language/optional_assignments_spec.rb4
-rw-r--r--spec/ruby/language/or_spec.rb12
-rw-r--r--spec/ruby/language/precedence_spec.rb16
-rw-r--r--spec/ruby/language/predefined_spec.rb56
-rw-r--r--spec/ruby/language/private_spec.rb12
-rw-r--r--spec/ruby/language/redo_spec.rb4
-rw-r--r--spec/ruby/language/regexp/character_classes_spec.rb2
-rw-r--r--spec/ruby/language/regexp/escapes_spec.rb6
-rw-r--r--spec/ruby/language/regexp/grouping_spec.rb2
-rw-r--r--spec/ruby/language/regexp/interpolation_spec.rb4
-rw-r--r--spec/ruby/language/regexp/modifiers_spec.rb6
-rw-r--r--spec/ruby/language/regexp_spec.rb8
-rw-r--r--spec/ruby/language/rescue_spec.rb28
-rw-r--r--spec/ruby/language/retry_spec.rb2
-rw-r--r--spec/ruby/language/return_spec.rb8
-rw-r--r--spec/ruby/language/safe_navigator_spec.rb8
-rw-r--r--spec/ruby/language/safe_spec.rb14
-rw-r--r--spec/ruby/language/send_spec.rb26
-rw-r--r--spec/ruby/language/singleton_class_spec.rb18
-rw-r--r--spec/ruby/language/string_spec.rb2
-rw-r--r--spec/ruby/language/super_spec.rb6
-rw-r--r--spec/ruby/language/throw_spec.rb8
-rw-r--r--spec/ruby/language/undef_spec.rb12
-rw-r--r--spec/ruby/language/variables_spec.rb24
-rw-r--r--spec/ruby/language/yield_spec.rb36
-rw-r--r--spec/ruby/library/abbrev/abbrev_spec.rb4
-rw-r--r--spec/ruby/library/bigdecimal/BigDecimal_spec.rb18
-rw-r--r--spec/ruby/library/bigdecimal/add_spec.rb14
-rw-r--r--spec/ruby/library/bigdecimal/ceil_spec.rb6
-rw-r--r--spec/ruby/library/bigdecimal/div_spec.rb28
-rw-r--r--spec/ruby/library/bigdecimal/divide_spec.rb10
-rw-r--r--spec/ruby/library/bigdecimal/divmod_spec.rb10
-rw-r--r--spec/ruby/library/bigdecimal/fix_spec.rb2
-rw-r--r--spec/ruby/library/bigdecimal/floor_spec.rb6
-rw-r--r--spec/ruby/library/bigdecimal/gt_spec.rb12
-rw-r--r--spec/ruby/library/bigdecimal/gte_spec.rb12
-rw-r--r--spec/ruby/library/bigdecimal/lt_spec.rb12
-rw-r--r--spec/ruby/library/bigdecimal/lte_spec.rb12
-rw-r--r--spec/ruby/library/bigdecimal/mode_spec.rb10
-rw-r--r--spec/ruby/library/bigdecimal/multiply_spec.rb7
-rw-r--r--spec/ruby/library/bigdecimal/remainder_spec.rb2
-rw-r--r--spec/ruby/library/bigdecimal/round_spec.rb14
-rw-r--r--spec/ruby/library/bigdecimal/shared/modulo.rb8
-rw-r--r--spec/ruby/library/bigdecimal/shared/to_int.rb4
-rw-r--r--spec/ruby/library/bigdecimal/sqrt_spec.rb18
-rw-r--r--spec/ruby/library/bigdecimal/sub_spec.rb7
-rw-r--r--spec/ruby/library/bigdecimal/to_s_spec.rb2
-rw-r--r--spec/ruby/library/bigdecimal/truncate_spec.rb6
-rw-r--r--spec/ruby/library/cgi/cookie/initialize_spec.rb4
-rw-r--r--spec/ruby/library/cgi/out_spec.rb2
-rw-r--r--spec/ruby/library/complex/math/shared/acos.rb6
-rw-r--r--spec/ruby/library/complex/math/shared/acosh.rb8
-rw-r--r--spec/ruby/library/complex/math/shared/asin.rb6
-rw-r--r--spec/ruby/library/complex/math/shared/asinh.rb2
-rw-r--r--spec/ruby/library/complex/math/shared/atan.rb2
-rw-r--r--spec/ruby/library/complex/math/shared/atan2.rb6
-rw-r--r--spec/ruby/library/complex/math/shared/atanh.rb2
-rw-r--r--spec/ruby/library/complex/math/shared/cos.rb2
-rw-r--r--spec/ruby/library/complex/math/shared/cosh.rb2
-rw-r--r--spec/ruby/library/complex/math/shared/exp.rb2
-rw-r--r--spec/ruby/library/complex/math/shared/log.rb4
-rw-r--r--spec/ruby/library/complex/math/shared/log10.rb4
-rw-r--r--spec/ruby/library/complex/math/shared/sin.rb2
-rw-r--r--spec/ruby/library/complex/math/shared/sinh.rb2
-rw-r--r--spec/ruby/library/complex/math/shared/sqrt.rb6
-rw-r--r--spec/ruby/library/complex/math/shared/tan.rb2
-rw-r--r--spec/ruby/library/complex/math/shared/tanh.rb2
-rw-r--r--spec/ruby/library/date/add_month_spec.rb8
-rw-r--r--spec/ruby/library/date/add_spec.rb8
-rw-r--r--spec/ruby/library/date/constants_spec.rb4
-rw-r--r--spec/ruby/library/date/iso8601_spec.rb4
-rw-r--r--spec/ruby/library/date/minus_month_spec.rb8
-rw-r--r--spec/ruby/library/date/minus_spec.rb6
-rw-r--r--spec/ruby/library/date/parse_spec.rb6
-rw-r--r--spec/ruby/library/date/plus_spec.rb2
-rw-r--r--spec/ruby/library/date/shared/civil.rb16
-rw-r--r--spec/ruby/library/date/shared/commercial.rb18
-rw-r--r--spec/ruby/library/date/strftime_spec.rb2
-rw-r--r--spec/ruby/library/datetime/hour_spec.rb12
-rw-r--r--spec/ruby/library/datetime/new_spec.rb2
-rw-r--r--spec/ruby/library/datetime/parse_spec.rb12
-rw-r--r--spec/ruby/library/datetime/shared/min.rb12
-rw-r--r--spec/ruby/library/datetime/shared/sec.rb8
-rw-r--r--spec/ruby/library/datetime/strftime_spec.rb8
-rw-r--r--spec/ruby/library/delegate/delegate_class/instance_method_spec.rb4
-rw-r--r--spec/ruby/library/delegate/delegator/frozen_spec.rb4
-rw-r--r--spec/ruby/library/delegate/delegator/method_spec.rb8
-rw-r--r--spec/ruby/library/delegate/delegator/send_spec.rb8
-rw-r--r--spec/ruby/library/delegate/delegator/untaint_spec.rb2
-rw-r--r--spec/ruby/library/digest/bubblebabble_spec.rb4
-rw-r--r--spec/ruby/library/digest/hexencode_spec.rb4
-rw-r--r--spec/ruby/library/digest/md5/file_spec.rb4
-rw-r--r--spec/ruby/library/digest/sha1/file_spec.rb4
-rw-r--r--spec/ruby/library/digest/sha256/file_spec.rb4
-rw-r--r--spec/ruby/library/digest/sha384/file_spec.rb4
-rw-r--r--spec/ruby/library/digest/sha512/file_spec.rb4
-rw-r--r--spec/ruby/library/erb/filename_spec.rb4
-rw-r--r--spec/ruby/library/erb/new_spec.rb6
-rw-r--r--spec/ruby/library/erb/result_spec.rb4
-rw-r--r--spec/ruby/library/erb/run_spec.rb4
-rw-r--r--spec/ruby/library/etc/getgrgid_spec.rb6
-rw-r--r--spec/ruby/library/etc/getgrnam_spec.rb2
-rw-r--r--spec/ruby/library/etc/getpwnam_spec.rb2
-rw-r--r--spec/ruby/library/etc/getpwuid_spec.rb2
-rw-r--r--spec/ruby/library/expect/expect_spec.rb2
-rw-r--r--spec/ruby/library/fiber/alive_spec.rb6
-rw-r--r--spec/ruby/library/fiber/resume_spec.rb2
-rw-r--r--spec/ruby/library/fiber/transfer_spec.rb2
-rw-r--r--spec/ruby/library/getoptlong/ordering_spec.rb4
-rw-r--r--spec/ruby/library/getoptlong/set_options_spec.rb14
-rw-r--r--spec/ruby/library/getoptlong/shared/get.rb2
-rw-r--r--spec/ruby/library/ipaddr/new_spec.rb8
-rw-r--r--spec/ruby/library/ipaddr/reverse_spec.rb4
-rw-r--r--spec/ruby/library/logger/device/close_spec.rb4
-rw-r--r--spec/ruby/library/logger/device/new_spec.rb2
-rw-r--r--spec/ruby/library/logger/device/write_spec.rb4
-rw-r--r--spec/ruby/library/logger/logger/add_spec.rb6
-rw-r--r--spec/ruby/library/logger/logger/close_spec.rb2
-rw-r--r--spec/ruby/library/logger/logger/datetime_format_spec.rb2
-rw-r--r--spec/ruby/library/logger/logger/new_spec.rb10
-rw-r--r--spec/ruby/library/logger/logger/unknown_spec.rb2
-rw-r--r--spec/ruby/library/mathn/integer/prime_division_spec.rb2
-rw-r--r--spec/ruby/library/mathn/math/shared/rsqrt.rb6
-rw-r--r--spec/ruby/library/matrix/antisymmetric_spec.rb2
-rw-r--r--spec/ruby/library/matrix/build_spec.rb10
-rw-r--r--spec/ruby/library/matrix/column_spec.rb4
-rw-r--r--spec/ruby/library/matrix/constructor_spec.rb12
-rw-r--r--spec/ruby/library/matrix/diagonal_spec.rb2
-rw-r--r--spec/ruby/library/matrix/divide_spec.rb10
-rw-r--r--spec/ruby/library/matrix/each_spec.rb6
-rw-r--r--spec/ruby/library/matrix/each_with_index_spec.rb6
-rw-r--r--spec/ruby/library/matrix/eigenvalue_decomposition/initialize_spec.rb6
-rw-r--r--spec/ruby/library/matrix/empty_spec.rb10
-rw-r--r--spec/ruby/library/matrix/exponent_spec.rb8
-rw-r--r--spec/ruby/library/matrix/find_index_spec.rb8
-rw-r--r--spec/ruby/library/matrix/hermitian_spec.rb2
-rw-r--r--spec/ruby/library/matrix/lup_decomposition/determinant_spec.rb2
-rw-r--r--spec/ruby/library/matrix/lup_decomposition/initialize_spec.rb4
-rw-r--r--spec/ruby/library/matrix/lup_decomposition/solve_spec.rb6
-rw-r--r--spec/ruby/library/matrix/minus_spec.rb16
-rw-r--r--spec/ruby/library/matrix/multiply_spec.rb10
-rw-r--r--spec/ruby/library/matrix/normal_spec.rb2
-rw-r--r--spec/ruby/library/matrix/orthogonal_spec.rb2
-rw-r--r--spec/ruby/library/matrix/permutation_spec.rb2
-rw-r--r--spec/ruby/library/matrix/plus_spec.rb16
-rw-r--r--spec/ruby/library/matrix/regular_spec.rb4
-rw-r--r--spec/ruby/library/matrix/row_spec.rb4
-rw-r--r--spec/ruby/library/matrix/shared/determinant.rb4
-rw-r--r--spec/ruby/library/matrix/shared/inverse.rb2
-rw-r--r--spec/ruby/library/matrix/shared/trace.rb2
-rw-r--r--spec/ruby/library/matrix/singular_spec.rb4
-rw-r--r--spec/ruby/library/matrix/symmetric_spec.rb2
-rw-r--r--spec/ruby/library/matrix/unitary_spec.rb2
-rw-r--r--spec/ruby/library/matrix/vector/cross_product_spec.rb2
-rw-r--r--spec/ruby/library/matrix/vector/each2_spec.rb8
-rw-r--r--spec/ruby/library/matrix/vector/inner_product_spec.rb2
-rw-r--r--spec/ruby/library/matrix/vector/normalize_spec.rb4
-rw-r--r--spec/ruby/library/net/ftp/abort_spec.rb14
-rw-r--r--spec/ruby/library/net/ftp/acct_spec.rb12
-rw-r--r--spec/ruby/library/net/ftp/chdir_spec.rb24
-rw-r--r--spec/ruby/library/net/ftp/connect_spec.rb10
-rw-r--r--spec/ruby/library/net/ftp/delete_spec.rb14
-rw-r--r--spec/ruby/library/net/ftp/fixtures/server.rb2
-rw-r--r--spec/ruby/library/net/ftp/help_spec.rb12
-rw-r--r--spec/ruby/library/net/ftp/login_spec.rb42
-rw-r--r--spec/ruby/library/net/ftp/mdtm_spec.rb4
-rw-r--r--spec/ruby/library/net/ftp/mkdir_spec.rb12
-rw-r--r--spec/ruby/library/net/ftp/mtime_spec.rb4
-rw-r--r--spec/ruby/library/net/ftp/nlst_spec.rb20
-rw-r--r--spec/ruby/library/net/ftp/noop_spec.rb4
-rw-r--r--spec/ruby/library/net/ftp/pwd_spec.rb10
-rw-r--r--spec/ruby/library/net/ftp/rename_spec.rb24
-rw-r--r--spec/ruby/library/net/ftp/return_code_spec.rb4
-rw-r--r--spec/ruby/library/net/ftp/rmdir_spec.rb12
-rw-r--r--spec/ruby/library/net/ftp/sendcmd_spec.rb12
-rw-r--r--spec/ruby/library/net/ftp/shared/getbinaryfile.rb32
-rw-r--r--spec/ruby/library/net/ftp/shared/gettextfile.rb20
-rw-r--r--spec/ruby/library/net/ftp/shared/list.rb20
-rw-r--r--spec/ruby/library/net/ftp/shared/putbinaryfile.rb36
-rw-r--r--spec/ruby/library/net/ftp/shared/puttextfile.rb24
-rw-r--r--spec/ruby/library/net/ftp/site_spec.rb10
-rw-r--r--spec/ruby/library/net/ftp/size_spec.rb8
-rw-r--r--spec/ruby/library/net/ftp/status_spec.rb14
-rw-r--r--spec/ruby/library/net/ftp/system_spec.rb8
-rw-r--r--spec/ruby/library/net/ftp/voidcmd_spec.rb12
-rw-r--r--spec/ruby/library/net/http/HTTPServerException_spec.rb4
-rw-r--r--spec/ruby/library/net/http/http/finish_spec.rb2
-rw-r--r--spec/ruby/library/net/http/http/get_print_spec.rb4
-rw-r--r--spec/ruby/library/net/http/http/set_debug_output_spec.rb2
-rw-r--r--spec/ruby/library/net/http/http/start_spec.rb2
-rw-r--r--spec/ruby/library/net/http/httpgenericrequest/body_exist_spec.rb2
-rw-r--r--spec/ruby/library/net/http/httpgenericrequest/exec_spec.rb2
-rw-r--r--spec/ruby/library/net/http/httpgenericrequest/set_body_internal_spec.rb4
-rw-r--r--spec/ruby/library/net/http/httpheader/content_length_spec.rb2
-rw-r--r--spec/ruby/library/net/http/httpheader/content_range_spec.rb6
-rw-r--r--spec/ruby/library/net/http/httpheader/fetch_spec.rb2
-rw-r--r--spec/ruby/library/net/http/httpheader/initialize_http_header_spec.rb2
-rw-r--r--spec/ruby/library/net/http/httpheader/range_length_spec.rb6
-rw-r--r--spec/ruby/library/net/http/httpheader/range_spec.rb8
-rw-r--r--spec/ruby/library/net/http/httpheader/shared/set_range.rb12
-rw-r--r--spec/ruby/library/net/http/httpresponse/error_spec.rb14
-rw-r--r--spec/ruby/library/net/http/httpresponse/read_body_spec.rb6
-rw-r--r--spec/ruby/library/net/http/httpresponse/value_spec.rb14
-rw-r--r--spec/ruby/library/observer/notify_observers_spec.rb2
-rw-r--r--spec/ruby/library/openssl/config/freeze_spec.rb4
-rw-r--r--spec/ruby/library/openssl/random/shared/random_bytes.rb2
-rw-r--r--spec/ruby/library/openssl/x509/name/parse_spec.rb4
-rw-r--r--spec/ruby/library/openstruct/frozen_spec.rb8
-rw-r--r--spec/ruby/library/openstruct/method_missing_spec.rb8
-rw-r--r--spec/ruby/library/pathname/new_spec.rb10
-rw-r--r--spec/ruby/library/pathname/relative_path_from_spec.rb4
-rw-r--r--spec/ruby/library/pp/pp_spec.rb4
-rw-r--r--spec/ruby/library/prime/instance_spec.rb4
-rw-r--r--spec/ruby/library/prime/integer/prime_division_spec.rb2
-rw-r--r--spec/ruby/library/prime/prime_division_spec.rb2
-rw-r--r--spec/ruby/library/readline/completion_proc_spec.rb2
-rw-r--r--spec/ruby/library/readline/history/append_spec.rb2
-rw-r--r--spec/ruby/library/readline/history/delete_at_spec.rb4
-rw-r--r--spec/ruby/library/readline/history/element_reference_spec.rb12
-rw-r--r--spec/ruby/library/readline/history/element_set_spec.rb4
-rw-r--r--spec/ruby/library/readline/history/push_spec.rb2
-rw-r--r--spec/ruby/library/resolv/get_address_spec.rb2
-rw-r--r--spec/ruby/library/resolv/get_name_spec.rb2
-rw-r--r--spec/ruby/library/rexml/attribute/remove_spec.rb2
-rw-r--r--spec/ruby/library/rexml/attribute/xpath_spec.rb2
-rw-r--r--spec/ruby/library/rexml/document/add_spec.rb2
-rw-r--r--spec/ruby/library/rexml/document/new_spec.rb2
-rw-r--r--spec/ruby/library/rexml/text/new_spec.rb4
-rw-r--r--spec/ruby/library/rexml/text/read_with_substitution_spec.rb2
-rw-r--r--spec/ruby/library/securerandom/base64_spec.rb2
-rw-r--r--spec/ruby/library/securerandom/hex_spec.rb2
-rw-r--r--spec/ruby/library/securerandom/random_bytes_spec.rb2
-rw-r--r--spec/ruby/library/securerandom/random_number_spec.rb2
-rw-r--r--spec/ruby/library/set/compare_by_identity_spec.rb2
-rw-r--r--spec/ruby/library/set/exclusion_spec.rb4
-rw-r--r--spec/ruby/library/set/flatten_merge_spec.rb2
-rw-r--r--spec/ruby/library/set/flatten_spec.rb4
-rw-r--r--spec/ruby/library/set/merge_spec.rb4
-rw-r--r--spec/ruby/library/set/proper_subset_spec.rb8
-rw-r--r--spec/ruby/library/set/proper_superset_spec.rb8
-rw-r--r--spec/ruby/library/set/shared/difference.rb4
-rw-r--r--spec/ruby/library/set/shared/intersection.rb4
-rw-r--r--spec/ruby/library/set/shared/union.rb4
-rw-r--r--spec/ruby/library/set/sortedset/add_spec.rb4
-rw-r--r--spec/ruby/library/set/sortedset/exclusion_spec.rb4
-rw-r--r--spec/ruby/library/set/sortedset/initialize_spec.rb2
-rw-r--r--spec/ruby/library/set/sortedset/merge_spec.rb4
-rw-r--r--spec/ruby/library/set/sortedset/proper_subset_spec.rb8
-rw-r--r--spec/ruby/library/set/sortedset/proper_superset_spec.rb8
-rw-r--r--spec/ruby/library/set/sortedset/shared/difference.rb4
-rw-r--r--spec/ruby/library/set/sortedset/shared/intersection.rb4
-rw-r--r--spec/ruby/library/set/sortedset/shared/union.rb4
-rw-r--r--spec/ruby/library/set/sortedset/subset_spec.rb8
-rw-r--r--spec/ruby/library/set/sortedset/superset_spec.rb8
-rw-r--r--spec/ruby/library/set/subset_spec.rb8
-rw-r--r--spec/ruby/library/set/superset_spec.rb8
-rw-r--r--spec/ruby/library/shellwords/shellwords_spec.rb4
-rw-r--r--spec/ruby/library/singleton/allocate_spec.rb2
-rw-r--r--spec/ruby/library/singleton/clone_spec.rb2
-rw-r--r--spec/ruby/library/singleton/dup_spec.rb2
-rw-r--r--spec/ruby/library/singleton/new_spec.rb2
-rw-r--r--spec/ruby/library/socket/addrinfo/family_addrinfo_spec.rb14
-rw-r--r--spec/ruby/library/socket/addrinfo/initialize_spec.rb16
-rw-r--r--spec/ruby/library/socket/addrinfo/ip_address_spec.rb2
-rw-r--r--spec/ruby/library/socket/addrinfo/ip_port_spec.rb2
-rw-r--r--spec/ruby/library/socket/addrinfo/ip_unpack_spec.rb2
-rw-r--r--spec/ruby/library/socket/addrinfo/unix_path_spec.rb4
-rw-r--r--spec/ruby/library/socket/ancillarydata/cmsg_is_spec.rb2
-rw-r--r--spec/ruby/library/socket/ancillarydata/initialize_spec.rb34
-rw-r--r--spec/ruby/library/socket/ancillarydata/int_spec.rb2
-rw-r--r--spec/ruby/library/socket/ancillarydata/ip_pktinfo_spec.rb4
-rw-r--r--spec/ruby/library/socket/ancillarydata/ipv6_pktinfo_spec.rb2
-rw-r--r--spec/ruby/library/socket/ancillarydata/unix_rights_spec.rb6
-rw-r--r--spec/ruby/library/socket/basicsocket/close_read_spec.rb6
-rw-r--r--spec/ruby/library/socket/basicsocket/close_write_spec.rb6
-rw-r--r--spec/ruby/library/socket/basicsocket/connect_address_spec.rb4
-rw-r--r--spec/ruby/library/socket/basicsocket/getpeereid_spec.rb2
-rw-r--r--spec/ruby/library/socket/basicsocket/getpeername_spec.rb2
-rw-r--r--spec/ruby/library/socket/basicsocket/getsockopt_spec.rb4
-rw-r--r--spec/ruby/library/socket/basicsocket/recv_nonblock_spec.rb6
-rw-r--r--spec/ruby/library/socket/basicsocket/recv_spec.rb6
-rw-r--r--spec/ruby/library/socket/basicsocket/recvmsg_nonblock_spec.rb10
-rw-r--r--spec/ruby/library/socket/basicsocket/recvmsg_spec.rb10
-rw-r--r--spec/ruby/library/socket/basicsocket/send_spec.rb6
-rw-r--r--spec/ruby/library/socket/basicsocket/sendmsg_nonblock_spec.rb6
-rw-r--r--spec/ruby/library/socket/basicsocket/sendmsg_spec.rb6
-rw-r--r--spec/ruby/library/socket/basicsocket/setsockopt_spec.rb30
-rw-r--r--spec/ruby/library/socket/basicsocket/shutdown_spec.rb24
-rw-r--r--spec/ruby/library/socket/ipsocket/addr_spec.rb2
-rw-r--r--spec/ruby/library/socket/ipsocket/getaddress_spec.rb2
-rw-r--r--spec/ruby/library/socket/ipsocket/peeraddr_spec.rb4
-rw-r--r--spec/ruby/library/socket/option/bool_spec.rb2
-rw-r--r--spec/ruby/library/socket/option/initialize_spec.rb12
-rw-r--r--spec/ruby/library/socket/option/int_spec.rb2
-rw-r--r--spec/ruby/library/socket/option/linger_spec.rb8
-rw-r--r--spec/ruby/library/socket/option/new_spec.rb6
-rw-r--r--spec/ruby/library/socket/shared/pack_sockaddr.rb2
-rw-r--r--spec/ruby/library/socket/shared/socketpair.rb14
-rw-r--r--spec/ruby/library/socket/socket/accept_loop_spec.rb4
-rw-r--r--spec/ruby/library/socket/socket/accept_nonblock_spec.rb10
-rw-r--r--spec/ruby/library/socket/socket/accept_spec.rb7
-rw-r--r--spec/ruby/library/socket/socket/bind_spec.rb22
-rw-r--r--spec/ruby/library/socket/socket/connect_nonblock_spec.rb10
-rw-r--r--spec/ruby/library/socket/socket/connect_spec.rb2
-rw-r--r--spec/ruby/library/socket/socket/gethostbyaddr_spec.rb4
-rw-r--r--spec/ruby/library/socket/socket/getnameinfo_spec.rb4
-rw-r--r--spec/ruby/library/socket/socket/getservbyname_spec.rb2
-rw-r--r--spec/ruby/library/socket/socket/getservbyport_spec.rb2
-rw-r--r--spec/ruby/library/socket/socket/initialize_spec.rb4
-rw-r--r--spec/ruby/library/socket/socket/listen_spec.rb4
-rw-r--r--spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb4
-rw-r--r--spec/ruby/library/socket/socket/recvfrom_spec.rb4
-rw-r--r--spec/ruby/library/socket/socket/sysaccept_spec.rb6
-rw-r--r--spec/ruby/library/socket/socket/tcp_server_loop_spec.rb4
-rw-r--r--spec/ruby/library/socket/socket/tcp_spec.rb2
-rw-r--r--spec/ruby/library/socket/socket/udp_server_loop_on_spec.rb2
-rw-r--r--spec/ruby/library/socket/socket/udp_server_loop_spec.rb2
-rw-r--r--spec/ruby/library/socket/socket/unix_server_loop_spec.rb4
-rw-r--r--spec/ruby/library/socket/socket/unpack_sockaddr_in_spec.rb4
-rw-r--r--spec/ruby/library/socket/socket/unpack_sockaddr_un_spec.rb4
-rw-r--r--spec/ruby/library/socket/tcpserver/accept_nonblock_spec.rb8
-rw-r--r--spec/ruby/library/socket/tcpserver/accept_spec.rb4
-rw-r--r--spec/ruby/library/socket/tcpserver/gets_spec.rb2
-rw-r--r--spec/ruby/library/socket/tcpserver/initialize_spec.rb2
-rw-r--r--spec/ruby/library/socket/tcpserver/listen_spec.rb2
-rw-r--r--spec/ruby/library/socket/tcpserver/new_spec.rb8
-rw-r--r--spec/ruby/library/socket/tcpserver/sysaccept_spec.rb4
-rw-r--r--spec/ruby/library/socket/tcpsocket/initialize_spec.rb4
-rw-r--r--spec/ruby/library/socket/tcpsocket/shared/new.rb4
-rw-r--r--spec/ruby/library/socket/udpsocket/bind_spec.rb2
-rw-r--r--spec/ruby/library/socket/udpsocket/new_spec.rb2
-rw-r--r--spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb4
-rw-r--r--spec/ruby/library/socket/udpsocket/send_spec.rb8
-rw-r--r--spec/ruby/library/socket/udpsocket/write_spec.rb2
-rw-r--r--spec/ruby/library/socket/unixserver/accept_nonblock_spec.rb2
-rw-r--r--spec/ruby/library/socket/unixserver/accept_spec.rb2
-rw-r--r--spec/ruby/library/socket/unixserver/initialize_spec.rb2
-rw-r--r--spec/ruby/library/socket/unixserver/sysaccept_spec.rb2
-rw-r--r--spec/ruby/library/socket/unixsocket/initialize_spec.rb2
-rw-r--r--spec/ruby/library/socket/unixsocket/peeraddr_spec.rb2
-rw-r--r--spec/ruby/library/stringio/append_spec.rb4
-rw-r--r--spec/ruby/library/stringio/close_read_spec.rb4
-rw-r--r--spec/ruby/library/stringio/close_spec.rb6
-rw-r--r--spec/ruby/library/stringio/close_write_spec.rb4
-rw-r--r--spec/ruby/library/stringio/fcntl_spec.rb2
-rw-r--r--spec/ruby/library/stringio/gets_spec.rb4
-rw-r--r--spec/ruby/library/stringio/initialize_spec.rb8
-rw-r--r--spec/ruby/library/stringio/open_spec.rb8
-rw-r--r--spec/ruby/library/stringio/path_spec.rb2
-rw-r--r--spec/ruby/library/stringio/pos_spec.rb2
-rw-r--r--spec/ruby/library/stringio/print_spec.rb4
-rw-r--r--spec/ruby/library/stringio/printf_spec.rb6
-rw-r--r--spec/ruby/library/stringio/putc_spec.rb6
-rw-r--r--spec/ruby/library/stringio/puts_spec.rb4
-rw-r--r--spec/ruby/library/stringio/readline_spec.rb6
-rw-r--r--spec/ruby/library/stringio/readlines_spec.rb4
-rw-r--r--spec/ruby/library/stringio/readpartial_spec.rb10
-rw-r--r--spec/ruby/library/stringio/reopen_spec.rb22
-rw-r--r--spec/ruby/library/stringio/seek_spec.rb14
-rw-r--r--spec/ruby/library/stringio/shared/codepoints.rb6
-rw-r--r--spec/ruby/library/stringio/shared/each.rb4
-rw-r--r--spec/ruby/library/stringio/shared/each_byte.rb4
-rw-r--r--spec/ruby/library/stringio/shared/each_char.rb4
-rw-r--r--spec/ruby/library/stringio/shared/getc.rb4
-rw-r--r--spec/ruby/library/stringio/shared/read.rb12
-rw-r--r--spec/ruby/library/stringio/shared/readchar.rb6
-rw-r--r--spec/ruby/library/stringio/shared/sysread.rb2
-rw-r--r--spec/ruby/library/stringio/shared/write.rb4
-rw-r--r--spec/ruby/library/stringio/string_spec.rb2
-rw-r--r--spec/ruby/library/stringio/sysread_spec.rb2
-rw-r--r--spec/ruby/library/stringio/truncate_spec.rb10
-rw-r--r--spec/ruby/library/stringio/ungetc_spec.rb6
-rw-r--r--spec/ruby/library/stringscanner/clear_spec.rb4
-rw-r--r--spec/ruby/library/stringscanner/element_reference_spec.rb8
-rw-r--r--spec/ruby/library/stringscanner/empty_spec.rb4
-rw-r--r--spec/ruby/library/stringscanner/getbyte_spec.rb4
-rw-r--r--spec/ruby/library/stringscanner/peep_spec.rb4
-rw-r--r--spec/ruby/library/stringscanner/restsize_spec.rb4
-rw-r--r--spec/ruby/library/stringscanner/scan_spec.rb8
-rw-r--r--spec/ruby/library/stringscanner/shared/concat.rb12
-rw-r--r--spec/ruby/library/stringscanner/shared/peek.rb4
-rw-r--r--spec/ruby/library/stringscanner/shared/pos.rb4
-rw-r--r--spec/ruby/library/stringscanner/unscan_spec.rb4
-rw-r--r--spec/ruby/library/syslog/close_spec.rb4
-rw-r--r--spec/ruby/library/syslog/log_spec.rb10
-rw-r--r--spec/ruby/library/syslog/mask_spec.rb6
-rw-r--r--spec/ruby/library/syslog/open_spec.rb4
-rw-r--r--spec/ruby/library/syslog/shared/log.rb6
-rw-r--r--spec/ruby/library/syslog/shared/reopen.rb4
-rw-r--r--spec/ruby/library/tempfile/initialize_spec.rb5
-rw-r--r--spec/ruby/library/time/shared/rfc2822.rb2
-rw-r--r--spec/ruby/library/timeout/timeout_spec.rb4
-rw-r--r--spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb6
-rw-r--r--spec/ruby/library/uri/join_spec.rb2
-rw-r--r--spec/ruby/library/uri/mailto/build_spec.rb2
-rw-r--r--spec/ruby/library/uri/plus_spec.rb2
-rw-r--r--spec/ruby/library/uri/select_spec.rb6
-rw-r--r--spec/ruby/library/uri/set_component_spec.rb20
-rw-r--r--spec/ruby/library/uri/shared/join.rb2
-rw-r--r--spec/ruby/library/uri/shared/parse.rb4
-rw-r--r--spec/ruby/library/uri/uri_spec.rb2
-rw-r--r--spec/ruby/library/weakref/__getobj___spec.rb2
-rw-r--r--spec/ruby/library/weakref/allocate_spec.rb2
-rw-r--r--spec/ruby/library/weakref/send_spec.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole/_invoke_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole/connect_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole/locale_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole/new_spec.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole/ole_func_methods_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole/ole_methods_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole/ole_obj_help_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole/ole_put_methods_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole/shared/ole_method.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole/shared/setproperty.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_event/new_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/dispid_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/event_interface_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/event_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/helpcontext_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/helpfile_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/helpstring_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/invkind_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/invoke_kind_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/new_spec.rb10
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/params_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/return_type_detail_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/return_type_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/return_vtype_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/shared/name.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/size_opt_params_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/size_params_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/visible_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/default_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/input_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/ole_type_detail_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/optional_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/retval_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/shared/name.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/new_spec.rb12
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/progids_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/shared/name.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb2
-rw-r--r--spec/ruby/library/yaml/load_spec.rb4
-rw-r--r--spec/ruby/library/zlib/adler32_spec.rb2
-rw-r--r--spec/ruby/library/zlib/crc32_spec.rb2
-rw-r--r--spec/ruby/library/zlib/gzipfile/close_spec.rb4
-rw-r--r--spec/ruby/library/zlib/gzipfile/comment_spec.rb2
-rw-r--r--spec/ruby/library/zlib/gzipfile/orig_name_spec.rb2
-rw-r--r--spec/ruby/library/zlib/gzipreader/read_spec.rb2
-rw-r--r--spec/ruby/library/zlib/gzipwriter/mtime_spec.rb2
-rw-r--r--spec/ruby/library/zlib/inflate/append_spec.rb2
-rw-r--r--spec/ruby/library/zlib/inflate/inflate_spec.rb2
-rw-r--r--spec/ruby/optional/capi/array_spec.rb10
-rw-r--r--spec/ruby/optional/capi/bignum_spec.rb16
-rw-r--r--spec/ruby/optional/capi/class_spec.rb36
-rw-r--r--spec/ruby/optional/capi/data_spec.rb2
-rw-r--r--spec/ruby/optional/capi/encoding_spec.rb12
-rw-r--r--spec/ruby/optional/capi/exception_spec.rb6
-rw-r--r--spec/ruby/optional/capi/file_spec.rb2
-rw-r--r--spec/ruby/optional/capi/fixnum_spec.rb20
-rw-r--r--spec/ruby/optional/capi/globals_spec.rb2
-rw-r--r--spec/ruby/optional/capi/hash_spec.rb12
-rw-r--r--spec/ruby/optional/capi/io_spec.rb24
-rw-r--r--spec/ruby/optional/capi/kernel_spec.rb102
-rw-r--r--spec/ruby/optional/capi/module_spec.rb10
-rw-r--r--spec/ruby/optional/capi/mutex_spec.rb8
-rw-r--r--spec/ruby/optional/capi/numeric_spec.rb44
-rw-r--r--spec/ruby/optional/capi/object_spec.rb34
-rw-r--r--spec/ruby/optional/capi/proc_spec.rb4
-rw-r--r--spec/ruby/optional/capi/range_spec.rb6
-rw-r--r--spec/ruby/optional/capi/string_spec.rb22
-rw-r--r--spec/ruby/optional/capi/struct_spec.rb20
-rw-r--r--spec/ruby/optional/capi/thread_spec.rb18
-rw-r--r--spec/ruby/optional/capi/time_spec.rb18
-rw-r--r--spec/ruby/optional/capi/typed_data_spec.rb2
-rw-r--r--spec/ruby/optional/capi/util_spec.rb16
-rw-r--r--spec/ruby/security/cve_2010_1330_spec.rb2
-rw-r--r--spec/ruby/security/cve_2014_8080_spec.rb2
-rw-r--r--spec/ruby/security/cve_2018_8778_spec.rb2
-rw-r--r--spec/ruby/security/cve_2018_8779_spec.rb4
-rw-r--r--spec/ruby/security/cve_2018_8780_spec.rb12
-rw-r--r--spec/ruby/shared/basicobject/method_missing.rb18
-rw-r--r--spec/ruby/shared/basicobject/send.rb10
-rw-r--r--spec/ruby/shared/fiber/resume.rb8
-rw-r--r--spec/ruby/shared/file/directory.rb6
-rw-r--r--spec/ruby/shared/file/executable.rb8
-rw-r--r--spec/ruby/shared/file/executable_real.rb8
-rw-r--r--spec/ruby/shared/file/exist.rb6
-rw-r--r--spec/ruby/shared/file/file.rb8
-rw-r--r--spec/ruby/shared/file/identical.rb6
-rw-r--r--spec/ruby/shared/file/size.rb2
-rw-r--r--spec/ruby/shared/file/writable_real.rb8
-rw-r--r--spec/ruby/shared/file/zero.rb8
-rw-r--r--spec/ruby/shared/io/putc.rb8
-rw-r--r--spec/ruby/shared/kernel/raise.rb20
-rw-r--r--spec/ruby/shared/math/atanh.rb8
-rw-r--r--spec/ruby/shared/process/abort.rb12
-rw-r--r--spec/ruby/shared/process/exit.rb20
-rw-r--r--spec/ruby/shared/process/fork.rb2
-rw-r--r--spec/ruby/shared/queue/deque.rb4
-rw-r--r--spec/ruby/shared/queue/enque.rb2
-rw-r--r--spec/ruby/shared/rational/Rational.rb10
-rw-r--r--spec/ruby/shared/rational/coerce.rb8
-rw-r--r--spec/ruby/shared/rational/div.rb12
-rw-r--r--spec/ruby/shared/rational/divide.rb4
-rw-r--r--spec/ruby/shared/rational/divmod.rb6
-rw-r--r--spec/ruby/shared/rational/exponent.rb8
-rw-r--r--spec/ruby/shared/rational/modulo.rb8
-rw-r--r--spec/ruby/shared/rational/round.rb2
-rw-r--r--spec/ruby/shared/sizedqueue/enque.rb4
-rw-r--r--spec/ruby/shared/sizedqueue/max.rb8
-rw-r--r--spec/ruby/shared/sizedqueue/new.rb10
-rw-r--r--spec/ruby/shared/string/times.rb10
1247 files changed, 5319 insertions, 5031 deletions
diff --git a/spec/ruby/.mspec.constants b/spec/ruby/.mspec.constants
index 68a877711b..00198eb944 100644
--- a/spec/ruby/.mspec.constants
+++ b/spec/ruby/.mspec.constants
@@ -28,7 +28,6 @@ CSAutoloadC
CSAutoloadD
CSV
ChainedNextTest
-Channel
ChildClass
ClassIdUnderAutoload
ClassSpecDefineClass
diff --git a/spec/ruby/.rubocop.yml b/spec/ruby/.rubocop.yml
index 5de7154442..cc31ff50b3 100644
--- a/spec/ruby/.rubocop.yml
+++ b/spec/ruby/.rubocop.yml
@@ -100,3 +100,18 @@ Lint/UriRegexp:
Lint/Debugger:
Exclude:
- 'core/binding/fixtures/irb.rb'
+
+Style/Lambda:
+ Enabled: true
+ EnforcedStyle: literal
+ Exclude:
+ - 'language/lambda_spec.rb'
+ - 'language/proc_spec.rb'
+ - 'core/kernel/lambda_spec.rb'
+
+Style/EmptyLambdaParameter:
+ Enabled: true
+
+Style/StabbyLambdaParentheses:
+ Enabled: true
+ EnforcedStyle: require_no_parentheses
diff --git a/spec/ruby/.rubocop_todo.yml b/spec/ruby/.rubocop_todo.yml
index 25c67ade02..261fde9e47 100644
--- a/spec/ruby/.rubocop_todo.yml
+++ b/spec/ruby/.rubocop_todo.yml
@@ -144,6 +144,9 @@ Lint/UselessAccessModifier:
- 'core/module/fixtures/classes.rb'
- 'core/module/module_function_spec.rb'
- 'core/module/private_class_method_spec.rb'
+ - 'core/module/private_spec.rb'
+ - 'core/module/protected_spec.rb'
+ - 'core/module/public_spec.rb'
- 'language/fixtures/send.rb'
# Offense count: 6186
diff --git a/spec/ruby/core/argf/close_spec.rb b/spec/ruby/core/argf/close_spec.rb
index 56faf30664..d4d6a51e72 100644
--- a/spec/ruby/core/argf/close_spec.rb
+++ b/spec/ruby/core/argf/close_spec.rb
@@ -22,8 +22,8 @@ describe "ARGF.close" do
it "doesn't raise an IOError if called on a closed stream" do
argf [@file1_name] do
- lambda { @argf.close }.should_not raise_error
- lambda { @argf.close }.should_not raise_error
+ -> { @argf.close }.should_not raise_error
+ -> { @argf.close }.should_not raise_error
end
end
end
diff --git a/spec/ruby/core/argf/read_nonblock_spec.rb b/spec/ruby/core/argf/read_nonblock_spec.rb
index 466264119f..804a459a62 100644
--- a/spec/ruby/core/argf/read_nonblock_spec.rb
+++ b/spec/ruby/core/argf/read_nonblock_spec.rb
@@ -64,7 +64,7 @@ platform_is_not :windows do
it 'raises IO::EAGAINWaitReadable when empty' do
argf ['-'] do
- lambda {
+ -> {
@argf.read_nonblock(4)
}.should raise_error(IO::EAGAINWaitReadable)
end
diff --git a/spec/ruby/core/argf/readchar_spec.rb b/spec/ruby/core/argf/readchar_spec.rb
index bd3bfd28ae..4eca2efcf7 100644
--- a/spec/ruby/core/argf/readchar_spec.rb
+++ b/spec/ruby/core/argf/readchar_spec.rb
@@ -13,7 +13,7 @@ describe "ARGF.readchar" do
it "raises EOFError when end of stream reached" do
argf [@file1, @file2] do
- lambda { while @argf.readchar; end }.should raise_error(EOFError)
+ -> { while @argf.readchar; end }.should raise_error(EOFError)
end
end
end
diff --git a/spec/ruby/core/argf/readline_spec.rb b/spec/ruby/core/argf/readline_spec.rb
index e196274068..db53c499e9 100644
--- a/spec/ruby/core/argf/readline_spec.rb
+++ b/spec/ruby/core/argf/readline_spec.rb
@@ -17,7 +17,7 @@ describe "ARGF.readline" do
it "raises an EOFError when reaching end of files" do
argf [@file1, @file2] do
- lambda { while @argf.readline; end }.should raise_error(EOFError)
+ -> { while @argf.readline; end }.should raise_error(EOFError)
end
end
end
diff --git a/spec/ruby/core/argf/readpartial_spec.rb b/spec/ruby/core/argf/readpartial_spec.rb
index 4e697683dc..5e284b3423 100644
--- a/spec/ruby/core/argf/readpartial_spec.rb
+++ b/spec/ruby/core/argf/readpartial_spec.rb
@@ -16,7 +16,7 @@ describe "ARGF.readpartial" do
it "raises an ArgumentError if called without a maximum read length" do
argf [@file1_name] do
- lambda { @argf.readpartial }.should raise_error(ArgumentError)
+ -> { @argf.readpartial }.should raise_error(ArgumentError)
end
end
@@ -59,8 +59,8 @@ describe "ARGF.readpartial" do
@argf.readpartial(@file1.size)
@argf.readpartial(1)
@argf.readpartial(@file2.size)
- lambda { @argf.readpartial(1) }.should raise_error(EOFError)
- lambda { @argf.readpartial(1) }.should raise_error(EOFError)
+ -> { @argf.readpartial(1) }.should raise_error(EOFError)
+ -> { @argf.readpartial(1) }.should raise_error(EOFError)
end
end
diff --git a/spec/ruby/core/argf/rewind_spec.rb b/spec/ruby/core/argf/rewind_spec.rb
index fcb2e81a3e..b29f0b75b7 100644
--- a/spec/ruby/core/argf/rewind_spec.rb
+++ b/spec/ruby/core/argf/rewind_spec.rb
@@ -33,7 +33,7 @@ describe "ARGF.rewind" do
it "raises an ArgumentError when end of stream reached" do
argf [@file1_name, @file2_name] do
@argf.read
- lambda { @argf.rewind }.should raise_error(ArgumentError)
+ -> { @argf.rewind }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/core/argf/seek_spec.rb b/spec/ruby/core/argf/seek_spec.rb
index c983c0cb5a..2b73bd46fb 100644
--- a/spec/ruby/core/argf/seek_spec.rb
+++ b/spec/ruby/core/argf/seek_spec.rb
@@ -57,7 +57,7 @@ describe "ARGF.seek" do
it "takes at least one argument (offset)" do
argf [@file1_name] do
- lambda { @argf.seek }.should raise_error(ArgumentError)
+ -> { @argf.seek }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/core/argf/shared/eof.rb b/spec/ruby/core/argf/shared/eof.rb
index bba18ede50..0e684f943f 100644
--- a/spec/ruby/core/argf/shared/eof.rb
+++ b/spec/ruby/core/argf/shared/eof.rb
@@ -18,7 +18,7 @@ describe :argf_eof, shared: true do
it "raises IOError when called on a closed stream" do
argf [@file1] do
@argf.read
- lambda { @argf.send(@method) }.should raise_error(IOError)
+ -> { @argf.send(@method) }.should raise_error(IOError)
end
end
end
diff --git a/spec/ruby/core/argf/shared/fileno.rb b/spec/ruby/core/argf/shared/fileno.rb
index 891e250ad9..5d674048e2 100644
--- a/spec/ruby/core/argf/shared/fileno.rb
+++ b/spec/ruby/core/argf/shared/fileno.rb
@@ -18,7 +18,7 @@ describe :argf_fileno, shared: true do
it "raises an ArgumentError when called on a closed stream" do
argf [@file1] do
@argf.read
- lambda { @argf.send(@method) }.should raise_error(ArgumentError)
+ -> { @argf.send(@method) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/core/argf/shared/pos.rb b/spec/ruby/core/argf/shared/pos.rb
index f7184f3d7c..9836d5f1e4 100644
--- a/spec/ruby/core/argf/shared/pos.rb
+++ b/spec/ruby/core/argf/shared/pos.rb
@@ -25,7 +25,7 @@ describe :argf_pos, shared: true do
it "raises an ArgumentError when called on a closed stream" do
argf [@file1] do
@argf.read
- lambda { @argf.send(@method) }.should raise_error(ArgumentError)
+ -> { @argf.send(@method) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/core/argf/skip_spec.rb b/spec/ruby/core/argf/skip_spec.rb
index 89b7146e3a..0181801c2d 100644
--- a/spec/ruby/core/argf/skip_spec.rb
+++ b/spec/ruby/core/argf/skip_spec.rb
@@ -37,6 +37,6 @@ describe "ARGF.skip" do
# which as a side-effect calls argf.file which will initialize
# internals of ARGF enough for this to work.
it "has no effect when nothing has been processed yet" do
- lambda { ARGF.class.new(@file1_name).skip }.should_not raise_error
+ -> { ARGF.class.new(@file1_name).skip }.should_not raise_error
end
end
diff --git a/spec/ruby/core/array/allocate_spec.rb b/spec/ruby/core/array/allocate_spec.rb
index a1800e7e16..04f7c0d0ad 100644
--- a/spec/ruby/core/array/allocate_spec.rb
+++ b/spec/ruby/core/array/allocate_spec.rb
@@ -14,6 +14,6 @@ describe "Array.allocate" do
end
it "does not accept any arguments" do
- lambda { Array.allocate(1) }.should raise_error(ArgumentError)
+ -> { Array.allocate(1) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/array/append_spec.rb b/spec/ruby/core/array/append_spec.rb
index 08ea814d89..302dc4a901 100644
--- a/spec/ruby/core/array/append_spec.rb
+++ b/spec/ruby/core/array/append_spec.rb
@@ -31,7 +31,7 @@ describe "Array#<<" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array << 5 }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array << 5 }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/at_spec.rb b/spec/ruby/core/array/at_spec.rb
index d237c9508a..8bc789fef7 100644
--- a/spec/ruby/core/array/at_spec.rb
+++ b/spec/ruby/core/array/at_spec.rb
@@ -47,10 +47,10 @@ describe "Array#at" do
end
it "raises a TypeError when the passed argument can't be coerced to Integer" do
- lambda { [].at("cat") }.should raise_error(TypeError)
+ -> { [].at("cat") }.should raise_error(TypeError)
end
it "raises an ArgumentError when 2 or more arguments are passed" do
- lambda { [:a, :b].at(0,1) }.should raise_error(ArgumentError)
+ -> { [:a, :b].at(0,1) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/array/bsearch_index_spec.rb b/spec/ruby/core/array/bsearch_index_spec.rb
index a075d06ed3..aafded178d 100644
--- a/spec/ruby/core/array/bsearch_index_spec.rb
+++ b/spec/ruby/core/array/bsearch_index_spec.rb
@@ -21,7 +21,7 @@ describe "Array#bsearch_index" do
end
it "raises a TypeError when block returns a String" do
- lambda { [1, 2, 3].bsearch_index { "not ok" } }.should raise_error(TypeError)
+ -> { [1, 2, 3].bsearch_index { "not ok" } }.should raise_error(TypeError)
end
it "returns nil when block is empty" do
diff --git a/spec/ruby/core/array/bsearch_spec.rb b/spec/ruby/core/array/bsearch_spec.rb
index 57b95fb934..8fa6245dbf 100644
--- a/spec/ruby/core/array/bsearch_spec.rb
+++ b/spec/ruby/core/array/bsearch_spec.rb
@@ -9,11 +9,11 @@ describe "Array#bsearch" do
it_behaves_like :enumeratorized_with_unknown_size, :bsearch, [1,2,3]
it "raises a TypeError if the block returns an Object" do
- lambda { [1].bsearch { Object.new } }.should raise_error(TypeError)
+ -> { [1].bsearch { Object.new } }.should raise_error(TypeError)
end
it "raises a TypeError if the block returns a String" do
- lambda { [1].bsearch { "1" } }.should raise_error(TypeError)
+ -> { [1].bsearch { "1" } }.should raise_error(TypeError)
end
context "with a block returning true or false" do
diff --git a/spec/ruby/core/array/clear_spec.rb b/spec/ruby/core/array/clear_spec.rb
index 8cba1f9e27..8f83a012b7 100644
--- a/spec/ruby/core/array/clear_spec.rb
+++ b/spec/ruby/core/array/clear_spec.rb
@@ -29,7 +29,7 @@ describe "Array#clear" do
end
it "does not accept any arguments" do
- lambda { [1].clear(true) }.should raise_error(ArgumentError)
+ -> { [1].clear(true) }.should raise_error(ArgumentError)
end
it "keeps untrusted status" do
@@ -43,6 +43,6 @@ describe "Array#clear" do
it "raises a #{frozen_error_class} on a frozen array" do
a = [1]
a.freeze
- lambda { a.clear }.should raise_error(frozen_error_class)
+ -> { a.clear }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/compact_spec.rb b/spec/ruby/core/array/compact_spec.rb
index 4818217be1..ecccddeb9f 100644
--- a/spec/ruby/core/array/compact_spec.rb
+++ b/spec/ruby/core/array/compact_spec.rb
@@ -72,6 +72,6 @@ describe "Array#compact!" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.compact! }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.compact! }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/concat_spec.rb b/spec/ruby/core/array/concat_spec.rb
index 91adb8b745..cc707d9948 100644
--- a/spec/ruby/core/array/concat_spec.rb
+++ b/spec/ruby/core/array/concat_spec.rb
@@ -33,12 +33,12 @@ describe "Array#concat" do
end
it "raises a #{frozen_error_class} when Array is frozen and modification occurs" do
- lambda { ArraySpecs.frozen_array.concat [1] }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.concat [1] }.should raise_error(frozen_error_class)
end
# see [ruby-core:23666]
it "raises a #{frozen_error_class} when Array is frozen and no modification occurs" do
- lambda { ArraySpecs.frozen_array.concat([]) }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.concat([]) }.should raise_error(frozen_error_class)
end
it "keeps tainted status" do
diff --git a/spec/ruby/core/array/cycle_spec.rb b/spec/ruby/core/array/cycle_spec.rb
index 018005abb4..7219b49883 100644
--- a/spec/ruby/core/array/cycle_spec.rb
+++ b/spec/ruby/core/array/cycle_spec.rb
@@ -6,7 +6,7 @@ describe "Array#cycle" do
ScratchPad.record []
@array = [1, 2, 3]
- @prc = lambda { |x| ScratchPad << x }
+ @prc = -> x { ScratchPad << x }
end
it "does not yield and returns nil when the array is empty and passed value is an integer" do
@@ -46,13 +46,13 @@ describe "Array#cycle" do
end
it "does not rescue StopIteration when not passed a count" do
- lambda do
+ -> do
@array.cycle { raise StopIteration }
end.should raise_error(StopIteration)
end
it "does not rescue StopIteration when passed a count" do
- lambda do
+ -> do
@array.cycle(3) { raise StopIteration }
end.should raise_error(StopIteration)
end
@@ -74,23 +74,23 @@ describe "Array#cycle" do
count = mock("cycle count 2")
count.should_receive(:to_int).and_return("2")
- lambda { @array.cycle(count, &@prc) }.should raise_error(TypeError)
+ -> { @array.cycle(count, &@prc) }.should raise_error(TypeError)
end
it "raises a TypeError if passed a String" do
- lambda { @array.cycle("4") { } }.should raise_error(TypeError)
+ -> { @array.cycle("4") { } }.should raise_error(TypeError)
end
it "raises a TypeError if passed an Object" do
- lambda { @array.cycle(mock("cycle count")) { } }.should raise_error(TypeError)
+ -> { @array.cycle(mock("cycle count")) { } }.should raise_error(TypeError)
end
it "raises a TypeError if passed true" do
- lambda { @array.cycle(true) { } }.should raise_error(TypeError)
+ -> { @array.cycle(true) { } }.should raise_error(TypeError)
end
it "raises a TypeError if passed false" do
- lambda { @array.cycle(false) { } }.should raise_error(TypeError)
+ -> { @array.cycle(false) { } }.should raise_error(TypeError)
end
before :all do
diff --git a/spec/ruby/core/array/delete_at_spec.rb b/spec/ruby/core/array/delete_at_spec.rb
index 021554c76a..c3111fe3d8 100644
--- a/spec/ruby/core/array/delete_at_spec.rb
+++ b/spec/ruby/core/array/delete_at_spec.rb
@@ -36,7 +36,7 @@ describe "Array#delete_at" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { [1,2,3].freeze.delete_at(0) }.should raise_error(frozen_error_class)
+ -> { [1,2,3].freeze.delete_at(0) }.should raise_error(frozen_error_class)
end
it "keeps tainted status" do
diff --git a/spec/ruby/core/array/delete_if_spec.rb b/spec/ruby/core/array/delete_if_spec.rb
index 12a7d1662d..9f22f7e086 100644
--- a/spec/ruby/core/array/delete_if_spec.rb
+++ b/spec/ruby/core/array/delete_if_spec.rb
@@ -40,11 +40,11 @@ describe "Array#delete_if" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.delete_if {} }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.delete_if {} }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} on an empty frozen array" do
- lambda { ArraySpecs.empty_frozen_array.delete_if {} }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.empty_frozen_array.delete_if {} }.should raise_error(frozen_error_class)
end
it "keeps tainted status" do
diff --git a/spec/ruby/core/array/delete_spec.rb b/spec/ruby/core/array/delete_spec.rb
index 62476f489b..c55f4ad672 100644
--- a/spec/ruby/core/array/delete_spec.rb
+++ b/spec/ruby/core/array/delete_spec.rb
@@ -41,7 +41,7 @@ describe "Array#delete" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { [1, 2, 3].freeze.delete(1) }.should raise_error(frozen_error_class)
+ -> { [1, 2, 3].freeze.delete(1) }.should raise_error(frozen_error_class)
end
it "keeps tainted status" do
diff --git a/spec/ruby/core/array/dig_spec.rb b/spec/ruby/core/array/dig_spec.rb
index 1ace4893ee..f2d8ff47fd 100644
--- a/spec/ruby/core/array/dig_spec.rb
+++ b/spec/ruby/core/array/dig_spec.rb
@@ -20,20 +20,20 @@ describe "Array#dig" do
end
it "raises a TypeError for a non-numeric index" do
- lambda {
+ -> {
['a'].dig(:first)
}.should raise_error(TypeError)
end
it "raises a TypeError if any intermediate step does not respond to #dig" do
a = [1, 2]
- lambda {
+ -> {
a.dig(0, 1)
}.should raise_error(TypeError)
end
it "raises an ArgumentError if no arguments provided" do
- lambda {
+ -> {
[10].dig()
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/core/array/drop_spec.rb b/spec/ruby/core/array/drop_spec.rb
index 1bd2e6cc25..89b8534af4 100644
--- a/spec/ruby/core/array/drop_spec.rb
+++ b/spec/ruby/core/array/drop_spec.rb
@@ -6,7 +6,7 @@ describe "Array#drop" do
end
it "raises an ArgumentError if the number of elements specified is negative" do
- lambda { [1, 2].drop(-3) }.should raise_error(ArgumentError)
+ -> { [1, 2].drop(-3) }.should raise_error(ArgumentError)
end
it "returns an empty Array if all elements are dropped" do
diff --git a/spec/ruby/core/array/element_set_spec.rb b/spec/ruby/core/array/element_set_spec.rb
index 9992e4d32b..9375ff9b80 100644
--- a/spec/ruby/core/array/element_set_spec.rb
+++ b/spec/ruby/core/array/element_set_spec.rb
@@ -94,8 +94,8 @@ describe "Array#[]=" do
it "checks frozen before attempting to coerce arguments" do
a = [1,2,3,4].freeze
- lambda {a[:foo] = 1}.should raise_error(frozen_error_class)
- lambda {a[:foo, :bar] = 1}.should raise_error(frozen_error_class)
+ -> {a[:foo] = 1}.should raise_error(frozen_error_class)
+ -> {a[:foo, :bar] = 1}.should raise_error(frozen_error_class)
end
it "sets elements in the range arguments when passed ranges" do
@@ -195,25 +195,25 @@ describe "Array#[]=" do
a[to .. from] = ["x"]
a.should == [1, "a", "b", "x", "c", 4]
- lambda { a["a" .. "b"] = [] }.should raise_error(TypeError)
- lambda { a[from .. "b"] = [] }.should raise_error(TypeError)
+ -> { a["a" .. "b"] = [] }.should raise_error(TypeError)
+ -> { a[from .. "b"] = [] }.should raise_error(TypeError)
end
it "raises an IndexError when passed indexes out of bounds" do
a = [1, 2, 3, 4]
- lambda { a[-5] = "" }.should raise_error(IndexError)
- lambda { a[-5, -1] = "" }.should raise_error(IndexError)
- lambda { a[-5, 0] = "" }.should raise_error(IndexError)
- lambda { a[-5, 1] = "" }.should raise_error(IndexError)
- lambda { a[-5, 2] = "" }.should raise_error(IndexError)
- lambda { a[-5, 10] = "" }.should raise_error(IndexError)
-
- lambda { a[-5..-5] = "" }.should raise_error(RangeError)
- lambda { a[-5...-5] = "" }.should raise_error(RangeError)
- lambda { a[-5..-4] = "" }.should raise_error(RangeError)
- lambda { a[-5...-4] = "" }.should raise_error(RangeError)
- lambda { a[-5..10] = "" }.should raise_error(RangeError)
- lambda { a[-5...10] = "" }.should raise_error(RangeError)
+ -> { a[-5] = "" }.should raise_error(IndexError)
+ -> { a[-5, -1] = "" }.should raise_error(IndexError)
+ -> { a[-5, 0] = "" }.should raise_error(IndexError)
+ -> { a[-5, 1] = "" }.should raise_error(IndexError)
+ -> { a[-5, 2] = "" }.should raise_error(IndexError)
+ -> { a[-5, 10] = "" }.should raise_error(IndexError)
+
+ -> { a[-5..-5] = "" }.should raise_error(RangeError)
+ -> { a[-5...-5] = "" }.should raise_error(RangeError)
+ -> { a[-5..-4] = "" }.should raise_error(RangeError)
+ -> { a[-5...-4] = "" }.should raise_error(RangeError)
+ -> { a[-5..10] = "" }.should raise_error(RangeError)
+ -> { a[-5...10] = "" }.should raise_error(RangeError)
# ok
a[0..-9] = [1]
@@ -237,7 +237,7 @@ describe "Array#[]=" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array[0, 0] = [] }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array[0, 0] = [] }.should raise_error(frozen_error_class)
end
end
@@ -337,12 +337,12 @@ describe "Array#[]= with [index, count]" do
it "raises an IndexError when passed start and negative length" do
a = [1, 2, 3, 4]
- lambda { a[-2, -1] = "" }.should raise_error(IndexError)
- lambda { a[0, -1] = "" }.should raise_error(IndexError)
- lambda { a[2, -1] = "" }.should raise_error(IndexError)
- lambda { a[4, -1] = "" }.should raise_error(IndexError)
- lambda { a[10, -1] = "" }.should raise_error(IndexError)
- lambda { [1, 2, 3, 4, 5][2, -1] = [7, 8] }.should raise_error(IndexError)
+ -> { a[-2, -1] = "" }.should raise_error(IndexError)
+ -> { a[0, -1] = "" }.should raise_error(IndexError)
+ -> { a[2, -1] = "" }.should raise_error(IndexError)
+ -> { a[4, -1] = "" }.should raise_error(IndexError)
+ -> { a[10, -1] = "" }.should raise_error(IndexError)
+ -> { [1, 2, 3, 4, 5][2, -1] = [7, 8] }.should raise_error(IndexError)
end
end
diff --git a/spec/ruby/core/array/fetch_spec.rb b/spec/ruby/core/array/fetch_spec.rb
index ccca463935..b81c0b48d7 100644
--- a/spec/ruby/core/array/fetch_spec.rb
+++ b/spec/ruby/core/array/fetch_spec.rb
@@ -12,9 +12,9 @@ describe "Array#fetch" do
end
it "raises an IndexError if there is no element at index" do
- lambda { [1, 2, 3].fetch(3) }.should raise_error(IndexError)
- lambda { [1, 2, 3].fetch(-4) }.should raise_error(IndexError)
- lambda { [].fetch(0) }.should raise_error(IndexError)
+ -> { [1, 2, 3].fetch(3) }.should raise_error(IndexError)
+ -> { [1, 2, 3].fetch(-4) }.should raise_error(IndexError)
+ -> { [].fetch(0) }.should raise_error(IndexError)
end
it "returns default if there is no element at index if passed a default value" do
@@ -37,7 +37,7 @@ describe "Array#fetch" do
end
it "gives precedence to the default block over the default argument" do
- lambda {
+ -> {
@result = [1, 2, 3].fetch(9, :foo) { |i| i * i }
}.should complain(/block supersedes default value argument/)
@result.should == 81
@@ -50,6 +50,6 @@ describe "Array#fetch" do
end
it "raises a TypeError when the passed argument can't be coerced to Integer" do
- lambda { [].fetch("cat") }.should raise_error(TypeError)
+ -> { [].fetch("cat") }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/array/fill_spec.rb b/spec/ruby/core/array/fill_spec.rb
index f953613c26..1c1beef25e 100644
--- a/spec/ruby/core/array/fill_spec.rb
+++ b/spec/ruby/core/array/fill_spec.rb
@@ -3,7 +3,7 @@ require_relative 'fixtures/classes'
describe "Array#fill" do
before :all do
- @never_passed = lambda do |i|
+ @never_passed = -> i do
raise ExpectationNotMetError, "the control path should not pass here"
end
end
@@ -44,33 +44,33 @@ describe "Array#fill" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.fill('x') }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.fill('x') }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} on an empty frozen array" do
- lambda { ArraySpecs.empty_frozen_array.fill('x') }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.empty_frozen_array.fill('x') }.should raise_error(frozen_error_class)
end
it "raises an ArgumentError if 4 or more arguments are passed when no block given" do
- lambda { [].fill('a') }.should_not raise_error(ArgumentError)
+ -> { [].fill('a') }.should_not raise_error(ArgumentError)
- lambda { [].fill('a', 1) }.should_not raise_error(ArgumentError)
+ -> { [].fill('a', 1) }.should_not raise_error(ArgumentError)
- lambda { [].fill('a', 1, 2) }.should_not raise_error(ArgumentError)
- lambda { [].fill('a', 1, 2, true) }.should raise_error(ArgumentError)
+ -> { [].fill('a', 1, 2) }.should_not raise_error(ArgumentError)
+ -> { [].fill('a', 1, 2, true) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if no argument passed and no block given" do
- lambda { [].fill }.should raise_error(ArgumentError)
+ -> { [].fill }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if 3 or more arguments are passed when a block given" do
- lambda { [].fill() {|i|} }.should_not raise_error(ArgumentError)
+ -> { [].fill() {|i|} }.should_not raise_error(ArgumentError)
- lambda { [].fill(1) {|i|} }.should_not raise_error(ArgumentError)
+ -> { [].fill(1) {|i|} }.should_not raise_error(ArgumentError)
- lambda { [].fill(1, 2) {|i|} }.should_not raise_error(ArgumentError)
- lambda { [].fill(1, 2, true) {|i|} }.should raise_error(ArgumentError)
+ -> { [].fill(1, 2) {|i|} }.should_not raise_error(ArgumentError)
+ -> { [].fill(1, 2, true) {|i|} }.should raise_error(ArgumentError)
end
end
@@ -171,23 +171,23 @@ describe "Array#fill with (filler, index, length)" do
# See: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/17481
it "does not raise an exception if the given length is negative and its absolute value does not exceed the index" do
- lambda { [1, 2, 3, 4].fill('a', 3, -1)}.should_not raise_error(ArgumentError)
- lambda { [1, 2, 3, 4].fill('a', 3, -2)}.should_not raise_error(ArgumentError)
- lambda { [1, 2, 3, 4].fill('a', 3, -3)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill('a', 3, -1)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill('a', 3, -2)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill('a', 3, -3)}.should_not raise_error(ArgumentError)
- lambda { [1, 2, 3, 4].fill(3, -1, &@never_passed)}.should_not raise_error(ArgumentError)
- lambda { [1, 2, 3, 4].fill(3, -2, &@never_passed)}.should_not raise_error(ArgumentError)
- lambda { [1, 2, 3, 4].fill(3, -3, &@never_passed)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill(3, -1, &@never_passed)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill(3, -2, &@never_passed)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill(3, -3, &@never_passed)}.should_not raise_error(ArgumentError)
end
it "does not raise an exception even if the given length is negative and its absolute value exceeds the index" do
- lambda { [1, 2, 3, 4].fill('a', 3, -4)}.should_not raise_error(ArgumentError)
- lambda { [1, 2, 3, 4].fill('a', 3, -5)}.should_not raise_error(ArgumentError)
- lambda { [1, 2, 3, 4].fill('a', 3, -10000)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill('a', 3, -4)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill('a', 3, -5)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill('a', 3, -10000)}.should_not raise_error(ArgumentError)
- lambda { [1, 2, 3, 4].fill(3, -4, &@never_passed)}.should_not raise_error(ArgumentError)
- lambda { [1, 2, 3, 4].fill(3, -5, &@never_passed)}.should_not raise_error(ArgumentError)
- lambda { [1, 2, 3, 4].fill(3, -10000, &@never_passed)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill(3, -4, &@never_passed)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill(3, -5, &@never_passed)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill(3, -10000, &@never_passed)}.should_not raise_error(ArgumentError)
end
it "tries to convert the second and third arguments to Integers using #to_int" do
@@ -199,17 +199,17 @@ describe "Array#fill with (filler, index, length)" do
end
it "raises a TypeError if the index is not numeric" do
- lambda { [].fill 'a', true }.should raise_error(TypeError)
+ -> { [].fill 'a', true }.should raise_error(TypeError)
obj = mock('nonnumeric')
- lambda { [].fill('a', obj) }.should raise_error(TypeError)
+ -> { [].fill('a', obj) }.should raise_error(TypeError)
end
not_supported_on :opal do
it "raises an ArgumentError or RangeError for too-large sizes" do
arr = [1, 2, 3]
- lambda { arr.fill(10, 1, fixnum_max) }.should raise_error(ArgumentError)
- lambda { arr.fill(10, 1, bignum_value) }.should raise_error(RangeError)
+ -> { arr.fill(10, 1, fixnum_max) }.should raise_error(ArgumentError)
+ -> { arr.fill(10, 1, bignum_value) }.should raise_error(RangeError)
end
end
end
@@ -239,7 +239,7 @@ describe "Array#fill with (filler, range)" do
end
it "raises a TypeError with range and length argument" do
- lambda { [].fill('x', 0 .. 2, 5) }.should raise_error(TypeError)
+ -> { [].fill('x', 0 .. 2, 5) }.should raise_error(TypeError)
end
it "replaces elements between the (-m)th to the last and the (n+1)th from the first if given an range m..n where m < 0 and n >= 0" do
@@ -291,13 +291,13 @@ describe "Array#fill with (filler, range)" do
end
it "raises an exception if some of the given range lies before the first of the array" do
- lambda { [1, 2, 3].fill('x', -5..-3) }.should raise_error(RangeError)
- lambda { [1, 2, 3].fill('x', -5...-3) }.should raise_error(RangeError)
- lambda { [1, 2, 3].fill('x', -5..-4) }.should raise_error(RangeError)
+ -> { [1, 2, 3].fill('x', -5..-3) }.should raise_error(RangeError)
+ -> { [1, 2, 3].fill('x', -5...-3) }.should raise_error(RangeError)
+ -> { [1, 2, 3].fill('x', -5..-4) }.should raise_error(RangeError)
- lambda { [1, 2, 3].fill(-5..-3, &@never_passed) }.should raise_error(RangeError)
- lambda { [1, 2, 3].fill(-5...-3, &@never_passed) }.should raise_error(RangeError)
- lambda { [1, 2, 3].fill(-5..-4, &@never_passed) }.should raise_error(RangeError)
+ -> { [1, 2, 3].fill(-5..-3, &@never_passed) }.should raise_error(RangeError)
+ -> { [1, 2, 3].fill(-5...-3, &@never_passed) }.should raise_error(RangeError)
+ -> { [1, 2, 3].fill(-5..-4, &@never_passed) }.should raise_error(RangeError)
end
it "tries to convert the start and end of the passed range to Integers using #to_int" do
@@ -312,6 +312,6 @@ describe "Array#fill with (filler, range)" do
it "raises a TypeError if the start or end of the passed range is not numeric" do
obj = mock('nonnumeric')
def obj.<=>(rhs); rhs == self ? 0 : nil end
- lambda { [].fill('a', obj..obj) }.should raise_error(TypeError)
+ -> { [].fill('a', obj..obj) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/array/first_spec.rb b/spec/ruby/core/array/first_spec.rb
index 5a0a25aeef..66eeba6565 100644
--- a/spec/ruby/core/array/first_spec.rb
+++ b/spec/ruby/core/array/first_spec.rb
@@ -30,11 +30,11 @@ describe "Array#first" do
end
it "raises an ArgumentError when count is negative" do
- lambda { [1, 2].first(-1) }.should raise_error(ArgumentError)
+ -> { [1, 2].first(-1) }.should raise_error(ArgumentError)
end
it "raises a RangeError when count is a Bignum" do
- lambda { [].first(bignum_value) }.should raise_error(RangeError)
+ -> { [].first(bignum_value) }.should raise_error(RangeError)
end
it "returns the entire array when count > length" do
@@ -66,11 +66,11 @@ describe "Array#first" do
end
it "raises a TypeError if the passed argument is not numeric" do
- lambda { [1,2].first(nil) }.should raise_error(TypeError)
- lambda { [1,2].first("a") }.should raise_error(TypeError)
+ -> { [1,2].first(nil) }.should raise_error(TypeError)
+ -> { [1,2].first("a") }.should raise_error(TypeError)
obj = mock("nonnumeric")
- lambda { [1,2].first(obj) }.should raise_error(TypeError)
+ -> { [1,2].first(obj) }.should raise_error(TypeError)
end
it "does not return subclass instance when passed count on Array subclasses" do
diff --git a/spec/ruby/core/array/flatten_spec.rb b/spec/ruby/core/array/flatten_spec.rb
index 1b7361552a..b506f899b4 100644
--- a/spec/ruby/core/array/flatten_spec.rb
+++ b/spec/ruby/core/array/flatten_spec.rb
@@ -30,7 +30,7 @@ describe "Array#flatten" do
it "raises a TypeError when the passed Object can't be converted to an Integer" do
obj = mock("Not converted")
- lambda { [ 1, 2, [3, [4, 5] ] ].flatten(obj) }.should raise_error(TypeError)
+ -> { [ 1, 2, [3, [4, 5] ] ].flatten(obj) }.should raise_error(TypeError)
end
it "does not call flatten on elements" do
@@ -46,13 +46,13 @@ describe "Array#flatten" do
it "raises an ArgumentError on recursive arrays" do
x = []
x << x
- lambda { x.flatten }.should raise_error(ArgumentError)
+ -> { x.flatten }.should raise_error(ArgumentError)
x = []
y = []
x << y
y << x
- lambda { x.flatten }.should raise_error(ArgumentError)
+ -> { x.flatten }.should raise_error(ArgumentError)
end
it "flattens any element which responds to #to_ary, using the return value of said method" do
@@ -106,7 +106,7 @@ describe "Array#flatten" do
it "raises a TypeError if #to_ary does not return an Array" do
@obj.should_receive(:to_ary).and_return(1)
- lambda { [@obj].flatten }.should raise_error(TypeError)
+ -> { [@obj].flatten }.should raise_error(TypeError)
end
ruby_version_is ""..."2.5" do
@@ -135,7 +135,7 @@ describe "Array#flatten" do
it "calls #to_ary if not defined when #respond_to_missing? returns true" do
def @obj.respond_to_missing?(name, priv) ScratchPad << name; true end
- lambda { [@obj].flatten }.should raise_error(NoMethodError)
+ -> { [@obj].flatten }.should raise_error(NoMethodError)
ScratchPad.recorded.should == [:to_ary]
end
@@ -226,7 +226,7 @@ describe "Array#flatten!" do
it "raises a TypeError when the passed Object can't be converted to an Integer" do
obj = mock("Not converted")
- lambda { [ 1, 2, [3, [4, 5] ] ].flatten!(obj) }.should raise_error(TypeError)
+ -> { [ 1, 2, [3, [4, 5] ] ].flatten!(obj) }.should raise_error(TypeError)
end
it "does not call flatten! on elements" do
@@ -242,13 +242,13 @@ describe "Array#flatten!" do
it "raises an ArgumentError on recursive arrays" do
x = []
x << x
- lambda { x.flatten! }.should raise_error(ArgumentError)
+ -> { x.flatten! }.should raise_error(ArgumentError)
x = []
y = []
x << y
y << x
- lambda { x.flatten! }.should raise_error(ArgumentError)
+ -> { x.flatten! }.should raise_error(ArgumentError)
end
it "flattens any elements which responds to #to_ary, using the return value of said method" do
@@ -273,12 +273,12 @@ describe "Array#flatten!" do
it "raises a #{frozen_error_class} on frozen arrays when the array is modified" do
nested_ary = [1, 2, []]
nested_ary.freeze
- lambda { nested_ary.flatten! }.should raise_error(frozen_error_class)
+ -> { nested_ary.flatten! }.should raise_error(frozen_error_class)
end
# see [ruby-core:23663]
it "raises a #{frozen_error_class} on frozen arrays when the array would not be modified" do
- lambda { ArraySpecs.frozen_array.flatten! }.should raise_error(frozen_error_class)
- lambda { ArraySpecs.empty_frozen_array.flatten! }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.flatten! }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.empty_frozen_array.flatten! }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/hash_spec.rb b/spec/ruby/core/array/hash_spec.rb
index 638acff12b..8392253ae4 100644
--- a/spec/ruby/core/array/hash_spec.rb
+++ b/spec/ruby/core/array/hash_spec.rb
@@ -13,10 +13,10 @@ describe "Array#hash" do
it "properly handles recursive arrays" do
empty = ArraySpecs.empty_recursive_array
- lambda { empty.hash }.should_not raise_error
+ -> { empty.hash }.should_not raise_error
array = ArraySpecs.recursive_array
- lambda { array.hash }.should_not raise_error
+ -> { array.hash }.should_not raise_error
end
it "returns the same hash for equal recursive arrays" do
diff --git a/spec/ruby/core/array/initialize_spec.rb b/spec/ruby/core/array/initialize_spec.rb
index 350538a222..dfc2ae3518 100644
--- a/spec/ruby/core/array/initialize_spec.rb
+++ b/spec/ruby/core/array/initialize_spec.rb
@@ -24,19 +24,19 @@ describe "Array#initialize" do
end
it "raises an ArgumentError if passed 3 or more arguments" do
- lambda do
+ -> do
[1, 2].send :initialize, 1, 'x', true
end.should raise_error(ArgumentError)
- lambda do
+ -> do
[1, 2].send(:initialize, 1, 'x', true) {}
end.should raise_error(ArgumentError)
end
it "raises a #{frozen_error_class} on frozen arrays" do
- lambda do
+ -> do
ArraySpecs.frozen_array.send :initialize
end.should raise_error(frozen_error_class)
- lambda do
+ -> do
ArraySpecs.frozen_array.send :initialize, ArraySpecs.frozen_array
end.should raise_error(frozen_error_class)
end
@@ -53,7 +53,7 @@ describe "Array#initialize with no arguments" do
end
it "does not use the given block" do
- lambda{ [1, 2, 3].send(:initialize) { raise } }.should_not raise_error
+ ->{ [1, 2, 3].send(:initialize) { raise } }.should_not raise_error
end
end
@@ -64,7 +64,7 @@ describe "Array#initialize with (array)" do
end
it "does not use the given block" do
- lambda{ [1, 2, 3].send(:initialize) { raise } }.should_not raise_error
+ ->{ [1, 2, 3].send(:initialize) { raise } }.should_not raise_error
end
it "calls #to_ary to convert the value to an array" do
@@ -81,7 +81,7 @@ describe "Array#initialize with (array)" do
end
it "raises a TypeError if an Array type argument and a default object" do
- lambda { [].send(:initialize, [1, 2], 1) }.should raise_error(TypeError)
+ -> { [].send(:initialize, [1, 2], 1) }.should raise_error(TypeError)
end
end
@@ -103,12 +103,12 @@ describe "Array#initialize with (size, object=nil)" do
end
it "raises an ArgumentError if size is negative" do
- lambda { [].send(:initialize, -1, :a) }.should raise_error(ArgumentError)
- lambda { [].send(:initialize, -1) }.should raise_error(ArgumentError)
+ -> { [].send(:initialize, -1, :a) }.should raise_error(ArgumentError)
+ -> { [].send(:initialize, -1) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if size is too large" do
- lambda { [].send(:initialize, fixnum_max+1) }.should raise_error(ArgumentError)
+ -> { [].send(:initialize, fixnum_max+1) }.should raise_error(ArgumentError)
end
it "calls #to_int to convert the size argument to an Integer when object is given" do
@@ -126,7 +126,7 @@ describe "Array#initialize with (size, object=nil)" do
it "raises a TypeError if the size argument is not an Integer type" do
obj = mock('nonnumeric')
obj.stub!(:to_ary).and_return([1, 2])
- lambda{ [].send(:initialize, obj, :a) }.should raise_error(TypeError)
+ ->{ [].send(:initialize, obj, :a) }.should raise_error(TypeError)
end
it "yields the index of the element and sets the element to the value of the block" do
@@ -134,7 +134,7 @@ describe "Array#initialize with (size, object=nil)" do
end
it "uses the block value instead of using the default value" do
- lambda {
+ -> {
@result = [].send(:initialize, 3, :obj) { |i| i.to_s }
}.should complain(/block supersedes default value argument/)
@result.should == ['0', '1', '2']
diff --git a/spec/ruby/core/array/insert_spec.rb b/spec/ruby/core/array/insert_spec.rb
index b65a14a6b7..7577a8f743 100644
--- a/spec/ruby/core/array/insert_spec.rb
+++ b/spec/ruby/core/array/insert_spec.rb
@@ -46,8 +46,8 @@ describe "Array#insert" do
end
it "raises an IndexError if the negative index is out of bounds" do
- lambda { [].insert(-2, 1) }.should raise_error(IndexError)
- lambda { [1].insert(-3, 2) }.should raise_error(IndexError)
+ -> { [].insert(-2, 1) }.should raise_error(IndexError)
+ -> { [1].insert(-3, 2) }.should raise_error(IndexError)
end
it "does nothing of no object is passed" do
@@ -64,15 +64,15 @@ describe "Array#insert" do
end
it "raises an ArgumentError if no argument passed" do
- lambda { [].insert() }.should raise_error(ArgumentError)
+ -> { [].insert() }.should raise_error(ArgumentError)
end
it "raises a #{frozen_error_class} on frozen arrays when the array is modified" do
- lambda { ArraySpecs.frozen_array.insert(0, 'x') }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.insert(0, 'x') }.should raise_error(frozen_error_class)
end
# see [ruby-core:23666]
it "raises a #{frozen_error_class} on frozen arrays when the array would not be modified" do
- lambda { ArraySpecs.frozen_array.insert(0) }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.insert(0) }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/join_spec.rb b/spec/ruby/core/array/join_spec.rb
index 403bae7183..e78ea6f9e1 100644
--- a/spec/ruby/core/array/join_spec.rb
+++ b/spec/ruby/core/array/join_spec.rb
@@ -24,11 +24,11 @@ describe "Array#join" do
it "raises a TypeError if the separator cannot be coerced to a String by calling #to_str" do
obj = mock("not a string")
- lambda { [1, 2].join(obj) }.should raise_error(TypeError)
+ -> { [1, 2].join(obj) }.should raise_error(TypeError)
end
it "raises a TypeError if passed false as the separator" do
- lambda { [1, 2].join(false) }.should raise_error(TypeError)
+ -> { [1, 2].join(false) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/array/last_spec.rb b/spec/ruby/core/array/last_spec.rb
index 9bf8648776..d6fefada09 100644
--- a/spec/ruby/core/array/last_spec.rb
+++ b/spec/ruby/core/array/last_spec.rb
@@ -28,7 +28,7 @@ describe "Array#last" do
end
it "raises an ArgumentError when count is negative" do
- lambda { [1, 2].last(-1) }.should raise_error(ArgumentError)
+ -> { [1, 2].last(-1) }.should raise_error(ArgumentError)
end
it "returns the entire array when count > length" do
@@ -60,11 +60,11 @@ describe "Array#last" do
end
it "raises a TypeError if the passed argument is not numeric" do
- lambda { [1,2].last(nil) }.should raise_error(TypeError)
- lambda { [1,2].last("a") }.should raise_error(TypeError)
+ -> { [1,2].last(nil) }.should raise_error(TypeError)
+ -> { [1,2].last("a") }.should raise_error(TypeError)
obj = mock("nonnumeric")
- lambda { [1,2].last(obj) }.should raise_error(TypeError)
+ -> { [1,2].last(obj) }.should raise_error(TypeError)
end
it "does not return subclass instance on Array subclasses" do
diff --git a/spec/ruby/core/array/max_spec.rb b/spec/ruby/core/array/max_spec.rb
index 329b691883..d1c64519d0 100644
--- a/spec/ruby/core/array/max_spec.rb
+++ b/spec/ruby/core/array/max_spec.rb
@@ -68,16 +68,16 @@ describe "Array#max" do
end
it "raises a NoMethodError for elements without #<=>" do
- lambda do
+ -> do
[BasicObject.new, BasicObject.new].max
end.should raise_error(NoMethodError)
end
it "raises an ArgumentError for incomparable elements" do
- lambda do
+ -> do
[11,"22"].max
end.should raise_error(ArgumentError)
- lambda do
+ -> do
[11,12,22,33].max{|a, b| nil}
end.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/core/array/min_spec.rb b/spec/ruby/core/array/min_spec.rb
index 22a179d808..3bdef0dd00 100644
--- a/spec/ruby/core/array/min_spec.rb
+++ b/spec/ruby/core/array/min_spec.rb
@@ -68,16 +68,16 @@ describe "Array#min" do
end
it "raises a NoMethodError for elements without #<=>" do
- lambda do
+ -> do
[BasicObject.new, BasicObject.new].min
end.should raise_error(NoMethodError)
end
it "raises an ArgumentError for incomparable elements" do
- lambda do
+ -> do
[11,"22"].min
end.should raise_error(ArgumentError)
- lambda do
+ -> do
[11,12,22,33].min{|a, b| nil}
end.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/core/array/multiply_spec.rb b/spec/ruby/core/array/multiply_spec.rb
index f9ba20258a..ab654ce489 100644
--- a/spec/ruby/core/array/multiply_spec.rb
+++ b/spec/ruby/core/array/multiply_spec.rb
@@ -17,7 +17,7 @@ describe "Array#*" do
it "raises a TypeError if the argument can neither be converted to a string nor an integer" do
obj = mock('not a string or integer')
- lambda{ [1,2] * obj }.should raise_error(TypeError)
+ ->{ [1,2] * obj }.should raise_error(TypeError)
end
it "converts the passed argument to a String rather than an Integer" do
@@ -28,15 +28,15 @@ describe "Array#*" do
end
it "raises a TypeError is the passed argument is nil" do
- lambda{ [1,2] * nil }.should raise_error(TypeError)
+ ->{ [1,2] * nil }.should raise_error(TypeError)
end
it "raises an ArgumentError when passed 2 or more arguments" do
- lambda{ [1,2].send(:*, 1, 2) }.should raise_error(ArgumentError)
+ ->{ [1,2].send(:*, 1, 2) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when passed no arguments" do
- lambda{ [1,2].send(:*) }.should raise_error(ArgumentError)
+ ->{ [1,2].send(:*) }.should raise_error(ArgumentError)
end
end
@@ -65,8 +65,8 @@ describe "Array#* with an integer" do
end
it "raises an ArgumentError when passed a negative integer" do
- lambda { [ 1, 2, 3 ] * -1 }.should raise_error(ArgumentError)
- lambda { [] * -1 }.should raise_error(ArgumentError)
+ -> { [ 1, 2, 3 ] * -1 }.should raise_error(ArgumentError)
+ -> { [] * -1 }.should raise_error(ArgumentError)
end
describe "with a subclass of Array" do
diff --git a/spec/ruby/core/array/new_spec.rb b/spec/ruby/core/array/new_spec.rb
index d5e4b5722f..96ec6b8198 100644
--- a/spec/ruby/core/array/new_spec.rb
+++ b/spec/ruby/core/array/new_spec.rb
@@ -11,10 +11,10 @@ describe "Array.new" do
end
it "raises an ArgumentError if passed 3 or more arguments" do
- lambda do
+ -> do
[1, 2].send :initialize, 1, 'x', true
end.should raise_error(ArgumentError)
- lambda do
+ -> do
[1, 2].send(:initialize, 1, 'x', true) {}
end.should raise_error(ArgumentError)
end
@@ -26,7 +26,7 @@ describe "Array.new with no arguments" do
end
it "does not use the given block" do
- lambda{ Array.new { raise } }.should_not raise_error
+ ->{ Array.new { raise } }.should_not raise_error
end
end
@@ -37,7 +37,7 @@ describe "Array.new with (array)" do
end
it "does not use the given block" do
- lambda{ Array.new([1, 2]) { raise } }.should_not raise_error
+ ->{ Array.new([1, 2]) { raise } }.should_not raise_error
end
it "calls #to_ary to convert the value to an array" do
@@ -54,7 +54,7 @@ describe "Array.new with (array)" do
end
it "raises a TypeError if an Array type argument and a default object" do
- lambda { Array.new([1, 2], 1) }.should raise_error(TypeError)
+ -> { Array.new([1, 2], 1) }.should raise_error(TypeError)
end
end
@@ -74,12 +74,12 @@ describe "Array.new with (size, object=nil)" do
end
it "raises an ArgumentError if size is negative" do
- lambda { Array.new(-1, :a) }.should raise_error(ArgumentError)
- lambda { Array.new(-1) }.should raise_error(ArgumentError)
+ -> { Array.new(-1, :a) }.should raise_error(ArgumentError)
+ -> { Array.new(-1) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if size is too large" do
- lambda { Array.new(fixnum_max+1) }.should raise_error(ArgumentError)
+ -> { Array.new(fixnum_max+1) }.should raise_error(ArgumentError)
end
it "calls #to_int to convert the size argument to an Integer when object is given" do
@@ -97,7 +97,7 @@ describe "Array.new with (size, object=nil)" do
it "raises a TypeError if the size argument is not an Integer type" do
obj = mock('nonnumeric')
obj.stub!(:to_ary).and_return([1, 2])
- lambda{ Array.new(obj, :a) }.should raise_error(TypeError)
+ ->{ Array.new(obj, :a) }.should raise_error(TypeError)
end
it "yields the index of the element and sets the element to the value of the block" do
@@ -105,7 +105,7 @@ describe "Array.new with (size, object=nil)" do
end
it "uses the block value instead of using the default value" do
- lambda {
+ -> {
@result = Array.new(3, :obj) { |i| i.to_s }
}.should complain(/block supersedes default value argument/)
@result.should == ['0', '1', '2']
diff --git a/spec/ruby/core/array/pack/buffer_spec.rb b/spec/ruby/core/array/pack/buffer_spec.rb
index a3a582996a..ecb40bfd06 100644
--- a/spec/ruby/core/array/pack/buffer_spec.rb
+++ b/spec/ruby/core/array/pack/buffer_spec.rb
@@ -24,7 +24,7 @@ describe "Array#pack with :buffer option" do
end
it "raises TypeError exception if buffer is not String" do
- lambda { [65].pack("ccc", buffer: []) }.should raise_error(
+ -> { [65].pack("ccc", buffer: []) }.should raise_error(
TypeError, "buffer must be String, not Array")
end
diff --git a/spec/ruby/core/array/pack/m_spec.rb b/spec/ruby/core/array/pack/m_spec.rb
index 40c2e3f1fa..2b1a84abca 100644
--- a/spec/ruby/core/array/pack/m_spec.rb
+++ b/spec/ruby/core/array/pack/m_spec.rb
@@ -285,16 +285,16 @@ describe "Array#pack with format 'm'" do
it "raises a TypeError if #to_str does not return a String" do
obj = mock("pack m non-string")
- lambda { [obj].pack("m") }.should raise_error(TypeError)
+ -> { [obj].pack("m") }.should raise_error(TypeError)
end
it "raises a TypeError if passed nil" do
- lambda { [nil].pack("m") }.should raise_error(TypeError)
+ -> { [nil].pack("m") }.should raise_error(TypeError)
end
it "raises a TypeError if passed an Integer" do
- lambda { [0].pack("m") }.should raise_error(TypeError)
- lambda { [bignum_value].pack("m") }.should raise_error(TypeError)
+ -> { [0].pack("m") }.should raise_error(TypeError)
+ -> { [bignum_value].pack("m") }.should raise_error(TypeError)
end
it "does not emit a newline if passed zero as the count modifier" do
diff --git a/spec/ruby/core/array/pack/percent_spec.rb b/spec/ruby/core/array/pack/percent_spec.rb
index 3c0e7eca0f..5d56dea5fe 100644
--- a/spec/ruby/core/array/pack/percent_spec.rb
+++ b/spec/ruby/core/array/pack/percent_spec.rb
@@ -2,6 +2,6 @@ require_relative '../../../spec_helper'
describe "Array#pack with format '%'" do
it "raises an Argument Error" do
- lambda { [1].pack("%") }.should raise_error(ArgumentError)
+ -> { [1].pack("%") }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/array/pack/shared/basic.rb b/spec/ruby/core/array/pack/shared/basic.rb
index 39ab15308d..bc366987c8 100644
--- a/spec/ruby/core/array/pack/shared/basic.rb
+++ b/spec/ruby/core/array/pack/shared/basic.rb
@@ -1,6 +1,6 @@
describe :array_pack_arguments, shared: true do
it "raises an ArgumentError if there are fewer elements than the format requires" do
- lambda { [].pack(pack_format(1)) }.should raise_error(ArgumentError)
+ -> { [].pack(pack_format(1)) }.should raise_error(ArgumentError)
end
end
@@ -10,11 +10,11 @@ describe :array_pack_basic, shared: true do
end
it "raises a TypeError when passed nil" do
- lambda { [@obj].pack(nil) }.should raise_error(TypeError)
+ -> { [@obj].pack(nil) }.should raise_error(TypeError)
end
it "raises a TypeError when passed an Integer" do
- lambda { [@obj].pack(1) }.should raise_error(TypeError)
+ -> { [@obj].pack(1) }.should raise_error(TypeError)
end
end
@@ -56,10 +56,10 @@ end
describe :array_pack_no_platform, shared: true do
it "raises ArgumentError when the format modifier is '_'" do
- lambda{ [1].pack(pack_format("_")) }.should raise_error(ArgumentError)
+ ->{ [1].pack(pack_format("_")) }.should raise_error(ArgumentError)
end
it "raises ArgumentError when the format modifier is '!'" do
- lambda{ [1].pack(pack_format("!")) }.should raise_error(ArgumentError)
+ ->{ [1].pack(pack_format("!")) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/array/pack/shared/encodings.rb b/spec/ruby/core/array/pack/shared/encodings.rb
index 3724a5d859..6b7ffac764 100644
--- a/spec/ruby/core/array/pack/shared/encodings.rb
+++ b/spec/ruby/core/array/pack/shared/encodings.rb
@@ -5,12 +5,12 @@ describe :array_pack_hex, shared: true do
it "raises a TypeError if the object does not respond to #to_str" do
obj = mock("pack hex non-string")
- lambda { [obj].pack(pack_format) }.should raise_error(TypeError)
+ -> { [obj].pack(pack_format) }.should raise_error(TypeError)
end
it "raises a TypeError if #to_str does not return a String" do
obj = mock("pack hex non-string")
obj.should_receive(:to_str).and_return(1)
- lambda { [obj].pack(pack_format) }.should raise_error(TypeError)
+ -> { [obj].pack(pack_format) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/array/pack/shared/float.rb b/spec/ruby/core/array/pack/shared/float.rb
index 6cd326ce9c..c6b194007f 100644
--- a/spec/ruby/core/array/pack/shared/float.rb
+++ b/spec/ruby/core/array/pack/shared/float.rb
@@ -14,7 +14,7 @@ describe :array_pack_float_le, shared: true do
end
it "raises a TypeError if passed a String representation of a floating point number" do
- lambda { ["13"].pack(pack_format) }.should raise_error(TypeError)
+ -> { ["13"].pack(pack_format) }.should raise_error(TypeError)
end
it "encodes the number of array elements specified by the count modifier" do
@@ -69,7 +69,7 @@ describe :array_pack_float_be, shared: true do
end
it "raises a TypeError if passed a String representation of a floating point number" do
- lambda { ["13"].pack(pack_format) }.should raise_error(TypeError)
+ -> { ["13"].pack(pack_format) }.should raise_error(TypeError)
end
it "encodes the number of array elements specified by the count modifier" do
@@ -124,7 +124,7 @@ describe :array_pack_double_le, shared: true do
end
it "raises a TypeError if passed a String representation of a floating point number" do
- lambda { ["13"].pack(pack_format) }.should raise_error(TypeError)
+ -> { ["13"].pack(pack_format) }.should raise_error(TypeError)
end
it "encodes the number of array elements specified by the count modifier" do
@@ -183,7 +183,7 @@ describe :array_pack_double_be, shared: true do
end
it "raises a TypeError if passed a String representation of a floating point number" do
- lambda { ["13"].pack(pack_format) }.should raise_error(TypeError)
+ -> { ["13"].pack(pack_format) }.should raise_error(TypeError)
end
it "encodes the number of array elements specified by the count modifier" do
diff --git a/spec/ruby/core/array/pack/shared/numeric_basic.rb b/spec/ruby/core/array/pack/shared/numeric_basic.rb
index 3ebdbc4c1a..7c36ba4a32 100644
--- a/spec/ruby/core/array/pack/shared/numeric_basic.rb
+++ b/spec/ruby/core/array/pack/shared/numeric_basic.rb
@@ -4,15 +4,15 @@ describe :array_pack_numeric_basic, shared: true do
end
it "raises a TypeError when passed nil" do
- lambda { [nil].pack(pack_format) }.should raise_error(TypeError)
+ -> { [nil].pack(pack_format) }.should raise_error(TypeError)
end
it "raises a TypeError when passed true" do
- lambda { [true].pack(pack_format) }.should raise_error(TypeError)
+ -> { [true].pack(pack_format) }.should raise_error(TypeError)
end
it "raises a TypeError when passed false" do
- lambda { [false].pack(pack_format) }.should raise_error(TypeError)
+ -> { [false].pack(pack_format) }.should raise_error(TypeError)
end
it "returns a binary string" do
@@ -24,21 +24,21 @@ end
describe :array_pack_integer, shared: true do
it "raises a TypeError when the object does not respond to #to_int" do
obj = mock('not an integer')
- lambda { [obj].pack(pack_format) }.should raise_error(TypeError)
+ -> { [obj].pack(pack_format) }.should raise_error(TypeError)
end
it "raises a TypeError when passed a String" do
- lambda { ["5"].pack(pack_format) }.should raise_error(TypeError)
+ -> { ["5"].pack(pack_format) }.should raise_error(TypeError)
end
end
describe :array_pack_float, shared: true do
it "raises a TypeError if a String does not represent a floating point number" do
- lambda { ["a"].pack(pack_format) }.should raise_error(TypeError)
+ -> { ["a"].pack(pack_format) }.should raise_error(TypeError)
end
it "raises a TypeError when the object does not respond to #to_f" do
obj = mock('not an float')
- lambda { [obj].pack(pack_format) }.should raise_error(TypeError)
+ -> { [obj].pack(pack_format) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/array/pack/shared/string.rb b/spec/ruby/core/array/pack/shared/string.rb
index 98e8c4d562..8c82e8c617 100644
--- a/spec/ruby/core/array/pack/shared/string.rb
+++ b/spec/ruby/core/array/pack/shared/string.rb
@@ -17,11 +17,11 @@ describe :array_pack_string, shared: true do
end
it "raises an ArgumentError when the Array is empty" do
- lambda { [].pack(pack_format) }.should raise_error(ArgumentError)
+ -> { [].pack(pack_format) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the Array has too few elements" do
- lambda { ["a"].pack(pack_format(nil, 2)) }.should raise_error(ArgumentError)
+ -> { ["a"].pack(pack_format(nil, 2)) }.should raise_error(ArgumentError)
end
it "calls #to_str to convert the element to a String" do
@@ -33,7 +33,7 @@ describe :array_pack_string, shared: true do
it "raises a TypeError when the object does not respond to #to_str" do
obj = mock("not a string")
- lambda { [obj].pack(pack_format) }.should raise_error(TypeError)
+ -> { [obj].pack(pack_format) }.should raise_error(TypeError)
end
it "returns a string in encoding of common to the concatenated results" do
diff --git a/spec/ruby/core/array/pack/shared/unicode.rb b/spec/ruby/core/array/pack/shared/unicode.rb
index e16110c491..dd0f8b38aa 100644
--- a/spec/ruby/core/array/pack/shared/unicode.rb
+++ b/spec/ruby/core/array/pack/shared/unicode.rb
@@ -64,7 +64,7 @@ describe :array_pack_unicode, shared: true do
it "raises a TypeError if #to_int does not return an Integer" do
obj = mock('to_int')
obj.should_receive(:to_int).and_return("5")
- lambda { [obj].pack("U") }.should raise_error(TypeError)
+ -> { [obj].pack("U") }.should raise_error(TypeError)
end
it "ignores NULL bytes between directives" do
@@ -76,11 +76,11 @@ describe :array_pack_unicode, shared: true do
end
it "raises a RangeError if passed a negative number" do
- lambda { [-1].pack("U") }.should raise_error(RangeError)
+ -> { [-1].pack("U") }.should raise_error(RangeError)
end
it "raises a RangeError if passed a number larger than an unsigned 32-bit integer" do
- lambda { [2**32].pack("U") }.should raise_error(RangeError)
+ -> { [2**32].pack("U") }.should raise_error(RangeError)
end
it "sets the output string to UTF-8 encoding" do
diff --git a/spec/ruby/core/array/pack/u_spec.rb b/spec/ruby/core/array/pack/u_spec.rb
index 8c3eb3a177..fe969cbb2d 100644
--- a/spec/ruby/core/array/pack/u_spec.rb
+++ b/spec/ruby/core/array/pack/u_spec.rb
@@ -112,16 +112,16 @@ describe "Array#pack with format 'u'" do
it "raises a TypeError if #to_str does not return a String" do
obj = mock("pack m non-string")
- lambda { [obj].pack("u") }.should raise_error(TypeError)
+ -> { [obj].pack("u") }.should raise_error(TypeError)
end
it "raises a TypeError if passed nil" do
- lambda { [nil].pack("u") }.should raise_error(TypeError)
+ -> { [nil].pack("u") }.should raise_error(TypeError)
end
it "raises a TypeError if passed an Integer" do
- lambda { [0].pack("u") }.should raise_error(TypeError)
- lambda { [bignum_value].pack("u") }.should raise_error(TypeError)
+ -> { [0].pack("u") }.should raise_error(TypeError)
+ -> { [bignum_value].pack("u") }.should raise_error(TypeError)
end
it "sets the output string to US-ASCII encoding" do
diff --git a/spec/ruby/core/array/pack/w_spec.rb b/spec/ruby/core/array/pack/w_spec.rb
index 889f42bdf7..439fa02198 100644
--- a/spec/ruby/core/array/pack/w_spec.rb
+++ b/spec/ruby/core/array/pack/w_spec.rb
@@ -33,7 +33,7 @@ describe "Array#pack with format 'w'" do
end
it "raises an ArgumentError when passed a negative value" do
- lambda { [-1].pack("w") }.should raise_error(ArgumentError)
+ -> { [-1].pack("w") }.should raise_error(ArgumentError)
end
it "returns a binary string" do
diff --git a/spec/ruby/core/array/pack/x_spec.rb b/spec/ruby/core/array/pack/x_spec.rb
index 2662873d03..a28dd0bf21 100644
--- a/spec/ruby/core/array/pack/x_spec.rb
+++ b/spec/ruby/core/array/pack/x_spec.rb
@@ -55,10 +55,10 @@ describe "Array#pack with format 'X'" do
end
it "raises an ArgumentError if the output string is empty" do
- lambda { [1, 2, 3].pack("XC") }.should raise_error(ArgumentError)
+ -> { [1, 2, 3].pack("XC") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if the count modifier is greater than the bytes in the string" do
- lambda { [1, 2, 3].pack("C2X3") }.should raise_error(ArgumentError)
+ -> { [1, 2, 3].pack("C2X3") }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/array/pop_spec.rb b/spec/ruby/core/array/pop_spec.rb
index 335a0f2b60..7dbd6cb3cc 100644
--- a/spec/ruby/core/array/pop_spec.rb
+++ b/spec/ruby/core/array/pop_spec.rb
@@ -39,11 +39,11 @@ describe "Array#pop" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.pop }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.pop }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} on an empty frozen array" do
- lambda { ArraySpecs.empty_frozen_array.pop }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.empty_frozen_array.pop }.should raise_error(frozen_error_class)
end
it "keeps untrusted status" do
@@ -105,7 +105,7 @@ describe "Array#pop" do
end
it "raises an ArgumentError if n is negative" do
- lambda{ [1, 2, 3].pop(-1) }.should raise_error(ArgumentError)
+ ->{ [1, 2, 3].pop(-1) }.should raise_error(ArgumentError)
end
it "tries to convert n to an Integer using #to_int" do
@@ -120,12 +120,12 @@ describe "Array#pop" do
end
it "raises a TypeError when the passed n cannot be coerced to Integer" do
- lambda{ [1, 2].pop("cat") }.should raise_error(TypeError)
- lambda{ [1, 2].pop(nil) }.should raise_error(TypeError)
+ ->{ [1, 2].pop("cat") }.should raise_error(TypeError)
+ ->{ [1, 2].pop(nil) }.should raise_error(TypeError)
end
it "raises an ArgumentError if more arguments are passed" do
- lambda{ [1, 2].pop(1, 2) }.should raise_error(ArgumentError)
+ ->{ [1, 2].pop(1, 2) }.should raise_error(ArgumentError)
end
it "does not return subclass instances with Array subclass" do
@@ -153,8 +153,8 @@ describe "Array#pop" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.pop(2) }.should raise_error(frozen_error_class)
- lambda { ArraySpecs.frozen_array.pop(0) }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.pop(2) }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.pop(0) }.should raise_error(frozen_error_class)
end
it "keeps untrusted status" do
diff --git a/spec/ruby/core/array/product_spec.rb b/spec/ruby/core/array/product_spec.rb
index 7d810b6196..07d2880a96 100644
--- a/spec/ruby/core/array/product_spec.rb
+++ b/spec/ruby/core/array/product_spec.rb
@@ -3,7 +3,7 @@ require_relative 'fixtures/classes'
describe "Array#product" do
it "returns converted arguments using :to_ary" do
- lambda{ [1].product(2..3) }.should raise_error(TypeError)
+ ->{ [1].product(2..3) }.should raise_error(TypeError)
ar = ArraySpecs::ArrayConvertible.new(2,3)
[1].product(ar).should == [[1,2],[1,3]]
ar.called.should == :to_ary
@@ -24,7 +24,7 @@ describe "Array#product" do
it "does not attempt to produce an unreasonable number of products" do
a = (0..100).to_a
- lambda do
+ -> do
a.product(a, a, a, a, a, a, a, a, a, a)
end.should raise_error(RangeError)
end
@@ -49,7 +49,7 @@ describe "Array#product" do
it "will ignore unreasonable numbers of products and yield anyway" do
a = (0..100).to_a
- lambda do
+ -> do
a.product(a, a, a, a, a, a, a, a, a, a)
end.should raise_error(RangeError)
end
diff --git a/spec/ruby/core/array/reject_spec.rb b/spec/ruby/core/array/reject_spec.rb
index 6ae2581ff5..1e9c296c8d 100644
--- a/spec/ruby/core/array/reject_spec.rb
+++ b/spec/ruby/core/array/reject_spec.rb
@@ -104,11 +104,11 @@ describe "Array#reject!" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.reject! {} }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.reject! {} }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} on an empty frozen array" do
- lambda { ArraySpecs.empty_frozen_array.reject! {} }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.empty_frozen_array.reject! {} }.should raise_error(frozen_error_class)
end
it "does not truncate the array is the block raises an exception" do
diff --git a/spec/ruby/core/array/reverse_spec.rb b/spec/ruby/core/array/reverse_spec.rb
index d8ff26639d..e738be6fe7 100644
--- a/spec/ruby/core/array/reverse_spec.rb
+++ b/spec/ruby/core/array/reverse_spec.rb
@@ -37,6 +37,6 @@ describe "Array#reverse!" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.reverse! }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.reverse! }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/rotate_spec.rb b/spec/ruby/core/array/rotate_spec.rb
index 6450d3892b..cc1aabf986 100644
--- a/spec/ruby/core/array/rotate_spec.rb
+++ b/spec/ruby/core/array/rotate_spec.rb
@@ -27,10 +27,10 @@ describe "Array#rotate" do
end
it "raises a TypeError if not passed an integer-like argument" do
- lambda {
+ -> {
[1, 2].rotate(nil)
}.should raise_error(TypeError)
- lambda {
+ -> {
[1, 2].rotate("4")
}.should raise_error(TypeError)
end
@@ -46,7 +46,7 @@ describe "Array#rotate" do
end
it "does not mutate the receiver" do
- lambda {
+ -> {
[].freeze.rotate
[2].freeze.rotate(2)
[1,2,3].freeze.rotate(-3)
@@ -94,10 +94,10 @@ describe "Array#rotate!" do
end
it "raises a TypeError if not passed an integer-like argument" do
- lambda {
+ -> {
[1, 2].rotate!(nil)
}.should raise_error(TypeError)
- lambda {
+ -> {
[1, 2].rotate!("4")
}.should raise_error(TypeError)
end
@@ -122,8 +122,8 @@ describe "Array#rotate!" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { [1, 2, 3].freeze.rotate!(0) }.should raise_error(frozen_error_class)
- lambda { [1].freeze.rotate!(42) }.should raise_error(frozen_error_class)
- lambda { [].freeze.rotate! }.should raise_error(frozen_error_class)
+ -> { [1, 2, 3].freeze.rotate!(0) }.should raise_error(frozen_error_class)
+ -> { [1].freeze.rotate!(42) }.should raise_error(frozen_error_class)
+ -> { [].freeze.rotate! }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/sample_spec.rb b/spec/ruby/core/array/sample_spec.rb
index 3bd5d046cc..44be91ba18 100644
--- a/spec/ruby/core/array/sample_spec.rb
+++ b/spec/ruby/core/array/sample_spec.rb
@@ -57,7 +57,7 @@ describe "Array#sample" do
end
it "raises ArgumentError when passed a negative count" do
- lambda { [1, 2].sample(-1) }.should raise_error(ArgumentError)
+ -> { [1, 2].sample(-1) }.should raise_error(ArgumentError)
end
it "does not return subclass instances with Array subclass" do
@@ -92,7 +92,7 @@ describe "Array#sample" do
it "raises a NoMethodError if an object passed for the RNG does not define #rand" do
obj = BasicObject.new
- lambda { [1, 2].sample(random: obj) }.should raise_error(NoMethodError)
+ -> { [1, 2].sample(random: obj) }.should raise_error(NoMethodError)
end
describe "when the object returned by #rand is a Fixnum" do
@@ -112,14 +112,14 @@ describe "Array#sample" do
random = mock("array_sample_random")
random.should_receive(:rand).and_return(-1)
- lambda { [1, 2].sample(random: random) }.should raise_error(RangeError)
+ -> { [1, 2].sample(random: random) }.should raise_error(RangeError)
end
it "raises a RangeError if the value is equal to the Array size" do
random = mock("array_sample_random")
random.should_receive(:rand).and_return(2)
- lambda { [1, 2].sample(random: random) }.should raise_error(RangeError)
+ -> { [1, 2].sample(random: random) }.should raise_error(RangeError)
end
end
end
@@ -140,7 +140,7 @@ describe "Array#sample" do
random = mock("array_sample_random")
random.should_receive(:rand).and_return(value)
- lambda { [1, 2].sample(random: random) }.should raise_error(RangeError)
+ -> { [1, 2].sample(random: random) }.should raise_error(RangeError)
end
it "raises a RangeError if the value is equal to the Array size" do
@@ -149,7 +149,7 @@ describe "Array#sample" do
random = mock("array_sample_random")
random.should_receive(:rand).and_return(value)
- lambda { [1, 2].sample(random: random) }.should raise_error(RangeError)
+ -> { [1, 2].sample(random: random) }.should raise_error(RangeError)
end
end
end
diff --git a/spec/ruby/core/array/shared/collect.rb b/spec/ruby/core/array/shared/collect.rb
index 8ad6e61855..80e2739893 100644
--- a/spec/ruby/core/array/shared/collect.rb
+++ b/spec/ruby/core/array/shared/collect.rb
@@ -37,7 +37,7 @@ describe :array_collect, shared: true do
it "raises an ArgumentError when no block and with arguments" do
a = [1, 2, 3]
- lambda {
+ -> {
a.send(@method, :foo)
}.should raise_error(ArgumentError)
end
@@ -111,21 +111,21 @@ describe :array_collect_b, shared: true do
describe "when frozen" do
it "raises a #{frozen_error_class}" do
- lambda { ArraySpecs.frozen_array.send(@method) {} }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.send(@method) {} }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} when empty" do
- lambda { ArraySpecs.empty_frozen_array.send(@method) {} }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.empty_frozen_array.send(@method) {} }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} when calling #each on the returned Enumerator" do
enumerator = ArraySpecs.frozen_array.send(@method)
- lambda { enumerator.each {|x| x } }.should raise_error(frozen_error_class)
+ -> { enumerator.each {|x| x } }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} when calling #each on the returned Enumerator when empty" do
enumerator = ArraySpecs.empty_frozen_array.send(@method)
- lambda { enumerator.each {|x| x } }.should raise_error(frozen_error_class)
+ -> { enumerator.each {|x| x } }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/shared/difference.rb b/spec/ruby/core/array/shared/difference.rb
index c43a6375e0..3e69050d82 100644
--- a/spec/ruby/core/array/shared/difference.rb
+++ b/spec/ruby/core/array/shared/difference.rb
@@ -27,7 +27,7 @@ describe :array_binary_difference, shared: true do
it "raises a TypeError if the argument cannot be coerced to an Array by calling #to_ary" do
obj = mock('not an array')
- lambda { [1, 2, 3].send(@method, obj) }.should raise_error(TypeError)
+ -> { [1, 2, 3].send(@method, obj) }.should raise_error(TypeError)
end
it "does not return subclass instance for Array subclasses" do
diff --git a/spec/ruby/core/array/shared/inspect.rb b/spec/ruby/core/array/shared/inspect.rb
index 1bcc9f9ca8..434440c25b 100644
--- a/spec/ruby/core/array/shared/inspect.rb
+++ b/spec/ruby/core/array/shared/inspect.rb
@@ -55,7 +55,7 @@ describe :array_inspect, shared: true do
obj.should_receive(:inspect).and_return(obj)
obj.should_receive(:to_s).and_raise(Exception)
- lambda { [obj].send(@method) }.should raise_error(Exception)
+ -> { [obj].send(@method) }.should raise_error(Exception)
end
it "represents a recursive element with '[...]'" do
diff --git a/spec/ruby/core/array/shared/join.rb b/spec/ruby/core/array/shared/join.rb
index 0d07e93b2c..38bdde9502 100644
--- a/spec/ruby/core/array/shared/join.rb
+++ b/spec/ruby/core/array/shared/join.rb
@@ -49,13 +49,13 @@ describe :array_join_with_default_separator, shared: true do
it "raises a NoMethodError if an element does not respond to #to_str, #to_ary, or #to_s" do
obj = mock('o')
class << obj; undef :to_s; end
- lambda { [1, obj].send(@method) }.should raise_error(NoMethodError)
+ -> { [1, obj].send(@method) }.should raise_error(NoMethodError)
end
it "raises an ArgumentError when the Array is recursive" do
- lambda { ArraySpecs.recursive_array.send(@method) }.should raise_error(ArgumentError)
- lambda { ArraySpecs.head_recursive_array.send(@method) }.should raise_error(ArgumentError)
- lambda { ArraySpecs.empty_recursive_array.send(@method) }.should raise_error(ArgumentError)
+ -> { ArraySpecs.recursive_array.send(@method) }.should raise_error(ArgumentError)
+ -> { ArraySpecs.head_recursive_array.send(@method) }.should raise_error(ArgumentError)
+ -> { ArraySpecs.empty_recursive_array.send(@method) }.should raise_error(ArgumentError)
end
it "taints the result if the Array is tainted and non-empty" do
@@ -109,7 +109,7 @@ describe :array_join_with_default_separator, shared: true do
it "fails for arrays with incompatibly-encoded strings" do
ary_utf8_bad_binary = ArraySpecs.array_with_utf8_and_binary_strings
- lambda { ary_utf8_bad_binary.send(@method) }.should raise_error(EncodingError)
+ -> { ary_utf8_bad_binary.send(@method) }.should raise_error(EncodingError)
end
end
diff --git a/spec/ruby/core/array/shared/keep_if.rb b/spec/ruby/core/array/shared/keep_if.rb
index 906ad9b9e2..2f1299c2b3 100644
--- a/spec/ruby/core/array/shared/keep_if.rb
+++ b/spec/ruby/core/array/shared/keep_if.rb
@@ -37,23 +37,23 @@ describe :keep_if, shared: true do
describe "with truthy block" do
it "keeps elements after any exception" do
- lambda { @frozen.send(@method) { true } }.should raise_error(Exception)
+ -> { @frozen.send(@method) { true } }.should raise_error(Exception)
@frozen.should == @origin
end
it "raises a #{frozen_error_class}" do
- lambda { @frozen.send(@method) { true } }.should raise_error(frozen_error_class)
+ -> { @frozen.send(@method) { true } }.should raise_error(frozen_error_class)
end
end
describe "with falsy block" do
it "keeps elements after any exception" do
- lambda { @frozen.send(@method) { false } }.should raise_error(Exception)
+ -> { @frozen.send(@method) { false } }.should raise_error(Exception)
@frozen.should == @origin
end
it "raises a #{frozen_error_class}" do
- lambda { @frozen.send(@method) { false } }.should raise_error(frozen_error_class)
+ -> { @frozen.send(@method) { false } }.should raise_error(frozen_error_class)
end
end
end
diff --git a/spec/ruby/core/array/shared/push.rb b/spec/ruby/core/array/shared/push.rb
index effa632890..df307073cd 100644
--- a/spec/ruby/core/array/shared/push.rb
+++ b/spec/ruby/core/array/shared/push.rb
@@ -27,7 +27,7 @@ describe :array_push, shared: true do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.send(@method, 1) }.should raise_error(frozen_error_class)
- lambda { ArraySpecs.frozen_array.send(@method) }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.send(@method, 1) }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.send(@method) }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/shared/replace.rb b/spec/ruby/core/array/shared/replace.rb
index b8dae8d33e..b3474fad09 100644
--- a/spec/ruby/core/array/shared/replace.rb
+++ b/spec/ruby/core/array/shared/replace.rb
@@ -53,7 +53,7 @@ describe :array_replace, shared: true do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda {
+ -> {
ArraySpecs.frozen_array.send(@method, ArraySpecs.frozen_array)
}.should raise_error(frozen_error_class)
end
diff --git a/spec/ruby/core/array/shared/slice.rb b/spec/ruby/core/array/shared/slice.rb
index b3f4ccb9a6..73456eb297 100644
--- a/spec/ruby/core/array/shared/slice.rb
+++ b/spec/ruby/core/array/shared/slice.rb
@@ -266,10 +266,10 @@ describe :array_slice, shared: true do
a.send(@method, 1..0).should == []
a.send(@method, 1...0).should == []
- lambda { a.send(@method, "a" .. "b") }.should raise_error(TypeError)
- lambda { a.send(@method, "a" ... "b") }.should raise_error(TypeError)
- lambda { a.send(@method, from .. "b") }.should raise_error(TypeError)
- lambda { a.send(@method, from ... "b") }.should raise_error(TypeError)
+ -> { a.send(@method, "a" .. "b") }.should raise_error(TypeError)
+ -> { a.send(@method, "a" ... "b") }.should raise_error(TypeError)
+ -> { a.send(@method, from .. "b") }.should raise_error(TypeError)
+ -> { a.send(@method, from ... "b") }.should raise_error(TypeError)
end
it "returns the same elements as [m..n] and [m...n] with Range subclasses" do
@@ -441,19 +441,19 @@ describe :array_slice, shared: true do
array = [1, 2, 3, 4, 5, 6]
obj = mock('large value')
obj.should_receive(:to_int).and_return(0x8000_0000_0000_0000_0000)
- lambda { array.send(@method, obj) }.should raise_error(RangeError)
+ -> { array.send(@method, obj) }.should raise_error(RangeError)
obj = 8e19
- lambda { array.send(@method, obj) }.should raise_error(RangeError)
+ -> { array.send(@method, obj) }.should raise_error(RangeError)
end
it "raises a RangeError when the length is out of range of Fixnum" do
array = [1, 2, 3, 4, 5, 6]
obj = mock('large value')
obj.should_receive(:to_int).and_return(0x8000_0000_0000_0000_0000)
- lambda { array.send(@method, 1, obj) }.should raise_error(RangeError)
+ -> { array.send(@method, 1, obj) }.should raise_error(RangeError)
obj = 8e19
- lambda { array.send(@method, 1, obj) }.should raise_error(RangeError)
+ -> { array.send(@method, 1, obj) }.should raise_error(RangeError)
end
end
diff --git a/spec/ruby/core/array/shared/unshift.rb b/spec/ruby/core/array/shared/unshift.rb
index d7464cdaca..be62084e95 100644
--- a/spec/ruby/core/array/shared/unshift.rb
+++ b/spec/ruby/core/array/shared/unshift.rb
@@ -36,11 +36,11 @@ describe :array_unshift, shared: true do
end
it "raises a #{frozen_error_class} on a frozen array when the array is modified" do
- lambda { ArraySpecs.frozen_array.send(@method, 1) }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.send(@method, 1) }.should raise_error(frozen_error_class)
end
# see [ruby-core:23666]
it "raises a #{frozen_error_class} on a frozen array when the array would not be modified" do
- lambda { ArraySpecs.frozen_array.send(@method) }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.send(@method) }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/shift_spec.rb b/spec/ruby/core/array/shift_spec.rb
index 26bce8aeb3..ef3c9fe1cd 100644
--- a/spec/ruby/core/array/shift_spec.rb
+++ b/spec/ruby/core/array/shift_spec.rb
@@ -31,10 +31,10 @@ describe "Array#shift" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.shift }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.shift }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} on an empty frozen array" do
- lambda { ArraySpecs.empty_frozen_array.shift }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.empty_frozen_array.shift }.should raise_error(frozen_error_class)
end
describe "passed a number n as an argument" do
@@ -90,7 +90,7 @@ describe "Array#shift" do
end
it "raises an ArgumentError if n is negative" do
- lambda{ [1, 2, 3].shift(-1) }.should raise_error(ArgumentError)
+ ->{ [1, 2, 3].shift(-1) }.should raise_error(ArgumentError)
end
it "tries to convert n to an Integer using #to_int" do
@@ -105,12 +105,12 @@ describe "Array#shift" do
end
it "raises a TypeError when the passed n cannot be coerced to Integer" do
- lambda{ [1, 2].shift("cat") }.should raise_error(TypeError)
- lambda{ [1, 2].shift(nil) }.should raise_error(TypeError)
+ ->{ [1, 2].shift("cat") }.should raise_error(TypeError)
+ ->{ [1, 2].shift(nil) }.should raise_error(TypeError)
end
it "raises an ArgumentError if more arguments are passed" do
- lambda{ [1, 2].shift(1, 2) }.should raise_error(ArgumentError)
+ ->{ [1, 2].shift(1, 2) }.should raise_error(ArgumentError)
end
it "does not return subclass instances with Array subclass" do
diff --git a/spec/ruby/core/array/shuffle_spec.rb b/spec/ruby/core/array/shuffle_spec.rb
index 4f793acf19..7a2fed7d50 100644
--- a/spec/ruby/core/array/shuffle_spec.rb
+++ b/spec/ruby/core/array/shuffle_spec.rb
@@ -43,7 +43,7 @@ describe "Array#shuffle" do
it "raises a NoMethodError if an object passed for the RNG does not define #rand" do
obj = BasicObject.new
- lambda { [1, 2].shuffle(random: obj) }.should raise_error(NoMethodError)
+ -> { [1, 2].shuffle(random: obj) }.should raise_error(NoMethodError)
end
it "accepts a Float for the value returned by #rand" do
@@ -68,7 +68,7 @@ describe "Array#shuffle" do
random = mock("array_shuffle_random")
random.should_receive(:rand).and_return(value)
- lambda { [1, 2].shuffle(random: random) }.should raise_error(RangeError)
+ -> { [1, 2].shuffle(random: random) }.should raise_error(RangeError)
end
it "raises a RangeError if the value is equal to one" do
@@ -77,7 +77,7 @@ describe "Array#shuffle" do
random = mock("array_shuffle_random")
random.should_receive(:rand).at_least(1).times.and_return(value)
- lambda { [1, 2].shuffle(random: random) }.should raise_error(RangeError)
+ -> { [1, 2].shuffle(random: random) }.should raise_error(RangeError)
end
end
@@ -96,7 +96,7 @@ describe "Array#shuffle!" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.shuffle! }.should raise_error(frozen_error_class)
- lambda { ArraySpecs.empty_frozen_array.shuffle! }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.shuffle! }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.empty_frozen_array.shuffle! }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/slice_spec.rb b/spec/ruby/core/array/slice_spec.rb
index cd16b3892c..16220bdf0d 100644
--- a/spec/ruby/core/array/slice_spec.rb
+++ b/spec/ruby/core/array/slice_spec.rb
@@ -116,8 +116,8 @@ describe "Array#slice!" do
a.slice!(from .. to).should == [2, 3, 4]
a.should == [1, 5]
- lambda { a.slice!("a" .. "b") }.should raise_error(TypeError)
- lambda { a.slice!(from .. "b") }.should raise_error(TypeError)
+ -> { a.slice!("a" .. "b") }.should raise_error(TypeError)
+ -> { a.slice!(from .. "b") }.should raise_error(TypeError)
end
it "returns last element for consecutive calls at zero index" do
@@ -151,7 +151,7 @@ describe "Array#slice!" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.slice!(0, 0) }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.slice!(0, 0) }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/sort_by_spec.rb b/spec/ruby/core/array/sort_by_spec.rb
index 6428194dfb..045051d307 100644
--- a/spec/ruby/core/array/sort_by_spec.rb
+++ b/spec/ruby/core/array/sort_by_spec.rb
@@ -24,11 +24,11 @@ describe "Array#sort_by!" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.sort_by! {}}.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.sort_by! {}}.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} on an empty frozen array" do
- lambda { ArraySpecs.empty_frozen_array.sort_by! {}}.should raise_error(frozen_error_class)
+ -> { ArraySpecs.empty_frozen_array.sort_by! {}}.should raise_error(frozen_error_class)
end
it "returns the specified value when it would break in the given block" do
diff --git a/spec/ruby/core/array/sort_spec.rb b/spec/ruby/core/array/sort_spec.rb
index c0d6628549..6b84a82a48 100644
--- a/spec/ruby/core/array/sort_spec.rb
+++ b/spec/ruby/core/array/sort_spec.rb
@@ -66,7 +66,7 @@ describe "Array#sort" do
it "does not deal with exceptions raised by unimplemented or incorrect #<=>" do
o = Object.new
- lambda {
+ -> {
[o, 1].sort
}.should raise_error(ArgumentError)
end
@@ -78,7 +78,7 @@ describe "Array#sort" do
end
it "raises an error when a given block returns nil" do
- lambda { [1, 2].sort {} }.should raise_error(ArgumentError)
+ -> { [1, 2].sort {} }.should raise_error(ArgumentError)
end
it "does not call #<=> on contained objects when invoked with a block" do
@@ -134,7 +134,7 @@ describe "Array#sort" do
a.sort { |n, m|
ArraySpecs::ComparableWithFixnum.new(n-m)
}.should == [-4, 1, 2, 5, 7, 10, 12]
- lambda {
+ -> {
a.sort { |n, m| (n - m).to_s }
}.should raise_error(ArgumentError)
end
@@ -155,7 +155,7 @@ describe "Array#sort" do
it "raises an error if objects can't be compared" do
a=[ArraySpecs::Uncomparable.new, ArraySpecs::Uncomparable.new]
- lambda {a.sort}.should raise_error(ArgumentError)
+ -> {a.sort}.should raise_error(ArgumentError)
end
# From a strange Rubinius bug
@@ -234,7 +234,7 @@ describe "Array#sort!" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.sort! }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.sort! }.should raise_error(frozen_error_class)
end
it "returns the specified value when it would break in the given block" do
diff --git a/spec/ruby/core/array/sum_spec.rb b/spec/ruby/core/array/sum_spec.rb
index a7e77d8c2e..39c769d328 100644
--- a/spec/ruby/core/array/sum_spec.rb
+++ b/spec/ruby/core/array/sum_spec.rb
@@ -26,11 +26,11 @@ describe "Array#sum" do
end
it 'raises TypeError if any element are not numeric' do
- lambda { ["a"].sum }.should raise_error(TypeError)
+ -> { ["a"].sum }.should raise_error(TypeError)
end
it 'raises TypeError if any element cannot be added to init value' do
- lambda { [1].sum([]) }.should raise_error(TypeError)
+ -> { [1].sum([]) }.should raise_error(TypeError)
end
it "calls + to sum the elements" do
diff --git a/spec/ruby/core/array/take_spec.rb b/spec/ruby/core/array/take_spec.rb
index 2c9e3f5cfe..0de99b0a7e 100644
--- a/spec/ruby/core/array/take_spec.rb
+++ b/spec/ruby/core/array/take_spec.rb
@@ -22,6 +22,6 @@ describe "Array#take" do
end
it "raises an ArgumentError when the argument is negative" do
- lambda{ [1].take(-3) }.should raise_error(ArgumentError)
+ ->{ [1].take(-3) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/array/to_h_spec.rb b/spec/ruby/core/array/to_h_spec.rb
index 4431430216..46a79ba58b 100644
--- a/spec/ruby/core/array/to_h_spec.rb
+++ b/spec/ruby/core/array/to_h_spec.rb
@@ -24,15 +24,15 @@ describe "Array#to_h" do
end
it "raises TypeError if an element is not an array" do
- lambda { [:x].to_h }.should raise_error(TypeError)
+ -> { [:x].to_h }.should raise_error(TypeError)
end
it "raises ArgumentError if an element is not a [key, value] pair" do
- lambda { [[:x]].to_h }.should raise_error(ArgumentError)
+ -> { [[:x]].to_h }.should raise_error(ArgumentError)
end
it "does not accept arguments" do
- lambda { [].to_h(:a, :b) }.should raise_error(ArgumentError)
+ -> { [].to_h(:a, :b) }.should raise_error(ArgumentError)
end
it "produces a hash that returns nil for a missing element" do
diff --git a/spec/ruby/core/array/transpose_spec.rb b/spec/ruby/core/array/transpose_spec.rb
index c7bd7e7338..b39077f4c9 100644
--- a/spec/ruby/core/array/transpose_spec.rb
+++ b/spec/ruby/core/array/transpose_spec.rb
@@ -32,7 +32,7 @@ describe "Array#transpose" do
end
it "raises a TypeError if the passed Argument does not respond to #to_ary" do
- lambda { [Object.new, [:a, :b]].transpose }.should raise_error(TypeError)
+ -> { [Object.new, [:a, :b]].transpose }.should raise_error(TypeError)
end
it "does not call to_ary on array subclass elements" do
@@ -41,7 +41,7 @@ describe "Array#transpose" do
end
it "raises an IndexError if the arrays are not of the same length" do
- lambda { [[1, 2], [:a]].transpose }.should raise_error(IndexError)
+ -> { [[1, 2], [:a]].transpose }.should raise_error(IndexError)
end
it "does not return subclass instance on Array subclasses" do
diff --git a/spec/ruby/core/array/try_convert_spec.rb b/spec/ruby/core/array/try_convert_spec.rb
index 5f653b6807..47b4722d80 100644
--- a/spec/ruby/core/array/try_convert_spec.rb
+++ b/spec/ruby/core/array/try_convert_spec.rb
@@ -39,12 +39,12 @@ describe "Array.try_convert" do
it "sends #to_ary to the argument and raises TypeError if it's not a kind of Array" do
obj = mock("to_ary")
obj.should_receive(:to_ary).and_return(Object.new)
- lambda { Array.try_convert obj }.should raise_error(TypeError)
+ -> { Array.try_convert obj }.should raise_error(TypeError)
end
it "does not rescue exceptions raised by #to_ary" do
obj = mock("to_ary")
obj.should_receive(:to_ary).and_raise(RuntimeError)
- lambda { Array.try_convert obj }.should raise_error(RuntimeError)
+ -> { Array.try_convert obj }.should raise_error(RuntimeError)
end
end
diff --git a/spec/ruby/core/array/uniq_spec.rb b/spec/ruby/core/array/uniq_spec.rb
index 471717b8e2..c9bdd3dacd 100644
--- a/spec/ruby/core/array/uniq_spec.rb
+++ b/spec/ruby/core/array/uniq_spec.rb
@@ -191,17 +191,17 @@ describe "Array#uniq!" do
it "raises a #{frozen_error_class} on a frozen array when the array is modified" do
dup_ary = [1, 1, 2]
dup_ary.freeze
- lambda { dup_ary.uniq! }.should raise_error(frozen_error_class)
+ -> { dup_ary.uniq! }.should raise_error(frozen_error_class)
end
# see [ruby-core:23666]
it "raises a #{frozen_error_class} on a frozen array when the array would not be modified" do
- lambda { ArraySpecs.frozen_array.uniq!}.should raise_error(frozen_error_class)
- lambda { ArraySpecs.empty_frozen_array.uniq!}.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.uniq!}.should raise_error(frozen_error_class)
+ -> { ArraySpecs.empty_frozen_array.uniq!}.should raise_error(frozen_error_class)
end
it "doesn't yield to the block on a frozen array" do
- lambda { ArraySpecs.frozen_array.uniq!{ raise RangeError, "shouldn't yield"}}.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.uniq!{ raise RangeError, "shouldn't yield"}}.should raise_error(frozen_error_class)
end
it "compares elements based on the value returned from the block" do
diff --git a/spec/ruby/core/basicobject/basicobject_spec.rb b/spec/ruby/core/basicobject/basicobject_spec.rb
index ccaa9c8593..27a322e72c 100644
--- a/spec/ruby/core/basicobject/basicobject_spec.rb
+++ b/spec/ruby/core/basicobject/basicobject_spec.rb
@@ -8,7 +8,7 @@ describe "BasicObject" do
end
it "raises NameError when referencing built-in constants" do
- lambda { class BasicObjectSpecs::BOSubclass; Kernel; end }.should raise_error(NameError)
+ -> { class BasicObjectSpecs::BOSubclass; Kernel; end }.should raise_error(NameError)
end
it "does not define built-in constants (according to const_defined?)" do
@@ -85,7 +85,7 @@ describe "BasicObject subclass" do
describe "BasicObject references" do
it "can refer to BasicObject from within itself" do
- lambda { BasicObject::BasicObject }.should_not raise_error
+ -> { BasicObject::BasicObject }.should_not raise_error
end
end
end
diff --git a/spec/ruby/core/basicobject/initialize_spec.rb b/spec/ruby/core/basicobject/initialize_spec.rb
index 0266496856..b7ce73ffd5 100644
--- a/spec/ruby/core/basicobject/initialize_spec.rb
+++ b/spec/ruby/core/basicobject/initialize_spec.rb
@@ -6,7 +6,7 @@ describe "BasicObject#initialize" do
end
it "does not accept arguments" do
- lambda {
+ -> {
BasicObject.new("This", "makes it easier", "to call super", "from other constructors")
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/core/basicobject/instance_eval_spec.rb b/spec/ruby/core/basicobject/instance_eval_spec.rb
index 24b4d6dc69..d3dd05b745 100644
--- a/spec/ruby/core/basicobject/instance_eval_spec.rb
+++ b/spec/ruby/core/basicobject/instance_eval_spec.rb
@@ -21,11 +21,11 @@ describe "BasicObject#instance_eval" do
end
it "expects a block with no arguments" do
- lambda { "hola".instance_eval }.should raise_error(ArgumentError)
+ -> { "hola".instance_eval }.should raise_error(ArgumentError)
end
it "takes no arguments with a block" do
- lambda { "hola".instance_eval(4, 5) {|a,b| a + b } }.should raise_error(ArgumentError)
+ -> { "hola".instance_eval(4, 5) {|a,b| a + b } }.should raise_error(ArgumentError)
end
it "yields the object to the block" do
@@ -45,7 +45,7 @@ describe "BasicObject#instance_eval" do
end
end
f.foo.should == 1
- lambda { Object.new.foo }.should raise_error(NoMethodError)
+ -> { Object.new.foo }.should raise_error(NoMethodError)
end
it "preserves self in the original block when passed a block argument" do
@@ -122,10 +122,10 @@ describe "BasicObject#instance_eval" do
end
it "raises a TypeError when defining methods on an immediate" do
- lambda do
+ -> do
1.instance_eval { def foo; end }
end.should raise_error(TypeError)
- lambda do
+ -> do
:foo.instance_eval { def foo; end }
end.should raise_error(TypeError)
end
@@ -143,10 +143,10 @@ quarantine! do # Not clean, leaves cvars lying around to break other specs
end
it "raises a TypeError when defining methods on numerics" do
- lambda do
+ -> do
(1.0).instance_eval { def foo; end }
end.should raise_error(TypeError)
- lambda do
+ -> do
(1 << 64).instance_eval { def foo; end }
end.should raise_error(TypeError)
end
diff --git a/spec/ruby/core/basicobject/instance_exec_spec.rb b/spec/ruby/core/basicobject/instance_exec_spec.rb
index 33c6b5a1d3..e25482d58a 100644
--- a/spec/ruby/core/basicobject/instance_exec_spec.rb
+++ b/spec/ruby/core/basicobject/instance_exec_spec.rb
@@ -17,7 +17,7 @@ describe "BasicObject#instance_exec" do
end
it "raises a LocalJumpError unless given a block" do
- lambda { "hola".instance_exec }.should raise_error(LocalJumpError)
+ -> { "hola".instance_exec }.should raise_error(LocalJumpError)
end
it "has an arity of -1" do
@@ -25,7 +25,7 @@ describe "BasicObject#instance_exec" do
end
it "accepts arguments with a block" do
- lambda { "hola".instance_exec(4, 5) { |a,b| a + b } }.should_not raise_error
+ -> { "hola".instance_exec(4, 5) { |a,b| a + b } }.should_not raise_error
end
it "doesn't pass self to the block as an argument" do
@@ -44,7 +44,7 @@ describe "BasicObject#instance_exec" do
end
end
f.foo.should == 1
- lambda { Object.new.foo }.should raise_error(NoMethodError)
+ -> { Object.new.foo }.should raise_error(NoMethodError)
end
# TODO: This should probably be replaced with a "should behave like" that uses
@@ -76,10 +76,10 @@ describe "BasicObject#instance_exec" do
end
it "raises a TypeError when defining methods on an immediate" do
- lambda do
+ -> do
1.instance_exec { def foo; end }
end.should raise_error(TypeError)
- lambda do
+ -> do
:foo.instance_exec { def foo; end }
end.should raise_error(TypeError)
end
@@ -97,10 +97,10 @@ quarantine! do # Not clean, leaves cvars lying around to break other specs
end
it "raises a TypeError when defining methods on numerics" do
- lambda do
+ -> do
(1.0).instance_exec { def foo; end }
end.should raise_error(TypeError)
- lambda do
+ -> do
(1 << 64).instance_exec { def foo; end }
end.should raise_error(TypeError)
end
diff --git a/spec/ruby/core/binding/local_variable_defined_spec.rb b/spec/ruby/core/binding/local_variable_defined_spec.rb
index 7b48257294..2fc6504ee5 100644
--- a/spec/ruby/core/binding/local_variable_defined_spec.rb
+++ b/spec/ruby/core/binding/local_variable_defined_spec.rb
@@ -26,7 +26,7 @@ describe 'Binding#local_variable_defined?' do
it 'returns true when a local variable is defined in a parent scope' do
foo = 10
- lambda {
+ -> {
binding.local_variable_defined?(:foo)
}.call.should == true
end
diff --git a/spec/ruby/core/binding/local_variable_get_spec.rb b/spec/ruby/core/binding/local_variable_get_spec.rb
index eeb3ae44ed..005670becc 100644
--- a/spec/ruby/core/binding/local_variable_get_spec.rb
+++ b/spec/ruby/core/binding/local_variable_get_spec.rb
@@ -11,7 +11,7 @@ describe "Binding#local_variable_get" do
it "raises a NameError for missing variables" do
bind = BindingSpecs::Demo.new(1).get_empty_binding
- lambda {
+ -> {
bind.local_variable_get(:no_such_variable)
}.should raise_error(NameError)
end
@@ -19,7 +19,7 @@ describe "Binding#local_variable_get" do
it "reads variables added later to the binding" do
bind = BindingSpecs::Demo.new(1).get_empty_binding
- lambda {
+ -> {
bind.local_variable_get(:a)
}.should raise_error(NameError)
@@ -31,7 +31,7 @@ describe "Binding#local_variable_get" do
it 'gets a local variable defined in a parent scope' do
number = 10
- lambda {
+ -> {
binding.local_variable_get(:number)
}.call.should == 10
end
@@ -45,12 +45,12 @@ describe "Binding#local_variable_get" do
it "raises a NameError on global access" do
bind = binding
- lambda { bind.local_variable_get(:$0) }.should raise_error(NameError)
+ -> { bind.local_variable_get(:$0) }.should raise_error(NameError)
end
it "raises a NameError on special variable access" do
bind = binding
- lambda { bind.local_variable_get(:$~) }.should raise_error(NameError)
- lambda { bind.local_variable_get(:$_) }.should raise_error(NameError)
+ -> { bind.local_variable_get(:$~) }.should raise_error(NameError)
+ -> { bind.local_variable_get(:$_) }.should raise_error(NameError)
end
end
diff --git a/spec/ruby/core/binding/local_variable_set_spec.rb b/spec/ruby/core/binding/local_variable_set_spec.rb
index 035e9a3c2e..1456c6dda1 100644
--- a/spec/ruby/core/binding/local_variable_set_spec.rb
+++ b/spec/ruby/core/binding/local_variable_set_spec.rb
@@ -38,7 +38,7 @@ describe "Binding#local_variable_set" do
bind = binding
bind.local_variable_set(:number, 10)
- lambda { number }.should raise_error(NameError)
+ -> { number }.should raise_error(NameError)
end
it 'overwrites an existing local variable defined before a Binding' do
@@ -59,13 +59,13 @@ describe "Binding#local_variable_set" do
it "raises a NameError on global access" do
bind = binding
- lambda { bind.local_variable_set(:$0, "") }.should raise_error(NameError)
+ -> { bind.local_variable_set(:$0, "") }.should raise_error(NameError)
end
it "raises a NameError on special variable access" do
bind = binding
- lambda { bind.local_variable_set(:$~, "") }.should raise_error(NameError)
- lambda { bind.local_variable_set(:$_, "") }.should raise_error(NameError)
+ -> { bind.local_variable_set(:$~, "") }.should raise_error(NameError)
+ -> { bind.local_variable_set(:$_, "") }.should raise_error(NameError)
end
end
diff --git a/spec/ruby/core/class/allocate_spec.rb b/spec/ruby/core/class/allocate_spec.rb
index 4cf5665392..c426c38ff9 100644
--- a/spec/ruby/core/class/allocate_spec.rb
+++ b/spec/ruby/core/class/allocate_spec.rb
@@ -14,7 +14,7 @@ describe "Class#allocate" do
it "throws an exception when calling a method on a new instance" do
klass = Class.allocate
- lambda do
+ -> do
klass.new
end.should raise_error(Exception)
end
@@ -34,7 +34,7 @@ describe "Class#allocate" do
end
it "raises TypeError for #superclass" do
- lambda do
+ -> do
Class.allocate.superclass
end.should raise_error(TypeError)
end
diff --git a/spec/ruby/core/class/inherited_spec.rb b/spec/ruby/core/class/inherited_spec.rb
index fb7fb8e75a..8ef8bb8c35 100644
--- a/spec/ruby/core/class/inherited_spec.rb
+++ b/spec/ruby/core/class/inherited_spec.rb
@@ -92,10 +92,10 @@ describe "Class.inherited" do
end
class << top; private :inherited; end
- lambda { Class.new(top) }.should_not raise_error
+ -> { Class.new(top) }.should_not raise_error
class << top; protected :inherited; end
- lambda { Class.new(top) }.should_not raise_error
+ -> { Class.new(top) }.should_not raise_error
end
end
diff --git a/spec/ruby/core/class/initialize_spec.rb b/spec/ruby/core/class/initialize_spec.rb
index 88a9fcfa7a..9678d7b373 100644
--- a/spec/ruby/core/class/initialize_spec.rb
+++ b/spec/ruby/core/class/initialize_spec.rb
@@ -6,18 +6,18 @@ describe "Class#initialize" do
end
it "raises a TypeError when called on already initialized classes" do
- lambda{
+ ->{
Fixnum.send :initialize
}.should raise_error(TypeError)
- lambda{
+ ->{
Object.send :initialize
}.should raise_error(TypeError)
end
# See [redmine:2601]
it "raises a TypeError when called on BasicObject" do
- lambda{
+ ->{
BasicObject.send :initialize
}.should raise_error(TypeError)
end
@@ -28,7 +28,7 @@ describe "Class#initialize" do
end
it "raises a TypeError" do
- lambda{@uninitialized.send(:initialize, Class)}.should raise_error(TypeError)
+ ->{@uninitialized.send(:initialize, Class)}.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/core/class/new_spec.rb b/spec/ruby/core/class/new_spec.rb
index 7f7ec183ea..8191ce6a37 100644
--- a/spec/ruby/core/class/new_spec.rb
+++ b/spec/ruby/core/class/new_spec.rb
@@ -70,7 +70,7 @@ describe "Class.new" do
it "raises a TypeError if passed a metaclass" do
obj = mock("Class.new metaclass")
meta = obj.singleton_class
- lambda { Class.new meta }.should raise_error(TypeError)
+ -> { Class.new meta }.should raise_error(TypeError)
end
it "creates a class without a name" do
@@ -96,11 +96,11 @@ describe "Class.new" do
it "raises a TypeError when given a non-Class" do
error_msg = /superclass must be a Class/
- lambda { Class.new("") }.should raise_error(TypeError, error_msg)
- lambda { Class.new(1) }.should raise_error(TypeError, error_msg)
- lambda { Class.new(:symbol) }.should raise_error(TypeError, error_msg)
- lambda { Class.new(mock('o')) }.should raise_error(TypeError, error_msg)
- lambda { Class.new(Module.new) }.should raise_error(TypeError, error_msg)
+ -> { Class.new("") }.should raise_error(TypeError, error_msg)
+ -> { Class.new(1) }.should raise_error(TypeError, error_msg)
+ -> { Class.new(:symbol) }.should raise_error(TypeError, error_msg)
+ -> { Class.new(mock('o')) }.should raise_error(TypeError, error_msg)
+ -> { Class.new(Module.new) }.should raise_error(TypeError, error_msg)
end
end
diff --git a/spec/ruby/core/comparable/clamp_spec.rb b/spec/ruby/core/comparable/clamp_spec.rb
index d3f1022499..6d216220d4 100644
--- a/spec/ruby/core/comparable/clamp_spec.rb
+++ b/spec/ruby/core/comparable/clamp_spec.rb
@@ -4,8 +4,8 @@ require_relative 'fixtures/classes'
describe 'Comparable#clamp' do
it 'raises an Argument error unless given 2 parameters' do
c = ComparableSpecs::Weird.new(0)
- lambda { c.clamp(c) }.should raise_error(ArgumentError)
- lambda { c.clamp(c, c, c) }.should raise_error(ArgumentError)
+ -> { c.clamp(c) }.should raise_error(ArgumentError)
+ -> { c.clamp(c, c, c) }.should raise_error(ArgumentError)
end
it 'raises an Argument error unless the 2 parameters are correctly ordered' do
@@ -13,9 +13,9 @@ describe 'Comparable#clamp' do
two = ComparableSpecs::WithOnlyCompareDefined.new(2)
c = ComparableSpecs::Weird.new(3)
- lambda { c.clamp(two, one) }.should raise_error(ArgumentError)
+ -> { c.clamp(two, one) }.should raise_error(ArgumentError)
one.should_receive(:<=>).any_number_of_times.and_return(nil)
- lambda { c.clamp(one, two) }.should raise_error(ArgumentError)
+ -> { c.clamp(one, two) }.should raise_error(ArgumentError)
end
it 'returns self if within the given parameters' do
diff --git a/spec/ruby/core/comparable/equal_value_spec.rb b/spec/ruby/core/comparable/equal_value_spec.rb
index 53c83aa2d3..ddcc03cb41 100644
--- a/spec/ruby/core/comparable/equal_value_spec.rb
+++ b/spec/ruby/core/comparable/equal_value_spec.rb
@@ -49,7 +49,7 @@ describe "Comparable#==" do
end
it "raises an ArgumentError" do
- lambda { (a == b) }.should raise_error(ArgumentError)
+ -> { (a == b) }.should raise_error(ArgumentError)
end
end
@@ -60,7 +60,7 @@ describe "Comparable#==" do
end
it "lets it go through" do
- lambda { (a == b) }.should raise_error(StandardError)
+ -> { (a == b) }.should raise_error(StandardError)
end
end
@@ -71,13 +71,13 @@ describe "Comparable#==" do
end
it "lets it go through" do
- lambda { (a == b) }.should raise_error(TypeError)
+ -> { (a == b) }.should raise_error(TypeError)
end
end
it "lets it go through if it is not a StandardError" do
a.should_receive(:<=>).once.and_raise(Exception)
- lambda { (a == b) }.should raise_error(Exception)
+ -> { (a == b) }.should raise_error(Exception)
end
end
diff --git a/spec/ruby/core/comparable/gt_spec.rb b/spec/ruby/core/comparable/gt_spec.rb
index 6dd661bbfa..150e653dc7 100644
--- a/spec/ruby/core/comparable/gt_spec.rb
+++ b/spec/ruby/core/comparable/gt_spec.rb
@@ -38,6 +38,6 @@ describe "Comparable#>" do
b = ComparableSpecs::Weird.new(20)
a.should_receive(:<=>).any_number_of_times.and_return(nil)
- lambda { (a > b) }.should raise_error(ArgumentError)
+ -> { (a > b) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/comparable/gte_spec.rb b/spec/ruby/core/comparable/gte_spec.rb
index cdaeb60843..328f58c66c 100644
--- a/spec/ruby/core/comparable/gte_spec.rb
+++ b/spec/ruby/core/comparable/gte_spec.rb
@@ -42,6 +42,6 @@ describe "Comparable#>=" do
b = ComparableSpecs::Weird.new(20)
a.should_receive(:<=>).any_number_of_times.and_return(nil)
- lambda { (a >= b) }.should raise_error(ArgumentError)
+ -> { (a >= b) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/comparable/lt_spec.rb b/spec/ruby/core/comparable/lt_spec.rb
index 02f77dba50..4db92719e2 100644
--- a/spec/ruby/core/comparable/lt_spec.rb
+++ b/spec/ruby/core/comparable/lt_spec.rb
@@ -38,6 +38,6 @@ describe "Comparable#<" do
b = ComparableSpecs::Weird.new(20)
a.should_receive(:<=>).any_number_of_times.and_return(nil)
- lambda { (a < b) }.should raise_error(ArgumentError)
+ -> { (a < b) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/comparable/lte_spec.rb b/spec/ruby/core/comparable/lte_spec.rb
index baf2c57229..b5cb9cc4e7 100644
--- a/spec/ruby/core/comparable/lte_spec.rb
+++ b/spec/ruby/core/comparable/lte_spec.rb
@@ -41,6 +41,6 @@ describe "Comparable#<=" do
b = ComparableSpecs::Weird.new(20)
a.should_receive(:<=>).any_number_of_times.and_return(nil)
- lambda { (a <= b) }.should raise_error(ArgumentError)
+ -> { (a <= b) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/complex/coerce_spec.rb b/spec/ruby/core/complex/coerce_spec.rb
index ce2fb36b73..a30a6c1d5f 100644
--- a/spec/ruby/core/complex/coerce_spec.rb
+++ b/spec/ruby/core/complex/coerce_spec.rb
@@ -53,18 +53,18 @@ describe "Complex#coerce" do
it "raises TypeError when other is a Numeric which responds to #real? with false" do
other = mock_numeric('other')
other.should_receive(:real?).any_number_of_times.and_return(false)
- lambda { @one.coerce(other) }.should raise_error(TypeError)
+ -> { @one.coerce(other) }.should raise_error(TypeError)
end
it "raises a TypeError when other is a String" do
- lambda { @one.coerce("20") }.should raise_error(TypeError)
+ -> { @one.coerce("20") }.should raise_error(TypeError)
end
it "raises a TypeError when other is nil" do
- lambda { @one.coerce(nil) }.should raise_error(TypeError)
+ -> { @one.coerce(nil) }.should raise_error(TypeError)
end
it "raises a TypeError when other is false" do
- lambda { @one.coerce(false) }.should raise_error(TypeError)
+ -> { @one.coerce(false) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/complex/fdiv_spec.rb b/spec/ruby/core/complex/fdiv_spec.rb
index 20d2f41354..68f7d1b309 100644
--- a/spec/ruby/core/complex/fdiv_spec.rb
+++ b/spec/ruby/core/complex/fdiv_spec.rb
@@ -2,21 +2,21 @@ require_relative '../../spec_helper'
describe "Complex#fdiv" do
it "accepts a numeric argument" do
- lambda { Complex(20).fdiv(2) }.should_not raise_error(TypeError)
- lambda { Complex(20).fdiv(2.0) }.should_not raise_error(TypeError)
- lambda { Complex(20).fdiv(bignum_value) }.should_not raise_error(TypeError)
+ -> { Complex(20).fdiv(2) }.should_not raise_error(TypeError)
+ -> { Complex(20).fdiv(2.0) }.should_not raise_error(TypeError)
+ -> { Complex(20).fdiv(bignum_value) }.should_not raise_error(TypeError)
end
it "accepts a negative numeric argument" do
- lambda { Complex(20).fdiv(-2) }.should_not raise_error(TypeError)
- lambda { Complex(20).fdiv(-2.0) }.should_not raise_error(TypeError)
- lambda { Complex(20).fdiv(-bignum_value) }.should_not raise_error(TypeError)
+ -> { Complex(20).fdiv(-2) }.should_not raise_error(TypeError)
+ -> { Complex(20).fdiv(-2.0) }.should_not raise_error(TypeError)
+ -> { Complex(20).fdiv(-bignum_value) }.should_not raise_error(TypeError)
end
it "raises a TypeError if passed a non-numeric argument" do
- lambda { Complex(20).fdiv([]) }.should raise_error(TypeError)
- lambda { Complex(20).fdiv(:sym) }.should raise_error(TypeError)
- lambda { Complex(20).fdiv('s') }.should raise_error(TypeError)
+ -> { Complex(20).fdiv([]) }.should raise_error(TypeError)
+ -> { Complex(20).fdiv(:sym) }.should raise_error(TypeError)
+ -> { Complex(20).fdiv('s') }.should raise_error(TypeError)
end
it "sets the real part to NaN if self's real part is NaN" do
diff --git a/spec/ruby/core/complex/negative_spec.rb b/spec/ruby/core/complex/negative_spec.rb
index 1ea5392f39..62ab89c04a 100644
--- a/spec/ruby/core/complex/negative_spec.rb
+++ b/spec/ruby/core/complex/negative_spec.rb
@@ -6,7 +6,7 @@ describe "Complex#negative?" do
c.methods.should_not include(:negative?)
- lambda {
+ -> {
c.negative?
}.should raise_error(NoMethodError)
end
diff --git a/spec/ruby/core/complex/polar_spec.rb b/spec/ruby/core/complex/polar_spec.rb
index f9d28b8388..2a5d8ebd69 100644
--- a/spec/ruby/core/complex/polar_spec.rb
+++ b/spec/ruby/core/complex/polar_spec.rb
@@ -7,8 +7,8 @@ describe "Complex.polar" do
end
it "raises a TypeError when given non real arguments" do
- lambda{ Complex.polar(nil) }.should raise_error(TypeError)
- lambda{ Complex.polar(nil, nil) }.should raise_error(TypeError)
+ ->{ Complex.polar(nil) }.should raise_error(TypeError)
+ ->{ Complex.polar(nil, nil) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/complex/positive_spec.rb b/spec/ruby/core/complex/positive_spec.rb
index eea0af3755..f1bad8608c 100644
--- a/spec/ruby/core/complex/positive_spec.rb
+++ b/spec/ruby/core/complex/positive_spec.rb
@@ -6,7 +6,7 @@ describe "Complex#positive?" do
c.methods.should_not include(:positive?)
- lambda {
+ -> {
c.positive?
}.should raise_error(NoMethodError)
end
diff --git a/spec/ruby/core/complex/rationalize_spec.rb b/spec/ruby/core/complex/rationalize_spec.rb
index 165f3d2700..043b8ddf2a 100644
--- a/spec/ruby/core/complex/rationalize_spec.rb
+++ b/spec/ruby/core/complex/rationalize_spec.rb
@@ -2,11 +2,11 @@ require_relative '../../spec_helper'
describe "Complex#rationalize" do
it "raises RangeError if self has non-zero imaginary part" do
- lambda { Complex(1,5).rationalize }.should raise_error(RangeError)
+ -> { Complex(1,5).rationalize }.should raise_error(RangeError)
end
it "raises RangeError if self has 0.0 imaginary part" do
- lambda { Complex(1,0.0).rationalize }.should raise_error(RangeError)
+ -> { Complex(1,0.0).rationalize }.should raise_error(RangeError)
end
it "returns a Rational if self has zero imaginary part" do
@@ -25,7 +25,7 @@ describe "Complex#rationalize" do
end
it "raises ArgumentError when passed more than one argument" do
- lambda { Complex(1,0).rationalize(0.1, 0.1) }.should raise_error(ArgumentError)
- lambda { Complex(1,0).rationalize(0.1, 0.1, 2) }.should raise_error(ArgumentError)
+ -> { Complex(1,0).rationalize(0.1, 0.1) }.should raise_error(ArgumentError)
+ -> { Complex(1,0).rationalize(0.1, 0.1, 2) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/complex/shared/divide.rb b/spec/ruby/core/complex/shared/divide.rb
index e3701405b9..a60802c74c 100644
--- a/spec/ruby/core/complex/shared/divide.rb
+++ b/spec/ruby/core/complex/shared/divide.rb
@@ -19,7 +19,7 @@ describe :complex_divide, shared: true do
end
it "raises a ZeroDivisionError when given zero" do
- lambda { Complex(20, 40).send(@method, 0) }.should raise_error(ZeroDivisionError)
+ -> { Complex(20, 40).send(@method, 0) }.should raise_error(ZeroDivisionError)
end
it "produces Rational parts" do
diff --git a/spec/ruby/core/complex/shared/rect.rb b/spec/ruby/core/complex/shared/rect.rb
index 971821ac33..9f5de1ffeb 100644
--- a/spec/ruby/core/complex/shared/rect.rb
+++ b/spec/ruby/core/complex/shared/rect.rb
@@ -37,7 +37,7 @@ describe :complex_rect, shared: true do
it "raises an ArgumentError if given any arguments" do
@numbers.each do |number|
- lambda { number.send(@method, number) }.should raise_error(ArgumentError)
+ -> { number.send(@method, number) }.should raise_error(ArgumentError)
end
end
end
@@ -57,7 +57,7 @@ describe :complex_rect_class, shared: true do
it "raises TypeError" do
n = mock_numeric('n')
n.should_receive(:real?).any_number_of_times.and_return(false)
- lambda { Complex.send(@method, n) }.should raise_error(TypeError)
+ -> { Complex.send(@method, n) }.should raise_error(TypeError)
end
end
@@ -68,7 +68,7 @@ describe :complex_rect_class, shared: true do
n2 = mock_numeric('n2')
n1.should_receive(:real?).any_number_of_times.and_return(r1)
n2.should_receive(:real?).any_number_of_times.and_return(r2)
- lambda { Complex.send(@method, n1, n2) }.should raise_error(TypeError)
+ -> { Complex.send(@method, n1, n2) }.should raise_error(TypeError)
end
end
end
@@ -87,8 +87,8 @@ describe :complex_rect_class, shared: true do
describe "passed a non-Numeric" do
it "raises TypeError" do
- lambda { Complex.send(@method, :sym) }.should raise_error(TypeError)
- lambda { Complex.send(@method, 0, :sym) }.should raise_error(TypeError)
+ -> { Complex.send(@method, :sym) }.should raise_error(TypeError)
+ -> { Complex.send(@method, 0, :sym) }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/core/complex/to_f_spec.rb b/spec/ruby/core/complex/to_f_spec.rb
index 12c34dfbb1..78e6526491 100644
--- a/spec/ruby/core/complex/to_f_spec.rb
+++ b/spec/ruby/core/complex/to_f_spec.rb
@@ -29,13 +29,13 @@ describe "Complex#to_f" do
describe "when the imaginary part is non-zero" do
it "raises RangeError" do
- lambda { Complex(0, 1).to_f }.should raise_error(RangeError)
+ -> { Complex(0, 1).to_f }.should raise_error(RangeError)
end
end
describe "when the imaginary part is Float 0.0" do
it "raises RangeError" do
- lambda { Complex(0, 0.0).to_f }.should raise_error(RangeError)
+ -> { Complex(0, 0.0).to_f }.should raise_error(RangeError)
end
end
end
diff --git a/spec/ruby/core/complex/to_i_spec.rb b/spec/ruby/core/complex/to_i_spec.rb
index acdf719376..23134705ba 100644
--- a/spec/ruby/core/complex/to_i_spec.rb
+++ b/spec/ruby/core/complex/to_i_spec.rb
@@ -29,13 +29,13 @@ describe "Complex#to_i" do
describe "when the imaginary part is non-zero" do
it "raises RangeError" do
- lambda { Complex(0, 1).to_i }.should raise_error(RangeError)
+ -> { Complex(0, 1).to_i }.should raise_error(RangeError)
end
end
describe "when the imaginary part is Float 0.0" do
it "raises RangeError" do
- lambda { Complex(0, 0.0).to_i }.should raise_error(RangeError)
+ -> { Complex(0, 0.0).to_i }.should raise_error(RangeError)
end
end
end
diff --git a/spec/ruby/core/complex/to_r_spec.rb b/spec/ruby/core/complex/to_r_spec.rb
index 46bac98ef4..76a69a0b93 100644
--- a/spec/ruby/core/complex/to_r_spec.rb
+++ b/spec/ruby/core/complex/to_r_spec.rb
@@ -29,13 +29,13 @@ describe "Complex#to_r" do
describe "when the imaginary part is non-zero" do
it "raises RangeError" do
- lambda { Complex(0, 1).to_r }.should raise_error(RangeError)
+ -> { Complex(0, 1).to_r }.should raise_error(RangeError)
end
end
describe "when the imaginary part is Float 0.0" do
it "raises RangeError" do
- lambda { Complex(0, 0.0).to_r }.should raise_error(RangeError)
+ -> { Complex(0, 0.0).to_r }.should raise_error(RangeError)
end
end
end
diff --git a/spec/ruby/core/dir/chdir_spec.rb b/spec/ruby/core/dir/chdir_spec.rb
index a2383e6bf2..e9b8274382 100644
--- a/spec/ruby/core/dir/chdir_spec.rb
+++ b/spec/ruby/core/dir/chdir_spec.rb
@@ -88,8 +88,8 @@ describe "Dir.chdir" do
end
it "raises an Errno::ENOENT if the directory does not exist" do
- lambda { Dir.chdir DirSpecs.nonexistent }.should raise_error(Errno::ENOENT)
- lambda { Dir.chdir(DirSpecs.nonexistent) { } }.should raise_error(Errno::ENOENT)
+ -> { Dir.chdir DirSpecs.nonexistent }.should raise_error(Errno::ENOENT)
+ -> { Dir.chdir(DirSpecs.nonexistent) { } }.should raise_error(Errno::ENOENT)
end
it "raises an Errno::ENOENT if the original directory no longer exists" do
@@ -100,7 +100,7 @@ describe "Dir.chdir" do
Dir.mkdir dir1
Dir.mkdir dir2
begin
- lambda {
+ -> {
Dir.chdir dir1 do
Dir.chdir(dir2) { Dir.unlink dir1 }
end
diff --git a/spec/ruby/core/dir/children_spec.rb b/spec/ruby/core/dir/children_spec.rb
index ef8b20b1f0..8f6e62b463 100644
--- a/spec/ruby/core/dir/children_spec.rb
+++ b/spec/ruby/core/dir/children_spec.rb
@@ -66,7 +66,7 @@ ruby_version_is "2.5" do
end
it "raises a SystemCallError if called with a nonexistent directory" do
- lambda { Dir.children DirSpecs.nonexistent }.should raise_error(SystemCallError)
+ -> { Dir.children DirSpecs.nonexistent }.should raise_error(SystemCallError)
end
end
end
diff --git a/spec/ruby/core/dir/chroot_spec.rb b/spec/ruby/core/dir/chroot_spec.rb
index bce4d6f286..55392410e7 100644
--- a/spec/ruby/core/dir/chroot_spec.rb
+++ b/spec/ruby/core/dir/chroot_spec.rb
@@ -21,17 +21,17 @@ platform_is_not :windows do
end
it "raises an Errno::EPERM exception if the directory exists" do
- lambda { Dir.chroot('.') }.should raise_error(Errno::EPERM)
+ -> { Dir.chroot('.') }.should raise_error(Errno::EPERM)
end
it "raises a SystemCallError if the directory doesn't exist" do
- lambda { Dir.chroot('xgwhwhsjai2222jg') }.should raise_error(SystemCallError)
+ -> { Dir.chroot('xgwhwhsjai2222jg') }.should raise_error(SystemCallError)
end
it "calls #to_path on non-String argument" do
p = mock('path')
p.should_receive(:to_path).and_return('.')
- lambda { Dir.chroot(p) }.should raise_error(Errno::EPERM)
+ -> { Dir.chroot(p) }.should raise_error(Errno::EPERM)
end
end
end
diff --git a/spec/ruby/core/dir/close_spec.rb b/spec/ruby/core/dir/close_spec.rb
index 64d87140ae..5fad5eecfb 100644
--- a/spec/ruby/core/dir/close_spec.rb
+++ b/spec/ruby/core/dir/close_spec.rb
@@ -12,7 +12,7 @@ describe "Dir#close" do
it "does not raise an IOError even if the Dir instance is closed" do
dir = Dir.open DirSpecs.mock_dir
dir.close
- lambda {
+ -> {
dir.close
}.should_not raise_error(IOError)
end
diff --git a/spec/ruby/core/dir/each_child_spec.rb b/spec/ruby/core/dir/each_child_spec.rb
index c04d212bfa..dcc9a456c7 100644
--- a/spec/ruby/core/dir/each_child_spec.rb
+++ b/spec/ruby/core/dir/each_child_spec.rb
@@ -32,7 +32,7 @@ ruby_version_is "2.5" do
end
it "raises a SystemCallError if passed a nonexistent directory" do
- lambda { Dir.each_child(DirSpecs.nonexistent) {} }.should raise_error(SystemCallError)
+ -> { Dir.each_child(DirSpecs.nonexistent) {} }.should raise_error(SystemCallError)
end
describe "when no block is given" do
diff --git a/spec/ruby/core/dir/empty_spec.rb b/spec/ruby/core/dir/empty_spec.rb
index 626b228439..8cc8757798 100644
--- a/spec/ruby/core/dir/empty_spec.rb
+++ b/spec/ruby/core/dir/empty_spec.rb
@@ -26,6 +26,6 @@ describe "Dir.empty?" do
end
it "raises ENOENT for nonexistent directories" do
- lambda { Dir.empty? tmp("nonexistent") }.should raise_error(Errno::ENOENT)
+ -> { Dir.empty? tmp("nonexistent") }.should raise_error(Errno::ENOENT)
end
end
diff --git a/spec/ruby/core/dir/entries_spec.rb b/spec/ruby/core/dir/entries_spec.rb
index ed45287e82..33568b6fc4 100644
--- a/spec/ruby/core/dir/entries_spec.rb
+++ b/spec/ruby/core/dir/entries_spec.rb
@@ -65,6 +65,6 @@ describe "Dir.entries" do
end
it "raises a SystemCallError if called with a nonexistent directory" do
- lambda { Dir.entries DirSpecs.nonexistent }.should raise_error(SystemCallError)
+ -> { Dir.entries DirSpecs.nonexistent }.should raise_error(SystemCallError)
end
end
diff --git a/spec/ruby/core/dir/fileno_spec.rb b/spec/ruby/core/dir/fileno_spec.rb
index 5a893d2da9..504e36d44b 100644
--- a/spec/ruby/core/dir/fileno_spec.rb
+++ b/spec/ruby/core/dir/fileno_spec.rb
@@ -31,7 +31,7 @@ describe "Dir#fileno" do
end
else
it "raises an error when not implemented on the platform" do
- lambda { @dir.fileno }.should raise_error(NotImplementedError)
+ -> { @dir.fileno }.should raise_error(NotImplementedError)
end
end
end
diff --git a/spec/ruby/core/dir/foreach_spec.rb b/spec/ruby/core/dir/foreach_spec.rb
index fed0aa8065..1560b85f8a 100644
--- a/spec/ruby/core/dir/foreach_spec.rb
+++ b/spec/ruby/core/dir/foreach_spec.rb
@@ -31,7 +31,7 @@ describe "Dir.foreach" do
end
it "raises a SystemCallError if passed a nonexistent directory" do
- lambda { Dir.foreach(DirSpecs.nonexistent) {} }.should raise_error(SystemCallError)
+ -> { Dir.foreach(DirSpecs.nonexistent) {} }.should raise_error(SystemCallError)
end
it "returns an Enumerator if no block given" do
diff --git a/spec/ruby/core/dir/home_spec.rb b/spec/ruby/core/dir/home_spec.rb
index db46b80c54..cdfc9346dc 100644
--- a/spec/ruby/core/dir/home_spec.rb
+++ b/spec/ruby/core/dir/home_spec.rb
@@ -40,6 +40,6 @@ describe "Dir.home" do
end
it "raises an ArgumentError if the named user doesn't exist" do
- lambda { Dir.home('geuw2n288dh2k') }.should raise_error(ArgumentError)
+ -> { Dir.home('geuw2n288dh2k') }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/dir/mkdir_spec.rb b/spec/ruby/core/dir/mkdir_spec.rb
index d0bf32c143..58767a5aa0 100644
--- a/spec/ruby/core/dir/mkdir_spec.rb
+++ b/spec/ruby/core/dir/mkdir_spec.rb
@@ -51,15 +51,15 @@ describe "Dir.mkdir" do
end
it "raises a SystemCallError if any of the directories in the path before the last does not exist" do
- lambda { Dir.mkdir "#{DirSpecs.nonexistent}/subdir" }.should raise_error(SystemCallError)
+ -> { Dir.mkdir "#{DirSpecs.nonexistent}/subdir" }.should raise_error(SystemCallError)
end
it "raises Errno::EEXIST if the specified directory already exists" do
- lambda { Dir.mkdir("#{DirSpecs.mock_dir}/dir") }.should raise_error(Errno::EEXIST)
+ -> { Dir.mkdir("#{DirSpecs.mock_dir}/dir") }.should raise_error(Errno::EEXIST)
end
it "raises Errno::EEXIST if the argument points to the existing file" do
- lambda { Dir.mkdir("#{DirSpecs.mock_dir}/file_one.ext") }.should raise_error(Errno::EEXIST)
+ -> { Dir.mkdir("#{DirSpecs.mock_dir}/file_one.ext") }.should raise_error(Errno::EEXIST)
end
end
@@ -80,7 +80,7 @@ platform_is_not :windows do
it "raises a SystemCallError when lacking adequate permissions in the parent dir" do
Dir.mkdir @dir, 0000
- lambda { Dir.mkdir "#{@dir}/subdir" }.should raise_error(SystemCallError)
+ -> { Dir.mkdir "#{@dir}/subdir" }.should raise_error(SystemCallError)
end
end
end
diff --git a/spec/ruby/core/dir/shared/chroot.rb b/spec/ruby/core/dir/shared/chroot.rb
index 2ed033dfed..93699f93be 100644
--- a/spec/ruby/core/dir/shared/chroot.rb
+++ b/spec/ruby/core/dir/shared/chroot.rb
@@ -15,7 +15,7 @@ describe :dir_chroot_as_root, shared: true do
end
it "can be used to change the process' root directory" do
- lambda { Dir.send(@method, File.dirname(__FILE__)) }.should_not raise_error
+ -> { Dir.send(@method, File.dirname(__FILE__)) }.should_not raise_error
File.exist?("/#{File.basename(__FILE__)}").should be_true
end
@@ -24,7 +24,7 @@ describe :dir_chroot_as_root, shared: true do
end
it "raises an Errno::ENOENT exception if the directory doesn't exist" do
- lambda { Dir.send(@method, 'xgwhwhsjai2222jg') }.should raise_error(Errno::ENOENT)
+ -> { Dir.send(@method, 'xgwhwhsjai2222jg') }.should raise_error(Errno::ENOENT)
end
it "can be escaped from with ../" do
diff --git a/spec/ruby/core/dir/shared/closed.rb b/spec/ruby/core/dir/shared/closed.rb
index a1bce06a08..17d8332c2a 100644
--- a/spec/ruby/core/dir/shared/closed.rb
+++ b/spec/ruby/core/dir/shared/closed.rb
@@ -1,6 +1,6 @@
describe :dir_closed, shared: true do
it "raises an IOError when called on a closed Dir instance" do
- lambda {
+ -> {
dir = Dir.open DirSpecs.mock_dir
dir.close
dir.send(@method) {}
diff --git a/spec/ruby/core/dir/shared/delete.rb b/spec/ruby/core/dir/shared/delete.rb
index 649708cd76..49e88360e8 100644
--- a/spec/ruby/core/dir/shared/delete.rb
+++ b/spec/ruby/core/dir/shared/delete.rb
@@ -19,7 +19,7 @@ describe :dir_delete, shared: true do
platform_is_not :solaris do
it "raises an Errno::ENOTEMPTY when trying to remove a nonempty directory" do
- lambda do
+ -> do
Dir.send @method, DirSpecs.mock_rmdir("nonempty")
end.should raise_error(Errno::ENOTEMPTY)
end
@@ -27,14 +27,14 @@ describe :dir_delete, shared: true do
platform_is :solaris do
it "raises an Errno::EEXIST when trying to remove a nonempty directory" do
- lambda do
+ -> do
Dir.send @method, DirSpecs.mock_rmdir("nonempty")
end.should raise_error(Errno::EEXIST)
end
end
it "raises an Errno::ENOENT when trying to remove a non-existing directory" do
- lambda do
+ -> do
Dir.send @method, DirSpecs.nonexistent
end.should raise_error(Errno::ENOENT)
end
@@ -42,7 +42,7 @@ describe :dir_delete, shared: true do
it "raises an Errno::ENOTDIR when trying to remove a non-directory" do
file = DirSpecs.mock_rmdir("nonempty/regular")
touch(file)
- lambda do
+ -> do
Dir.send @method, file
end.should raise_error(Errno::ENOTDIR)
end
@@ -54,7 +54,7 @@ describe :dir_delete, shared: true do
parent = DirSpecs.mock_rmdir("noperm")
child = DirSpecs.mock_rmdir("noperm", "child")
File.chmod(0000, parent)
- lambda do
+ -> do
Dir.send @method, child
end.should raise_error(Errno::EACCES)
end
diff --git a/spec/ruby/core/dir/shared/glob.rb b/spec/ruby/core/dir/shared/glob.rb
index af587dd33b..e4ffb51286 100644
--- a/spec/ruby/core/dir/shared/glob.rb
+++ b/spec/ruby/core/dir/shared/glob.rb
@@ -13,7 +13,7 @@ describe :dir_glob, shared: true do
it "raises an Encoding::CompatibilityError if the argument encoding is not compatible with US-ASCII" do
pattern = "file*".force_encoding Encoding::UTF_16BE
- lambda { Dir.send(@method, pattern) }.should raise_error(Encoding::CompatibilityError)
+ -> { Dir.send(@method, pattern) }.should raise_error(Encoding::CompatibilityError)
end
it "calls #to_path to convert a pattern" do
diff --git a/spec/ruby/core/dir/shared/open.rb b/spec/ruby/core/dir/shared/open.rb
index 63e9036053..fb2af71e05 100644
--- a/spec/ruby/core/dir/shared/open.rb
+++ b/spec/ruby/core/dir/shared/open.rb
@@ -6,7 +6,7 @@ describe :dir_open, shared: true do
end
it "raises a SystemCallError if the directory does not exist" do
- lambda do
+ -> do
Dir.send @method, DirSpecs.nonexistent
end.should raise_error(SystemCallError)
end
@@ -21,20 +21,20 @@ describe :dir_open, shared: true do
it "closes the Dir instance when the block exits if given a block" do
closed_dir = Dir.send(@method, DirSpecs.mock_dir) { |dir| dir }
- lambda { closed_dir.read }.should raise_error(IOError)
+ -> { closed_dir.read }.should raise_error(IOError)
end
it "closes the Dir instance when the block exits the block even due to an exception" do
closed_dir = nil
- lambda do
+ -> do
Dir.send(@method, DirSpecs.mock_dir) do |dir|
closed_dir = dir
raise "dir specs"
end
end.should raise_error(RuntimeError, "dir specs")
- lambda { closed_dir.read }.should raise_error(IOError)
+ -> { closed_dir.read }.should raise_error(IOError)
end
it "calls #to_path on non-String arguments" do
diff --git a/spec/ruby/core/encoding/converter/asciicompat_encoding_spec.rb b/spec/ruby/core/encoding/converter/asciicompat_encoding_spec.rb
index e39d590e3a..1beb40af3f 100644
--- a/spec/ruby/core/encoding/converter/asciicompat_encoding_spec.rb
+++ b/spec/ruby/core/encoding/converter/asciicompat_encoding_spec.rb
@@ -2,7 +2,7 @@ require_relative '../../../spec_helper'
describe "Encoding::Converter.asciicompat_encoding" do
it "accepts an encoding name as a String argument" do
- lambda { Encoding::Converter.asciicompat_encoding('UTF-8') }.
+ -> { Encoding::Converter.asciicompat_encoding('UTF-8') }.
should_not raise_error
end
diff --git a/spec/ruby/core/encoding/converter/convert_spec.rb b/spec/ruby/core/encoding/converter/convert_spec.rb
index 362e027a58..95a9e0b758 100644
--- a/spec/ruby/core/encoding/converter/convert_spec.rb
+++ b/spec/ruby/core/encoding/converter/convert_spec.rb
@@ -33,13 +33,13 @@ describe "Encoding::Converter#convert" do
it "raises UndefinedConversionError if the String contains characters invalid for the target encoding" do
ec = Encoding::Converter.new('UTF-8', Encoding.find('macCyrillic'))
- lambda { ec.convert("\u{6543}".force_encoding('UTF-8')) }.should \
+ -> { ec.convert("\u{6543}".force_encoding('UTF-8')) }.should \
raise_error(Encoding::UndefinedConversionError)
end
it "raises an ArgumentError if called on a finished stream" do
ec = Encoding::Converter.new('UTF-8', Encoding.find('macCyrillic'))
ec.finish
- lambda { ec.convert("\u{65}") }.should raise_error(ArgumentError)
+ -> { ec.convert("\u{65}") }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/encoding/converter/new_spec.rb b/spec/ruby/core/encoding/converter/new_spec.rb
index 6b9c76a093..6a6343012c 100644
--- a/spec/ruby/core/encoding/converter/new_spec.rb
+++ b/spec/ruby/core/encoding/converter/new_spec.rb
@@ -23,7 +23,7 @@ describe "Encoding::Converter.new" do
end
it "raises an Encoding::ConverterNotFoundError if both encodings are the same" do
- lambda do
+ -> do
Encoding::Converter.new "utf-8", "utf-8"
end.should raise_error(Encoding::ConverterNotFoundError)
end
@@ -65,25 +65,25 @@ describe "Encoding::Converter.new" do
obj = mock("encoding converter replacement")
obj.should_receive(:to_str).and_return(1)
- lambda do
+ -> do
Encoding::Converter.new("us-ascii", "utf-8", replace: obj)
end.should raise_error(TypeError)
end
it "raises a TypeError if passed true for the replacement object" do
- lambda do
+ -> do
Encoding::Converter.new("us-ascii", "utf-8", replace: true)
end.should raise_error(TypeError)
end
it "raises a TypeError if passed false for the replacement object" do
- lambda do
+ -> do
Encoding::Converter.new("us-ascii", "utf-8", replace: false)
end.should raise_error(TypeError)
end
it "raises a TypeError if passed a Fixnum for the replacement object" do
- lambda do
+ -> do
Encoding::Converter.new("us-ascii", "utf-8", replace: 1)
end.should raise_error(TypeError)
end
diff --git a/spec/ruby/core/encoding/converter/primitive_convert_spec.rb b/spec/ruby/core/encoding/converter/primitive_convert_spec.rb
index 710cc262bb..4a22606375 100644
--- a/spec/ruby/core/encoding/converter/primitive_convert_spec.rb
+++ b/spec/ruby/core/encoding/converter/primitive_convert_spec.rb
@@ -7,19 +7,19 @@ describe "Encoding::Converter#primitive_convert" do
end
it "accepts a nil source buffer" do
- lambda { @ec.primitive_convert(nil,"") }.should_not raise_error
+ -> { @ec.primitive_convert(nil,"") }.should_not raise_error
end
it "accepts a String as the source buffer" do
- lambda { @ec.primitive_convert("","") }.should_not raise_error
+ -> { @ec.primitive_convert("","") }.should_not raise_error
end
it "accepts nil for the destination byte offset" do
- lambda { @ec.primitive_convert("","", nil) }.should_not raise_error
+ -> { @ec.primitive_convert("","", nil) }.should_not raise_error
end
it "accepts an integer for the destination byte offset" do
- lambda { @ec.primitive_convert("","a", 1) }.should_not raise_error
+ -> { @ec.primitive_convert("","a", 1) }.should_not raise_error
end
it "calls #to_int to convert the destination byte offset" do
@@ -30,10 +30,10 @@ describe "Encoding::Converter#primitive_convert" do
end
it "raises an ArgumentError if the destination byte offset is greater than the bytesize of the destination buffer" do
- lambda { @ec.primitive_convert("","am", 0) }.should_not raise_error
- lambda { @ec.primitive_convert("","am", 1) }.should_not raise_error
- lambda { @ec.primitive_convert("","am", 2) }.should_not raise_error
- lambda { @ec.primitive_convert("","am", 3) }.should raise_error(ArgumentError)
+ -> { @ec.primitive_convert("","am", 0) }.should_not raise_error
+ -> { @ec.primitive_convert("","am", 1) }.should_not raise_error
+ -> { @ec.primitive_convert("","am", 2) }.should_not raise_error
+ -> { @ec.primitive_convert("","am", 3) }.should raise_error(ArgumentError)
end
it "uses the destination byte offset to determine where to write the result in the destination buffer" do
@@ -49,19 +49,19 @@ describe "Encoding::Converter#primitive_convert" do
end
it "accepts nil for the destination bytesize" do
- lambda { @ec.primitive_convert("","", nil, nil) }.should_not raise_error
+ -> { @ec.primitive_convert("","", nil, nil) }.should_not raise_error
end
it "accepts an integer for the destination bytesize" do
- lambda { @ec.primitive_convert("","", nil, 0) }.should_not raise_error
+ -> { @ec.primitive_convert("","", nil, 0) }.should_not raise_error
end
it "allows a destination bytesize value greater than the bytesize of the source buffer" do
- lambda { @ec.primitive_convert("am","", nil, 3) }.should_not raise_error
+ -> { @ec.primitive_convert("am","", nil, 3) }.should_not raise_error
end
it "allows a destination bytesize value less than the bytesize of the source buffer" do
- lambda { @ec.primitive_convert("am","", nil, 1) }.should_not raise_error
+ -> { @ec.primitive_convert("am","", nil, 1) }.should_not raise_error
end
it "calls #to_int to convert the destination byte size" do
diff --git a/spec/ruby/core/encoding/converter/primitive_errinfo_spec.rb b/spec/ruby/core/encoding/converter/primitive_errinfo_spec.rb
index e0a5378155..1f836b259f 100644
--- a/spec/ruby/core/encoding/converter/primitive_errinfo_spec.rb
+++ b/spec/ruby/core/encoding/converter/primitive_errinfo_spec.rb
@@ -54,7 +54,7 @@ describe "Encoding::Converter#primitive_errinfo" do
it "returns the state, source encoding, target encoding, erroneous bytes, and the read-again bytes when #convert last raised InvalidByteSequenceError" do
ec = Encoding::Converter.new("utf-8", "iso-8859-1")
- lambda { ec.convert("\xf1abcd") }.should raise_error(Encoding::InvalidByteSequenceError)
+ -> { ec.convert("\xf1abcd") }.should raise_error(Encoding::InvalidByteSequenceError)
ec.primitive_errinfo.should ==
[:invalid_byte_sequence, "UTF-8", "ISO-8859-1", "\xF1", "a"]
end
@@ -62,7 +62,7 @@ describe "Encoding::Converter#primitive_errinfo" do
it "returns the state, source encoding, target encoding, erroneous bytes, and the read-again bytes when #finish last raised InvalidByteSequenceError" do
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
ec.convert("\xa4")
- lambda { ec.finish }.should raise_error(Encoding::InvalidByteSequenceError)
+ -> { ec.finish }.should raise_error(Encoding::InvalidByteSequenceError)
ec.primitive_errinfo.should == [:incomplete_input, "EUC-JP", "UTF-8", "\xA4", ""]
end
end
diff --git a/spec/ruby/core/encoding/converter/replacement_spec.rb b/spec/ruby/core/encoding/converter/replacement_spec.rb
index a23be74e9b..5ca42e7e5a 100644
--- a/spec/ruby/core/encoding/converter/replacement_spec.rb
+++ b/spec/ruby/core/encoding/converter/replacement_spec.rb
@@ -33,7 +33,7 @@ describe "Encoding::Converter#replacement=" do
it "raises a TypeError if assigned a non-String argument" do
ec = Encoding::Converter.new("utf-8", "us-ascii")
- lambda { ec.replacement = nil }.should raise_error(TypeError)
+ -> { ec.replacement = nil }.should raise_error(TypeError)
end
it "sets #replacement" do
@@ -47,7 +47,7 @@ describe "Encoding::Converter#replacement=" do
ec = Encoding::Converter.new("sjis", "ascii")
utf8_q = "\u{986}".force_encoding('utf-8')
ec.primitive_convert(utf8_q.dup, "").should == :undefined_conversion
- lambda { ec.replacement = utf8_q }.should \
+ -> { ec.replacement = utf8_q }.should \
raise_error(Encoding::UndefinedConversionError)
end
@@ -55,7 +55,7 @@ describe "Encoding::Converter#replacement=" do
ec = Encoding::Converter.new("sjis", "ascii")
utf8_q = "\u{986}".force_encoding('utf-8')
ec.primitive_convert(utf8_q.dup, "").should == :undefined_conversion
- lambda { ec.replacement = utf8_q }.should \
+ -> { ec.replacement = utf8_q }.should \
raise_error(Encoding::UndefinedConversionError)
ec.replacement.should == "?".force_encoding('us-ascii')
end
diff --git a/spec/ruby/core/encoding/converter/search_convpath_spec.rb b/spec/ruby/core/encoding/converter/search_convpath_spec.rb
index bd7530405b..0535e7bdc3 100644
--- a/spec/ruby/core/encoding/converter/search_convpath_spec.rb
+++ b/spec/ruby/core/encoding/converter/search_convpath_spec.rb
@@ -25,7 +25,7 @@ describe "Encoding::Converter.search_convpath" do
end
it "raises an Encoding::ConverterNotFoundError if no conversion path exists" do
- lambda do
+ -> do
Encoding::Converter.search_convpath(Encoding::BINARY, Encoding::Emacs_Mule)
end.should raise_error(Encoding::ConverterNotFoundError)
end
diff --git a/spec/ruby/core/encoding/default_external_spec.rb b/spec/ruby/core/encoding/default_external_spec.rb
index 8973490901..e2cb9b02f4 100644
--- a/spec/ruby/core/encoding/default_external_spec.rb
+++ b/spec/ruby/core/encoding/default_external_spec.rb
@@ -54,10 +54,10 @@ describe "Encoding.default_external=" do
end
it "raises a TypeError unless the argument is an Encoding or convertible to a String" do
- lambda { Encoding.default_external = [] }.should raise_error(TypeError)
+ -> { Encoding.default_external = [] }.should raise_error(TypeError)
end
it "raises an ArgumentError if the argument is nil" do
- lambda { Encoding.default_external = nil }.should raise_error(ArgumentError)
+ -> { Encoding.default_external = nil }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/encoding/default_internal_spec.rb b/spec/ruby/core/encoding/default_internal_spec.rb
index 47a6887eee..855f4e9f32 100644
--- a/spec/ruby/core/encoding/default_internal_spec.rb
+++ b/spec/ruby/core/encoding/default_internal_spec.rb
@@ -60,11 +60,11 @@ describe "Encoding.default_internal=" do
obj = mock('string')
obj.should_receive(:to_str).at_least(1).times.and_return(1)
- lambda { Encoding.default_internal = obj }.should raise_error(TypeError)
+ -> { Encoding.default_internal = obj }.should raise_error(TypeError)
end
it "raises a TypeError when passed an object not providing #to_str" do
- lambda { Encoding.default_internal = mock("encoding") }.should raise_error(TypeError)
+ -> { Encoding.default_internal = mock("encoding") }.should raise_error(TypeError)
end
it "accepts an argument of nil to unset the default internal encoding" do
diff --git a/spec/ruby/core/encoding/find_spec.rb b/spec/ruby/core/encoding/find_spec.rb
index 5635a51c69..8a0873070f 100644
--- a/spec/ruby/core/encoding/find_spec.rb
+++ b/spec/ruby/core/encoding/find_spec.rb
@@ -18,7 +18,7 @@ describe "Encoding.find" do
end
it "raises a TypeError if passed a Symbol" do
- lambda { Encoding.find(:"utf-8") }.should raise_error(TypeError)
+ -> { Encoding.find(:"utf-8") }.should raise_error(TypeError)
end
it "returns the passed Encoding object" do
@@ -50,7 +50,7 @@ describe "Encoding.find" do
end
it "raises an ArgumentError if the given encoding does not exist" do
- lambda { Encoding.find('dh2dh278d') }.should raise_error(ArgumentError)
+ -> { Encoding.find('dh2dh278d') }.should raise_error(ArgumentError)
end
# Not sure how to do a better test, since locale depends on weird platform-specific stuff
diff --git a/spec/ruby/core/enumerable/all_spec.rb b/spec/ruby/core/enumerable/all_spec.rb
index b02ac8b21b..8af80896a9 100644
--- a/spec/ruby/core/enumerable/all_spec.rb
+++ b/spec/ruby/core/enumerable/all_spec.rb
@@ -21,26 +21,26 @@ describe "Enumerable#all?" do
end
it "raises an ArgumentError when more than 1 argument is provided" do
- lambda { @enum.all?(1, 2, 3) }.should raise_error(ArgumentError)
- lambda { [].all?(1, 2, 3) }.should raise_error(ArgumentError)
- lambda { {}.all?(1, 2, 3) }.should raise_error(ArgumentError)
+ -> { @enum.all?(1, 2, 3) }.should raise_error(ArgumentError)
+ -> { [].all?(1, 2, 3) }.should raise_error(ArgumentError)
+ -> { {}.all?(1, 2, 3) }.should raise_error(ArgumentError)
end
ruby_version_is ""..."2.5" do
it "raises an ArgumentError when any arguments provided" do
- lambda { @enum.all?(Proc.new {}) }.should raise_error(ArgumentError)
- lambda { @enum.all?(nil) }.should raise_error(ArgumentError)
- lambda { @empty.all?(1) }.should raise_error(ArgumentError)
- lambda { @enum1.all?(1) {} }.should raise_error(ArgumentError)
+ -> { @enum.all?(Proc.new {}) }.should raise_error(ArgumentError)
+ -> { @enum.all?(nil) }.should raise_error(ArgumentError)
+ -> { @empty.all?(1) }.should raise_error(ArgumentError)
+ -> { @enum1.all?(1) {} }.should raise_error(ArgumentError)
end
end
it "does not hide exceptions out of #each" do
- lambda {
+ -> {
EnumerableSpecs::ThrowingEach.new.all?
}.should raise_error(RuntimeError)
- lambda {
+ -> {
EnumerableSpecs::ThrowingEach.new.all? { false }
}.should raise_error(RuntimeError)
end
@@ -113,7 +113,7 @@ describe "Enumerable#all?" do
end
it "does not hide exceptions out of the block" do
- lambda {
+ -> {
@enum.all? { raise "from block" }
}.should raise_error(RuntimeError)
end
@@ -157,7 +157,7 @@ describe "Enumerable#all?" do
end
it "does not hide exceptions out of #each" do
- lambda {
+ -> {
EnumerableSpecs::ThrowingEach.new.all?(Integer)
}.should raise_error(RuntimeError)
end
@@ -185,7 +185,7 @@ describe "Enumerable#all?" do
it "does not hide exceptions out of pattern#===" do
pattern = EnumerableSpecs::Pattern.new { raise "from pattern" }
- lambda {
+ -> {
@enum.all?(pattern)
}.should raise_error(RuntimeError)
end
diff --git a/spec/ruby/core/enumerable/any_spec.rb b/spec/ruby/core/enumerable/any_spec.rb
index b3f10d6806..c800fe2d4b 100644
--- a/spec/ruby/core/enumerable/any_spec.rb
+++ b/spec/ruby/core/enumerable/any_spec.rb
@@ -21,26 +21,26 @@ describe "Enumerable#any?" do
end
it "raises an ArgumentError when more than 1 argument is provided" do
- lambda { @enum.any?(1, 2, 3) }.should raise_error(ArgumentError)
- lambda { [].any?(1, 2, 3) }.should raise_error(ArgumentError)
- lambda { {}.any?(1, 2, 3) }.should raise_error(ArgumentError)
+ -> { @enum.any?(1, 2, 3) }.should raise_error(ArgumentError)
+ -> { [].any?(1, 2, 3) }.should raise_error(ArgumentError)
+ -> { {}.any?(1, 2, 3) }.should raise_error(ArgumentError)
end
ruby_version_is ""..."2.5" do
it "raises an ArgumentError when any arguments provided" do
- lambda { @enum.any?(Proc.new {}) }.should raise_error(ArgumentError)
- lambda { @enum.any?(nil) }.should raise_error(ArgumentError)
- lambda { @empty.any?(1) }.should raise_error(ArgumentError)
- lambda { @enum1.any?(1) {} }.should raise_error(ArgumentError)
+ -> { @enum.any?(Proc.new {}) }.should raise_error(ArgumentError)
+ -> { @enum.any?(nil) }.should raise_error(ArgumentError)
+ -> { @empty.any?(1) }.should raise_error(ArgumentError)
+ -> { @enum1.any?(1) {} }.should raise_error(ArgumentError)
end
end
it "does not hide exceptions out of #each" do
- lambda {
+ -> {
EnumerableSpecs::ThrowingEach.new.any?
}.should raise_error(RuntimeError)
- lambda {
+ -> {
EnumerableSpecs::ThrowingEach.new.any? { false }
}.should raise_error(RuntimeError)
end
@@ -127,7 +127,7 @@ describe "Enumerable#any?" do
end
it "does not hide exceptions out of the block" do
- lambda {
+ -> {
@enum.any? { raise "from block" }
}.should raise_error(RuntimeError)
end
@@ -171,7 +171,7 @@ describe "Enumerable#any?" do
end
it "does not hide exceptions out of #each" do
- lambda {
+ -> {
EnumerableSpecs::ThrowingEach.new.any?(Integer)
}.should raise_error(RuntimeError)
end
@@ -198,7 +198,7 @@ describe "Enumerable#any?" do
it "does not hide exceptions out of pattern#===" do
pattern = EnumerableSpecs::Pattern.new { raise "from pattern" }
- lambda {
+ -> {
@enum.any?(pattern)
}.should raise_error(RuntimeError)
end
diff --git a/spec/ruby/core/enumerable/chunk_spec.rb b/spec/ruby/core/enumerable/chunk_spec.rb
index 3f8a691da5..548544f4e8 100644
--- a/spec/ruby/core/enumerable/chunk_spec.rb
+++ b/spec/ruby/core/enumerable/chunk_spec.rb
@@ -49,12 +49,12 @@ describe "Enumerable#chunk" do
it "raises a RuntimeError if the block returns a Symbol starting with an underscore other than :_alone or :_separator" do
e = EnumerableSpecs::Numerous.new(1, 2, 3, 2, 1)
- lambda { e.chunk { |x| :_arbitrary }.to_a }.should raise_error(RuntimeError)
+ -> { e.chunk { |x| :_arbitrary }.to_a }.should raise_error(RuntimeError)
end
it "does not accept arguments" do
e = EnumerableSpecs::Numerous.new(1, 2, 3)
- lambda {
+ -> {
e.chunk(1) {}
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/core/enumerable/chunk_while_spec.rb b/spec/ruby/core/enumerable/chunk_while_spec.rb
index 88d6d2983f..26bcc983db 100644
--- a/spec/ruby/core/enumerable/chunk_while_spec.rb
+++ b/spec/ruby/core/enumerable/chunk_while_spec.rb
@@ -30,7 +30,7 @@ describe "Enumerable#chunk_while" do
context "when not given a block" do
it "raises an ArgumentError" do
- lambda { @enum.chunk_while }.should raise_error(ArgumentError)
+ -> { @enum.chunk_while }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/enumerable/cycle_spec.rb b/spec/ruby/core/enumerable/cycle_spec.rb
index 2db1ae56fe..487086cba3 100644
--- a/spec/ruby/core/enumerable/cycle_spec.rb
+++ b/spec/ruby/core/enumerable/cycle_spec.rb
@@ -71,12 +71,12 @@ describe "Enumerable#cycle" do
it "raises a TypeError when the passed n cannot be coerced to Integer" do
enum = EnumerableSpecs::Numerous.new
- lambda{ enum.cycle("cat"){} }.should raise_error(TypeError)
+ ->{ enum.cycle("cat"){} }.should raise_error(TypeError)
end
it "raises an ArgumentError if more arguments are passed" do
enum = EnumerableSpecs::Numerous.new
- lambda{ enum.cycle(1, 2) {} }.should raise_error(ArgumentError)
+ ->{ enum.cycle(1, 2) {} }.should raise_error(ArgumentError)
end
it "gathers whole arrays as elements when each yields multiple" do
diff --git a/spec/ruby/core/enumerable/drop_spec.rb b/spec/ruby/core/enumerable/drop_spec.rb
index 1f54d4aac7..423cc0088b 100644
--- a/spec/ruby/core/enumerable/drop_spec.rb
+++ b/spec/ruby/core/enumerable/drop_spec.rb
@@ -7,13 +7,13 @@ describe "Enumerable#drop" do
end
it "requires exactly one argument" do
- lambda{ @enum.drop{} }.should raise_error(ArgumentError)
- lambda{ @enum.drop(1, 2){} }.should raise_error(ArgumentError)
+ ->{ @enum.drop{} }.should raise_error(ArgumentError)
+ ->{ @enum.drop(1, 2){} }.should raise_error(ArgumentError)
end
describe "passed a number n as an argument" do
it "raises ArgumentError if n < 0" do
- lambda{ @enum.drop(-1) }.should raise_error(ArgumentError)
+ ->{ @enum.drop(-1) }.should raise_error(ArgumentError)
end
it "tries to convert n to an Integer using #to_int" do
@@ -35,8 +35,8 @@ describe "Enumerable#drop" do
end
it "raises a TypeError when the passed n cannot be coerced to Integer" do
- lambda{ @enum.drop("hat") }.should raise_error(TypeError)
- lambda{ @enum.drop(nil) }.should raise_error(TypeError)
+ ->{ @enum.drop("hat") }.should raise_error(TypeError)
+ ->{ @enum.drop(nil) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/enumerable/each_cons_spec.rb b/spec/ruby/core/enumerable/each_cons_spec.rb
index 40d0d53517..7d44f54f74 100644
--- a/spec/ruby/core/enumerable/each_cons_spec.rb
+++ b/spec/ruby/core/enumerable/each_cons_spec.rb
@@ -15,14 +15,14 @@ describe "Enumerable#each_cons" do
end
it "raises an ArgumentError if there is not a single parameter > 0" do
- lambda{ @enum.each_cons(0){} }.should raise_error(ArgumentError)
- lambda{ @enum.each_cons(-2){} }.should raise_error(ArgumentError)
- lambda{ @enum.each_cons{} }.should raise_error(ArgumentError)
- lambda{ @enum.each_cons(2,2){} }.should raise_error(ArgumentError)
- lambda{ @enum.each_cons(0) }.should raise_error(ArgumentError)
- lambda{ @enum.each_cons(-2) }.should raise_error(ArgumentError)
- lambda{ @enum.each_cons }.should raise_error(ArgumentError)
- lambda{ @enum.each_cons(2,2) }.should raise_error(ArgumentError)
+ ->{ @enum.each_cons(0){} }.should raise_error(ArgumentError)
+ ->{ @enum.each_cons(-2){} }.should raise_error(ArgumentError)
+ ->{ @enum.each_cons{} }.should raise_error(ArgumentError)
+ ->{ @enum.each_cons(2,2){} }.should raise_error(ArgumentError)
+ ->{ @enum.each_cons(0) }.should raise_error(ArgumentError)
+ ->{ @enum.each_cons(-2) }.should raise_error(ArgumentError)
+ ->{ @enum.each_cons }.should raise_error(ArgumentError)
+ ->{ @enum.each_cons(2,2) }.should raise_error(ArgumentError)
end
it "tries to convert n to an Integer using #to_int" do
diff --git a/spec/ruby/core/enumerable/each_entry_spec.rb b/spec/ruby/core/enumerable/each_entry_spec.rb
index 41b61f6208..edf00f3137 100644
--- a/spec/ruby/core/enumerable/each_entry_spec.rb
+++ b/spec/ruby/core/enumerable/each_entry_spec.rb
@@ -27,8 +27,8 @@ describe "Enumerable#each_entry" do
end
it "raises an ArgumentError when extra arguments" do
- lambda { @enum.each_entry("one").to_a }.should raise_error(ArgumentError)
- lambda { @enum.each_entry("one"){}.to_a }.should raise_error(ArgumentError)
+ -> { @enum.each_entry("one").to_a }.should raise_error(ArgumentError)
+ -> { @enum.each_entry("one"){}.to_a }.should raise_error(ArgumentError)
end
it "passes extra arguments to #each" do
diff --git a/spec/ruby/core/enumerable/each_slice_spec.rb b/spec/ruby/core/enumerable/each_slice_spec.rb
index 9ffb95d29b..ab3b79c344 100644
--- a/spec/ruby/core/enumerable/each_slice_spec.rb
+++ b/spec/ruby/core/enumerable/each_slice_spec.rb
@@ -15,14 +15,14 @@ describe "Enumerable#each_slice" do
end
it "raises an ArgumentError if there is not a single parameter > 0" do
- lambda{ @enum.each_slice(0){} }.should raise_error(ArgumentError)
- lambda{ @enum.each_slice(-2){} }.should raise_error(ArgumentError)
- lambda{ @enum.each_slice{} }.should raise_error(ArgumentError)
- lambda{ @enum.each_slice(2,2){} }.should raise_error(ArgumentError)
- lambda{ @enum.each_slice(0) }.should raise_error(ArgumentError)
- lambda{ @enum.each_slice(-2) }.should raise_error(ArgumentError)
- lambda{ @enum.each_slice }.should raise_error(ArgumentError)
- lambda{ @enum.each_slice(2,2) }.should raise_error(ArgumentError)
+ ->{ @enum.each_slice(0){} }.should raise_error(ArgumentError)
+ ->{ @enum.each_slice(-2){} }.should raise_error(ArgumentError)
+ ->{ @enum.each_slice{} }.should raise_error(ArgumentError)
+ ->{ @enum.each_slice(2,2){} }.should raise_error(ArgumentError)
+ ->{ @enum.each_slice(0) }.should raise_error(ArgumentError)
+ ->{ @enum.each_slice(-2) }.should raise_error(ArgumentError)
+ ->{ @enum.each_slice }.should raise_error(ArgumentError)
+ ->{ @enum.each_slice(2,2) }.should raise_error(ArgumentError)
end
it "tries to convert n to an Integer using #to_int" do
diff --git a/spec/ruby/core/enumerable/first_spec.rb b/spec/ruby/core/enumerable/first_spec.rb
index 19d02d7522..ed1ba599b4 100644
--- a/spec/ruby/core/enumerable/first_spec.rb
+++ b/spec/ruby/core/enumerable/first_spec.rb
@@ -19,7 +19,7 @@ describe "Enumerable#first" do
it "raises a RangeError when passed a Bignum" do
enum = EnumerableSpecs::Empty.new
- lambda { enum.first(bignum_value) }.should raise_error(RangeError)
+ -> { enum.first(bignum_value) }.should raise_error(RangeError)
end
describe "when passed an argument" do
diff --git a/spec/ruby/core/enumerable/grep_spec.rb b/spec/ruby/core/enumerable/grep_spec.rb
index a4dd26468d..c9c0f34e27 100644
--- a/spec/ruby/core/enumerable/grep_spec.rb
+++ b/spec/ruby/core/enumerable/grep_spec.rb
@@ -29,6 +29,28 @@ describe "Enumerable#grep" do
ary.grep(/a(b)a/) { $1 }.should == ["b", "b"]
end
+ it "sets $~ in the block" do
+ "z" =~ /z/ # Reset $~
+ ["abc", "def"].grep(/b/) { |e|
+ e.should == "abc"
+ $&.should == "b"
+ }
+
+ # Set by the failed match of "def"
+ $~.should == nil
+ end
+
+ it "sets $~ to the last match when given no block" do
+ "z" =~ /z/ # Reset $~
+ ["abc", "def"].grep(/b/).should == ["abc"]
+
+ # Set by the failed match of "def"
+ $~.should == nil
+
+ ["abc", "def"].grep(/e/)
+ $&.should == "e"
+ end
+
describe "with a block" do
before :each do
@numerous = EnumerableSpecs::Numerous.new(*(0..9).to_a)
diff --git a/spec/ruby/core/enumerable/grep_v_spec.rb b/spec/ruby/core/enumerable/grep_v_spec.rb
index 2268005dee..6dec487065 100644
--- a/spec/ruby/core/enumerable/grep_v_spec.rb
+++ b/spec/ruby/core/enumerable/grep_v_spec.rb
@@ -9,6 +9,28 @@ describe "Enumerable#grep_v" do
end
end
+ it "sets $~ in the block" do
+ "z" =~ /z/ # Reset $~
+ ["abc", "def"].grep_v(/e/) { |e|
+ e.should == "abc"
+ $~.should == nil
+ }
+
+ # Set by the match of "def"
+ $&.should == "e"
+ end
+
+ it "sets $~ to the last match when given no block" do
+ "z" =~ /z/ # Reset $~
+ ["abc", "def"].grep_v(/e/).should == ["abc"]
+
+ # Set by the match of "def"
+ $&.should == "e"
+
+ ["abc", "def"].grep_v(/b/)
+ $&.should == nil
+ end
+
describe "without block" do
it "returns an Array of matched elements" do
@numerous.grep_v(@odd_matcher).should == [0, 2, 4, 6, 8]
diff --git a/spec/ruby/core/enumerable/max_by_spec.rb b/spec/ruby/core/enumerable/max_by_spec.rb
index 76590b602f..ec1738ea3b 100644
--- a/spec/ruby/core/enumerable/max_by_spec.rb
+++ b/spec/ruby/core/enumerable/max_by_spec.rb
@@ -67,7 +67,7 @@ describe "Enumerable#max_by" do
context "when n is negative" do
it "raises an ArgumentError" do
- lambda { @enum.max_by(-1) { |i| i.to_s } }.should raise_error(ArgumentError)
+ -> { @enum.max_by(-1) { |i| i.to_s } }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/core/enumerable/max_spec.rb b/spec/ruby/core/enumerable/max_spec.rb
index b1d15126c2..0c11ca0969 100644
--- a/spec/ruby/core/enumerable/max_spec.rb
+++ b/spec/ruby/core/enumerable/max_spec.rb
@@ -36,16 +36,16 @@ describe "Enumerable#max" do
end
it "raises a NoMethodError for elements without #<=>" do
- lambda do
+ -> do
EnumerableSpecs::EachDefiner.new(BasicObject.new, BasicObject.new).max
end.should raise_error(NoMethodError)
end
it "raises an ArgumentError for incomparable elements" do
- lambda do
+ -> do
EnumerableSpecs::EachDefiner.new(11,"22").max
end.should raise_error(ArgumentError)
- lambda do
+ -> do
EnumerableSpecs::EachDefiner.new(11,12,22,33).max{|a, b| nil}
end.should raise_error(ArgumentError)
end
@@ -106,7 +106,7 @@ describe "Enumerable#max" do
context "that is negative" do
it "raises an ArgumentError" do
- lambda { @e_ints.max(-1) }.should raise_error(ArgumentError)
+ -> { @e_ints.max(-1) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/core/enumerable/min_by_spec.rb b/spec/ruby/core/enumerable/min_by_spec.rb
index 5f9b2aea00..3ff87e49d8 100644
--- a/spec/ruby/core/enumerable/min_by_spec.rb
+++ b/spec/ruby/core/enumerable/min_by_spec.rb
@@ -67,7 +67,7 @@ describe "Enumerable#min_by" do
context "when n is negative" do
it "raises an ArgumentError" do
- lambda { @enum.min_by(-1) { |i| i.to_s } }.should raise_error(ArgumentError)
+ -> { @enum.min_by(-1) { |i| i.to_s } }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/core/enumerable/min_spec.rb b/spec/ruby/core/enumerable/min_spec.rb
index a31633e8c4..4b6ae248fa 100644
--- a/spec/ruby/core/enumerable/min_spec.rb
+++ b/spec/ruby/core/enumerable/min_spec.rb
@@ -36,16 +36,16 @@ describe "Enumerable#min" do
end
it "raises a NoMethodError for elements without #<=>" do
- lambda do
+ -> do
EnumerableSpecs::EachDefiner.new(BasicObject.new, BasicObject.new).min
end.should raise_error(NoMethodError)
end
it "raises an ArgumentError for incomparable elements" do
- lambda do
+ -> do
EnumerableSpecs::EachDefiner.new(11,"22").min
end.should raise_error(ArgumentError)
- lambda do
+ -> do
EnumerableSpecs::EachDefiner.new(11,12,22,33).min{|a, b| nil}
end.should raise_error(ArgumentError)
end
@@ -110,7 +110,7 @@ describe "Enumerable#min" do
context "that is negative" do
it "raises an ArgumentError" do
- lambda { @e_ints.min(-1) }.should raise_error(ArgumentError)
+ -> { @e_ints.min(-1) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/core/enumerable/minmax_spec.rb b/spec/ruby/core/enumerable/minmax_spec.rb
index f05291aec4..29f1ecf82c 100644
--- a/spec/ruby/core/enumerable/minmax_spec.rb
+++ b/spec/ruby/core/enumerable/minmax_spec.rb
@@ -18,16 +18,16 @@ describe "Enumerable#minmax" do
end
it "raises an ArgumentError when elements are incomparable" do
- lambda do
+ -> do
EnumerableSpecs::Numerous.new(11,"22").minmax
end.should raise_error(ArgumentError)
- lambda do
+ -> do
EnumerableSpecs::Numerous.new(11,12,22,33).minmax{|a, b| nil}
end.should raise_error(ArgumentError)
end
it "raises a NoMethodError for elements without #<=>" do
- lambda do
+ -> do
EnumerableSpecs::Numerous.new(BasicObject.new, BasicObject.new).minmax
end.should raise_error(NoMethodError)
end
diff --git a/spec/ruby/core/enumerable/none_spec.rb b/spec/ruby/core/enumerable/none_spec.rb
index bff252df5e..7c17e58a13 100644
--- a/spec/ruby/core/enumerable/none_spec.rb
+++ b/spec/ruby/core/enumerable/none_spec.rb
@@ -15,26 +15,26 @@ describe "Enumerable#none?" do
end
it "raises an ArgumentError when more than 1 argument is provided" do
- lambda { @enum.none?(1, 2, 3) }.should raise_error(ArgumentError)
- lambda { [].none?(1, 2, 3) }.should raise_error(ArgumentError)
- lambda { {}.none?(1, 2, 3) }.should raise_error(ArgumentError)
+ -> { @enum.none?(1, 2, 3) }.should raise_error(ArgumentError)
+ -> { [].none?(1, 2, 3) }.should raise_error(ArgumentError)
+ -> { {}.none?(1, 2, 3) }.should raise_error(ArgumentError)
end
ruby_version_is ""..."2.5" do
it "raises an ArgumentError when any arguments provided" do
- lambda { @enum.none?(Proc.new {}) }.should raise_error(ArgumentError)
- lambda { @enum.none?(nil) }.should raise_error(ArgumentError)
- lambda { @empty.none?(1) }.should raise_error(ArgumentError)
- lambda { @enum.none?(1) {} }.should raise_error(ArgumentError)
+ -> { @enum.none?(Proc.new {}) }.should raise_error(ArgumentError)
+ -> { @enum.none?(nil) }.should raise_error(ArgumentError)
+ -> { @empty.none?(1) }.should raise_error(ArgumentError)
+ -> { @enum.none?(1) {} }.should raise_error(ArgumentError)
end
end
it "does not hide exceptions out of #each" do
- lambda {
+ -> {
EnumerableSpecs::ThrowingEach.new.none?
}.should raise_error(RuntimeError)
- lambda {
+ -> {
EnumerableSpecs::ThrowingEach.new.none? { false }
}.should raise_error(RuntimeError)
end
@@ -82,7 +82,7 @@ describe "Enumerable#none?" do
end
it "does not hide exceptions out of the block" do
- lambda {
+ -> {
@enum.none? { raise "from block" }
}.should raise_error(RuntimeError)
end
@@ -126,7 +126,7 @@ describe "Enumerable#none?" do
end
it "does not hide exceptions out of #each" do
- lambda {
+ -> {
EnumerableSpecs::ThrowingEach.new.none?(Integer)
}.should raise_error(RuntimeError)
end
@@ -151,7 +151,7 @@ describe "Enumerable#none?" do
it "does not hide exceptions out of pattern#===" do
pattern = EnumerableSpecs::Pattern.new { raise "from pattern" }
- lambda {
+ -> {
@enum.none?(pattern)
}.should raise_error(RuntimeError)
end
diff --git a/spec/ruby/core/enumerable/one_spec.rb b/spec/ruby/core/enumerable/one_spec.rb
index 2bd67adc26..2ae8b3efa4 100644
--- a/spec/ruby/core/enumerable/one_spec.rb
+++ b/spec/ruby/core/enumerable/one_spec.rb
@@ -15,26 +15,26 @@ describe "Enumerable#one?" do
end
it "raises an ArgumentError when more than 1 argument is provided" do
- lambda { @enum.one?(1, 2, 3) }.should raise_error(ArgumentError)
- lambda { [].one?(1, 2, 3) }.should raise_error(ArgumentError)
- lambda { {}.one?(1, 2, 3) }.should raise_error(ArgumentError)
+ -> { @enum.one?(1, 2, 3) }.should raise_error(ArgumentError)
+ -> { [].one?(1, 2, 3) }.should raise_error(ArgumentError)
+ -> { {}.one?(1, 2, 3) }.should raise_error(ArgumentError)
end
ruby_version_is ""..."2.5" do
it "raises an ArgumentError when any arguments provided" do
- lambda { @enum.one?(Proc.new {}) }.should raise_error(ArgumentError)
- lambda { @enum.one?(nil) }.should raise_error(ArgumentError)
- lambda { @empty.one?(1) }.should raise_error(ArgumentError)
- lambda { @enum.one?(1) {} }.should raise_error(ArgumentError)
+ -> { @enum.one?(Proc.new {}) }.should raise_error(ArgumentError)
+ -> { @enum.one?(nil) }.should raise_error(ArgumentError)
+ -> { @empty.one?(1) }.should raise_error(ArgumentError)
+ -> { @enum.one?(1) {} }.should raise_error(ArgumentError)
end
end
it "does not hide exceptions out of #each" do
- lambda {
+ -> {
EnumerableSpecs::ThrowingEach.new.one?
}.should raise_error(RuntimeError)
- lambda {
+ -> {
EnumerableSpecs::ThrowingEach.new.one? { false }
}.should raise_error(RuntimeError)
end
@@ -72,7 +72,7 @@ describe "Enumerable#one?" do
end
it "does not hide exceptions out of the block" do
- lambda {
+ -> {
@enum.one? { raise "from block" }
}.should raise_error(RuntimeError)
end
@@ -117,7 +117,7 @@ describe "Enumerable#one?" do
end
it "does not hide exceptions out of #each" do
- lambda {
+ -> {
EnumerableSpecs::ThrowingEach.new.one?(Integer)
}.should raise_error(RuntimeError)
end
@@ -153,7 +153,7 @@ describe "Enumerable#one?" do
it "does not hide exceptions out of pattern#===" do
pattern = EnumerableSpecs::Pattern.new { raise "from pattern" }
- lambda {
+ -> {
@enum.one?(pattern)
}.should raise_error(RuntimeError)
end
diff --git a/spec/ruby/core/enumerable/shared/collect_concat.rb b/spec/ruby/core/enumerable/shared/collect_concat.rb
index c081c1be71..ddd431baeb 100644
--- a/spec/ruby/core/enumerable/shared/collect_concat.rb
+++ b/spec/ruby/core/enumerable/shared/collect_concat.rb
@@ -41,7 +41,7 @@ describe :enumerable_collect_concat, shared: true do
obj = mock("to_ary defined")
obj.should_receive(:to_ary).and_return("array")
- lambda { [1, obj, 3].send(@method) { |i| i } }.should raise_error(TypeError)
+ -> { [1, obj, 3].send(@method) { |i| i } }.should raise_error(TypeError)
end
it "returns an enumerator when no block given" do
diff --git a/spec/ruby/core/enumerable/shared/find.rb b/spec/ruby/core/enumerable/shared/find.rb
index 3435ce3658..61d63ba3d5 100644
--- a/spec/ruby/core/enumerable/shared/find.rb
+++ b/spec/ruby/core/enumerable/shared/find.rb
@@ -29,23 +29,23 @@ describe :enumerable_find, shared: true do
end
it "returns the value of the ifnone proc if the block is false" do
- fail_proc = lambda { "cheeseburgers" }
+ fail_proc = -> { "cheeseburgers" }
@numerous.send(@method, fail_proc) {|e| false }.should == "cheeseburgers"
end
it "doesn't call the ifnone proc if an element is found" do
- fail_proc = lambda { raise "This shouldn't have been called" }
+ fail_proc = -> { raise "This shouldn't have been called" }
@numerous.send(@method, fail_proc) {|e| e == @elements.first }.should == 2
end
it "calls the ifnone proc only once when the block is false" do
times = 0
- fail_proc = lambda { times += 1; raise if times > 1; "cheeseburgers" }
+ fail_proc = -> { times += 1; raise if times > 1; "cheeseburgers" }
@numerous.send(@method, fail_proc) {|e| false }.should == "cheeseburgers"
end
it "calls the ifnone proc when there are no elements" do
- fail_proc = lambda { "yay" }
+ fail_proc = -> { "yay" }
@empty.send(@method, fail_proc) {|e| true}.should == "yay"
end
@@ -64,7 +64,7 @@ describe :enumerable_find, shared: true do
it "passes the ifnone proc to the enumerator" do
times = 0
- fail_proc = lambda { times += 1; raise if times > 1; "cheeseburgers" }
+ fail_proc = -> { times += 1; raise if times > 1; "cheeseburgers" }
@numerous.send(@method, fail_proc).each {|e| false }.should == "cheeseburgers"
end
diff --git a/spec/ruby/core/enumerable/shared/take.rb b/spec/ruby/core/enumerable/shared/take.rb
index bf2536acda..ce2ace20fa 100644
--- a/spec/ruby/core/enumerable/shared/take.rb
+++ b/spec/ruby/core/enumerable/shared/take.rb
@@ -25,7 +25,7 @@ describe :enumerable_take, shared: true do
end
it "raises an ArgumentError when count is negative" do
- lambda { @enum.send(@method, -1) }.should raise_error(ArgumentError)
+ -> { @enum.send(@method, -1) }.should raise_error(ArgumentError)
end
it "returns the entire array when count > length" do
@@ -40,11 +40,11 @@ describe :enumerable_take, shared: true do
end
it "raises a TypeError if the passed argument is not numeric" do
- lambda { @enum.send(@method, nil) }.should raise_error(TypeError)
- lambda { @enum.send(@method, "a") }.should raise_error(TypeError)
+ -> { @enum.send(@method, nil) }.should raise_error(TypeError)
+ -> { @enum.send(@method, "a") }.should raise_error(TypeError)
obj = mock("nonnumeric")
- lambda { @enum.send(@method, obj) }.should raise_error(TypeError)
+ -> { @enum.send(@method, obj) }.should raise_error(TypeError)
end
it "gathers whole arrays as elements when each yields multiple" do
diff --git a/spec/ruby/core/enumerable/slice_after_spec.rb b/spec/ruby/core/enumerable/slice_after_spec.rb
index c1bb7f0d83..0e46688db1 100644
--- a/spec/ruby/core/enumerable/slice_after_spec.rb
+++ b/spec/ruby/core/enumerable/slice_after_spec.rb
@@ -41,14 +41,14 @@ describe "Enumerable#slice_after" do
describe "and an argument" do
it "raises an ArgumentError" do
- lambda { @enum.slice_after(42) { |i| i == 6 } }.should raise_error(ArgumentError)
+ -> { @enum.slice_after(42) { |i| i == 6 } }.should raise_error(ArgumentError)
end
end
end
it "raises an ArgumentError when given an incorrect number of arguments" do
- lambda { @enum.slice_after("one", "two") }.should raise_error(ArgumentError)
- lambda { @enum.slice_after }.should raise_error(ArgumentError)
+ -> { @enum.slice_after("one", "two") }.should raise_error(ArgumentError)
+ -> { @enum.slice_after }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/enumerable/slice_before_spec.rb b/spec/ruby/core/enumerable/slice_before_spec.rb
index ad730be245..f9b33f7b28 100644
--- a/spec/ruby/core/enumerable/slice_before_spec.rb
+++ b/spec/ruby/core/enumerable/slice_before_spec.rb
@@ -41,15 +41,15 @@ describe "Enumerable#slice_before" do
end
it "does not accept arguments" do
- lambda {
+ -> {
@enum.slice_before(1) {}
}.should raise_error(ArgumentError)
end
end
it "raises an ArgumentError when given an incorrect number of arguments" do
- lambda { @enum.slice_before("one", "two") }.should raise_error(ArgumentError)
- lambda { @enum.slice_before }.should raise_error(ArgumentError)
+ -> { @enum.slice_before("one", "two") }.should raise_error(ArgumentError)
+ -> { @enum.slice_before }.should raise_error(ArgumentError)
end
describe "when an iterator method yields more than one value" do
diff --git a/spec/ruby/core/enumerable/slice_when_spec.rb b/spec/ruby/core/enumerable/slice_when_spec.rb
index 884b1a471c..6b8ea0923e 100644
--- a/spec/ruby/core/enumerable/slice_when_spec.rb
+++ b/spec/ruby/core/enumerable/slice_when_spec.rb
@@ -39,7 +39,7 @@ describe "Enumerable#slice_when" do
context "when not given a block" do
it "raises an ArgumentError" do
- lambda { @enum.slice_when }.should raise_error(ArgumentError)
+ -> { @enum.slice_when }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/enumerable/sort_spec.rb b/spec/ruby/core/enumerable/sort_spec.rb
index bf20e55f61..cff1a59986 100644
--- a/spec/ruby/core/enumerable/sort_spec.rb
+++ b/spec/ruby/core/enumerable/sort_spec.rb
@@ -14,7 +14,7 @@ describe "Enumerable#sort" do
end
it "raises a NoMethodError if elements do not define <=>" do
- lambda do
+ -> do
EnumerableSpecs::Numerous.new(BasicObject.new, BasicObject.new, BasicObject.new).sort
end.should raise_error(NoMethodError)
end
@@ -33,14 +33,14 @@ describe "Enumerable#sort" do
EnumerableSpecs::Numerous.new.sort { |n, m|
EnumerableSpecs::ComparableWithFixnum.new(-(n+m) * (n <=> m))
}.should == [6, 5, 4, 3, 2, 1]
- lambda {
+ -> {
EnumerableSpecs::Numerous.new.sort { |n, m| (n <=> m).to_s }
}.should raise_error(ArgumentError)
end
it "raises an error if objects can't be compared" do
a=EnumerableSpecs::Numerous.new(EnumerableSpecs::Uncomparable.new, EnumerableSpecs::Uncomparable.new)
- lambda {a.sort}.should raise_error(ArgumentError)
+ -> {a.sort}.should raise_error(ArgumentError)
end
it "gathers whole arrays as elements when each yields multiple" do
diff --git a/spec/ruby/core/enumerable/take_spec.rb b/spec/ruby/core/enumerable/take_spec.rb
index c0af372752..41a7438330 100644
--- a/spec/ruby/core/enumerable/take_spec.rb
+++ b/spec/ruby/core/enumerable/take_spec.rb
@@ -4,7 +4,7 @@ require_relative 'shared/take'
describe "Enumerable#take" do
it "requires an argument" do
- lambda{ EnumerableSpecs::Numerous.new.take}.should raise_error(ArgumentError)
+ ->{ EnumerableSpecs::Numerous.new.take}.should raise_error(ArgumentError)
end
describe "when passed an argument" do
diff --git a/spec/ruby/core/enumerable/to_h_spec.rb b/spec/ruby/core/enumerable/to_h_spec.rb
index f15ced122e..63bfdf19af 100644
--- a/spec/ruby/core/enumerable/to_h_spec.rb
+++ b/spec/ruby/core/enumerable/to_h_spec.rb
@@ -36,12 +36,12 @@ describe "Enumerable#to_h" do
it "raises TypeError if an element is not an array" do
enum = EnumerableSpecs::EachDefiner.new(:x)
- lambda { enum.to_h }.should raise_error(TypeError)
+ -> { enum.to_h }.should raise_error(TypeError)
end
it "raises ArgumentError if an element is not a [key, value] pair" do
enum = EnumerableSpecs::EachDefiner.new([:x])
- lambda { enum.to_h }.should raise_error(ArgumentError)
+ -> { enum.to_h }.should raise_error(ArgumentError)
end
ruby_version_is "2.6" do
diff --git a/spec/ruby/core/enumerator/arithmetic_sequence/new_spec.rb b/spec/ruby/core/enumerator/arithmetic_sequence/new_spec.rb
index 5a62d3f346..7227581fb9 100644
--- a/spec/ruby/core/enumerator/arithmetic_sequence/new_spec.rb
+++ b/spec/ruby/core/enumerator/arithmetic_sequence/new_spec.rb
@@ -3,7 +3,7 @@ require_relative '../../../spec_helper'
ruby_version_is "2.6" do
describe "Enumerator::ArithmeticSequence.new" do
it "is not defined" do
- lambda {
+ -> {
Enumerator::ArithmeticSequence.new
}.should raise_error(NoMethodError)
end
@@ -11,7 +11,7 @@ ruby_version_is "2.6" do
describe "Enumerator::ArithmeticSequence.allocate" do
it "is not defined" do
- lambda {
+ -> {
Enumerator::ArithmeticSequence.allocate
}.should raise_error(TypeError, 'allocator undefined for Enumerator::ArithmeticSequence')
end
diff --git a/spec/ruby/core/enumerator/chain/initialize_spec.rb b/spec/ruby/core/enumerator/chain/initialize_spec.rb
index 4ede1b8670..e5aa32fd02 100644
--- a/spec/ruby/core/enumerator/chain/initialize_spec.rb
+++ b/spec/ruby/core/enumerator/chain/initialize_spec.rb
@@ -24,7 +24,7 @@ ruby_version_is "2.6" do
describe "on frozen instance" do
it "raises a RuntimeError" do
- lambda {
+ -> {
@uninitialized.freeze.send(:initialize)
}.should raise_error(RuntimeError)
end
diff --git a/spec/ruby/core/enumerator/chain/rewind_spec.rb b/spec/ruby/core/enumerator/chain/rewind_spec.rb
index c6b82c831f..951b364f07 100644
--- a/spec/ruby/core/enumerator/chain/rewind_spec.rb
+++ b/spec/ruby/core/enumerator/chain/rewind_spec.rb
@@ -36,7 +36,7 @@ ruby_version_is "2.6" do
@obj.should_not_receive(:rewind)
@second.should_receive(:rewind).and_raise(RuntimeError)
@enum.each {}
- lambda { @enum.rewind }.should raise_error(RuntimeError)
+ -> { @enum.rewind }.should raise_error(RuntimeError)
end
it "calls rewind only for objects that have actually been iterated on" do
@@ -46,7 +46,7 @@ ruby_version_is "2.6" do
@obj.should_receive(:rewind)
@second.should_not_receive(:rewind)
- lambda { @enum.each {} }.should raise_error(RuntimeError)
+ -> { @enum.each {} }.should raise_error(RuntimeError)
@enum.rewind
end
end
diff --git a/spec/ruby/core/enumerator/each_spec.rb b/spec/ruby/core/enumerator/each_spec.rb
index f66951851e..d88c09cdb5 100644
--- a/spec/ruby/core/enumerator/each_spec.rb
+++ b/spec/ruby/core/enumerator/each_spec.rb
@@ -49,7 +49,7 @@ describe "Enumerator#each" do
it "raises a NoMethodError if the object doesn't respond to #each" do
enum = Object.new.to_enum
- lambda do
+ -> do
enum.each { |e| e }
end.should raise_error(NoMethodError)
end
diff --git a/spec/ruby/core/enumerator/each_with_index_spec.rb b/spec/ruby/core/enumerator/each_with_index_spec.rb
index 7332fd628b..96e53a2804 100644
--- a/spec/ruby/core/enumerator/each_with_index_spec.rb
+++ b/spec/ruby/core/enumerator/each_with_index_spec.rb
@@ -14,7 +14,7 @@ describe "Enumerator#each_with_index" do
end
it "raises an ArgumentError if passed extra arguments" do
- lambda do
+ -> do
[1].to_enum.each_with_index(:glark)
end.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/core/enumerator/feed_spec.rb b/spec/ruby/core/enumerator/feed_spec.rb
index 90f0af8f14..e387c6cd39 100644
--- a/spec/ruby/core/enumerator/feed_spec.rb
+++ b/spec/ruby/core/enumerator/feed_spec.rb
@@ -39,14 +39,14 @@ describe "Enumerator#feed" do
it "raises a TypeError if called more than once without advancing the enumerator" do
@enum.feed :a
@enum.next
- lambda { @enum.feed :b }.should raise_error(TypeError)
+ -> { @enum.feed :b }.should raise_error(TypeError)
end
it "sets the return value of Yielder#yield" do
enum = Enumerator.new { |y| ScratchPad << y.yield }
enum.next
enum.feed :a
- lambda { enum.next }.should raise_error(StopIteration)
+ -> { enum.next }.should raise_error(StopIteration)
ScratchPad.recorded.should == [:a]
end
end
diff --git a/spec/ruby/core/enumerator/generator/each_spec.rb b/spec/ruby/core/enumerator/generator/each_spec.rb
index cbdf863bec..a43805dd16 100644
--- a/spec/ruby/core/enumerator/generator/each_spec.rb
+++ b/spec/ruby/core/enumerator/generator/each_spec.rb
@@ -21,7 +21,7 @@ describe "Enumerator::Generator#each" do
end
it "raises a LocalJumpError if no block given" do
- lambda { @generator.each }.should raise_error(LocalJumpError)
+ -> { @generator.each }.should raise_error(LocalJumpError)
end
it "returns the block returned value" do
diff --git a/spec/ruby/core/enumerator/generator/initialize_spec.rb b/spec/ruby/core/enumerator/generator/initialize_spec.rb
index 38da37a479..f75c7d6f26 100644
--- a/spec/ruby/core/enumerator/generator/initialize_spec.rb
+++ b/spec/ruby/core/enumerator/generator/initialize_spec.rb
@@ -18,7 +18,7 @@ describe "Enumerator::Generator#initialize" do
describe "on frozen instance" do
it "raises a RuntimeError" do
- lambda {
+ -> {
@uninitialized.freeze.send(:initialize) {}
}.should raise_error(RuntimeError)
end
diff --git a/spec/ruby/core/enumerator/initialize_spec.rb b/spec/ruby/core/enumerator/initialize_spec.rb
index 1305f150dc..53bf5d4ef2 100644
--- a/spec/ruby/core/enumerator/initialize_spec.rb
+++ b/spec/ruby/core/enumerator/initialize_spec.rb
@@ -48,12 +48,12 @@ describe "Enumerator#initialize" do
end
it "sets size to the given size if the given size is a Proc" do
- @uninitialized.send(:initialize, lambda { 200 }) {}.size.should == 200
+ @uninitialized.send(:initialize, -> { 200 }) {}.size.should == 200
end
describe "on frozen instance" do
it "raises a RuntimeError" do
- lambda {
+ -> {
@uninitialized.freeze.send(:initialize) {}
}.should raise_error(RuntimeError)
end
diff --git a/spec/ruby/core/enumerator/lazy/drop_while_spec.rb b/spec/ruby/core/enumerator/lazy/drop_while_spec.rb
index 6f6472e393..4f6e366f88 100644
--- a/spec/ruby/core/enumerator/lazy/drop_while_spec.rb
+++ b/spec/ruby/core/enumerator/lazy/drop_while_spec.rb
@@ -40,7 +40,7 @@ describe "Enumerator::Lazy#drop_while" do
end
it "raises an ArgumentError when not given a block" do
- lambda { @yieldsmixed.drop_while }.should raise_error(ArgumentError)
+ -> { @yieldsmixed.drop_while }.should raise_error(ArgumentError)
end
describe "on a nested Lazy" do
diff --git a/spec/ruby/core/enumerator/lazy/grep_spec.rb b/spec/ruby/core/enumerator/lazy/grep_spec.rb
index e759cc4a2c..e67686c9a3 100644
--- a/spec/ruby/core/enumerator/lazy/grep_spec.rb
+++ b/spec/ruby/core/enumerator/lazy/grep_spec.rb
@@ -33,6 +33,39 @@ describe "Enumerator::Lazy#grep" do
Enumerator::Lazy.new(Object.new, 100) {}.grep(Object).size.should == nil
end
+ it "sets $~ in the block" do
+ "z" =~ /z/ # Reset $~
+ ["abc", "def"].lazy.grep(/b/) { |e|
+ e.should == "abc"
+ $&.should == "b"
+ }.force
+
+ # Set by the failed match of "def"
+ $~.should == nil
+ end
+
+ it "sets $~ in the next block with each" do
+ "z" =~ /z/ # Reset $~
+ ["abc", "def"].lazy.grep(/b/).each { |e|
+ e.should == "abc"
+ $&.should == "b"
+ }
+
+ # Set by the failed match of "def"
+ $~.should == nil
+ end
+
+ it "sets $~ in the next block with map" do
+ "z" =~ /z/ # Reset $~
+ ["abc", "def"].lazy.grep(/b/).map { |e|
+ e.should == "abc"
+ $&.should == "b"
+ }.force
+
+ # Set by the failed match of "def"
+ $~.should == nil
+ end
+
describe "when the returned lazy enumerator is evaluated by Enumerable#first" do
it "stops after specified times when not given a block" do
(0..Float::INFINITY).lazy.grep(Integer).first(3).should == [0, 1, 2]
diff --git a/spec/ruby/core/enumerator/lazy/grep_v_spec.rb b/spec/ruby/core/enumerator/lazy/grep_v_spec.rb
index 13d474a8c4..67173021bb 100644
--- a/spec/ruby/core/enumerator/lazy/grep_v_spec.rb
+++ b/spec/ruby/core/enumerator/lazy/grep_v_spec.rb
@@ -31,6 +31,39 @@ describe "Enumerator::Lazy#grep_v" do
Enumerator::Lazy.new(Object.new, 100) {}.grep_v(Object).size.should == nil
end
+ it "sets $~ in the block" do
+ "z" =~ /z/ # Reset $~
+ ["abc", "def"].lazy.grep_v(/e/) { |e|
+ e.should == "abc"
+ $~.should == nil
+ }.force
+
+ # Set by the match of "def"
+ $&.should == "e"
+ end
+
+ it "sets $~ in the next block with each" do
+ "z" =~ /z/ # Reset $~
+ ["abc", "def"].lazy.grep_v(/e/).each { |e|
+ e.should == "abc"
+ $~.should == nil
+ }
+
+ # Set by the match of "def"
+ $&.should == "e"
+ end
+
+ it "sets $~ in the next block with map" do
+ "z" =~ /z/ # Reset $~
+ ["abc", "def"].lazy.grep_v(/e/).map { |e|
+ e.should == "abc"
+ $~.should == nil
+ }.force
+
+ # Set by the match of "def"
+ $&.should == "e"
+ end
+
describe "when the returned lazy enumerator is evaluated by Enumerable#first" do
it "stops after specified times when not given a block" do
(0..Float::INFINITY).lazy.grep_v(3..5).first(3).should == [0, 1, 2]
diff --git a/spec/ruby/core/enumerator/lazy/initialize_spec.rb b/spec/ruby/core/enumerator/lazy/initialize_spec.rb
index 9fa6eff35a..88c66530b9 100644
--- a/spec/ruby/core/enumerator/lazy/initialize_spec.rb
+++ b/spec/ruby/core/enumerator/lazy/initialize_spec.rb
@@ -48,16 +48,16 @@ describe "Enumerator::Lazy#initialize" do
end
it "sets given size to own size if the given size is a Proc" do
- @uninitialized.send(:initialize, @receiver, lambda { 200 }) {}.size.should == 200
+ @uninitialized.send(:initialize, @receiver, -> { 200 }) {}.size.should == 200
end
it "raises an ArgumentError when block is not given" do
- lambda { @uninitialized.send :initialize, @receiver }.should raise_error(ArgumentError)
+ -> { @uninitialized.send :initialize, @receiver }.should raise_error(ArgumentError)
end
describe "on frozen instance" do
it "raises a RuntimeError" do
- lambda { @uninitialized.freeze.send(:initialize, @receiver) {} }.should raise_error(RuntimeError)
+ -> { @uninitialized.freeze.send(:initialize, @receiver) {} }.should raise_error(RuntimeError)
end
end
end
diff --git a/spec/ruby/core/enumerator/lazy/reject_spec.rb b/spec/ruby/core/enumerator/lazy/reject_spec.rb
index 03444b471f..0e1632d667 100644
--- a/spec/ruby/core/enumerator/lazy/reject_spec.rb
+++ b/spec/ruby/core/enumerator/lazy/reject_spec.rb
@@ -52,7 +52,7 @@ describe "Enumerator::Lazy#reject" do
end
it "raises an ArgumentError when not given a block" do
- lambda { @yieldsmixed.reject }.should raise_error(ArgumentError)
+ -> { @yieldsmixed.reject }.should raise_error(ArgumentError)
end
describe "on a nested Lazy" do
diff --git a/spec/ruby/core/enumerator/lazy/shared/collect_concat.rb b/spec/ruby/core/enumerator/lazy/shared/collect_concat.rb
index e8ee4b6940..00d7941a61 100644
--- a/spec/ruby/core/enumerator/lazy/shared/collect_concat.rb
+++ b/spec/ruby/core/enumerator/lazy/shared/collect_concat.rb
@@ -46,7 +46,7 @@ describe :enumerator_lazy_collect_concat, shared: true do
end
it "raises an ArgumentError when not given a block" do
- lambda { @yieldsmixed.send(@method) }.should raise_error(ArgumentError)
+ -> { @yieldsmixed.send(@method) }.should raise_error(ArgumentError)
end
describe "on a nested Lazy" do
diff --git a/spec/ruby/core/enumerator/lazy/shared/select.rb b/spec/ruby/core/enumerator/lazy/shared/select.rb
index 39074408ee..50a00bcbf4 100644
--- a/spec/ruby/core/enumerator/lazy/shared/select.rb
+++ b/spec/ruby/core/enumerator/lazy/shared/select.rb
@@ -40,7 +40,7 @@ describe :enumerator_lazy_select, shared: true do
end
it "raises an ArgumentError when not given a block" do
- lambda { @yieldsmixed.send(@method) }.should raise_error(ArgumentError)
+ -> { @yieldsmixed.send(@method) }.should raise_error(ArgumentError)
end
describe "on a nested Lazy" do
diff --git a/spec/ruby/core/enumerator/lazy/take_while_spec.rb b/spec/ruby/core/enumerator/lazy/take_while_spec.rb
index 412ff76787..bcea0b1419 100644
--- a/spec/ruby/core/enumerator/lazy/take_while_spec.rb
+++ b/spec/ruby/core/enumerator/lazy/take_while_spec.rb
@@ -40,7 +40,7 @@ describe "Enumerator::Lazy#take_while" do
end
it "raises an ArgumentError when not given a block" do
- lambda { @yieldsmixed.take_while }.should raise_error(ArgumentError)
+ -> { @yieldsmixed.take_while }.should raise_error(ArgumentError)
end
describe "on a nested Lazy" do
diff --git a/spec/ruby/core/enumerator/lazy/zip_spec.rb b/spec/ruby/core/enumerator/lazy/zip_spec.rb
index a28a7f5d5e..5a828c1dcc 100644
--- a/spec/ruby/core/enumerator/lazy/zip_spec.rb
+++ b/spec/ruby/core/enumerator/lazy/zip_spec.rb
@@ -44,7 +44,7 @@ describe "Enumerator::Lazy#zip" do
end
it "raises a TypeError if arguments contain non-list object" do
- lambda { @yieldsmixed.zip [], Object.new, [] }.should raise_error(TypeError)
+ -> { @yieldsmixed.zip [], Object.new, [] }.should raise_error(TypeError)
end
describe "on a nested Lazy" do
diff --git a/spec/ruby/core/enumerator/next_spec.rb b/spec/ruby/core/enumerator/next_spec.rb
index e0d3c0a39b..3e9ed8b015 100644
--- a/spec/ruby/core/enumerator/next_spec.rb
+++ b/spec/ruby/core/enumerator/next_spec.rb
@@ -13,14 +13,14 @@ describe "Enumerator#next" do
it "raises a StopIteration exception at the end of the stream" do
3.times { @enum.next }
- lambda { @enum.next }.should raise_error(StopIteration)
+ -> { @enum.next }.should raise_error(StopIteration)
end
it "cannot be called again until the enumerator is rewound" do
3.times { @enum.next }
- lambda { @enum.next }.should raise_error(StopIteration)
- lambda { @enum.next }.should raise_error(StopIteration)
- lambda { @enum.next }.should raise_error(StopIteration)
+ -> { @enum.next }.should raise_error(StopIteration)
+ -> { @enum.next }.should raise_error(StopIteration)
+ -> { @enum.next }.should raise_error(StopIteration)
@enum.rewind
@enum.next.should == 1
end
diff --git a/spec/ruby/core/enumerator/next_values_spec.rb b/spec/ruby/core/enumerator/next_values_spec.rb
index 8b57332c28..201b5d323f 100644
--- a/spec/ruby/core/enumerator/next_values_spec.rb
+++ b/spec/ruby/core/enumerator/next_values_spec.rb
@@ -50,6 +50,6 @@ describe "Enumerator#next_values" do
it "raises StopIteration if called on a finished enumerator" do
7.times { @e.next }
- lambda { @e.next_values }.should raise_error(StopIteration)
+ -> { @e.next_values }.should raise_error(StopIteration)
end
end
diff --git a/spec/ruby/core/enumerator/peek_spec.rb b/spec/ruby/core/enumerator/peek_spec.rb
index 0e4f60893d..2334385437 100644
--- a/spec/ruby/core/enumerator/peek_spec.rb
+++ b/spec/ruby/core/enumerator/peek_spec.rb
@@ -31,6 +31,6 @@ describe "Enumerator#peek" do
it "raises StopIteration if called on a finished enumerator" do
5.times { @e.next }
- lambda { @e.peek }.should raise_error(StopIteration)
+ -> { @e.peek }.should raise_error(StopIteration)
end
end
diff --git a/spec/ruby/core/enumerator/peek_values_spec.rb b/spec/ruby/core/enumerator/peek_values_spec.rb
index 5c81b4e529..7865546515 100644
--- a/spec/ruby/core/enumerator/peek_values_spec.rb
+++ b/spec/ruby/core/enumerator/peek_values_spec.rb
@@ -52,6 +52,6 @@ describe "Enumerator#peek_values" do
it "raises StopIteration if called on a finished enumerator" do
7.times { @e.next }
- lambda { @e.peek_values }.should raise_error(StopIteration)
+ -> { @e.peek_values }.should raise_error(StopIteration)
end
end
diff --git a/spec/ruby/core/enumerator/rewind_spec.rb b/spec/ruby/core/enumerator/rewind_spec.rb
index 2a83b7c6ee..a105f2c619 100644
--- a/spec/ruby/core/enumerator/rewind_spec.rb
+++ b/spec/ruby/core/enumerator/rewind_spec.rb
@@ -49,7 +49,7 @@ describe "Enumerator#rewind" do
obj = mock('rewinder')
enum = obj.to_enum
obj.should_receive(:each).at_most(1)
- lambda { enum.rewind.should == enum }.should_not raise_error
+ -> { enum.rewind.should == enum }.should_not raise_error
end
end
diff --git a/spec/ruby/core/enumerator/size_spec.rb b/spec/ruby/core/enumerator/size_spec.rb
index 5729b9303d..6accd26a4e 100644
--- a/spec/ruby/core/enumerator/size_spec.rb
+++ b/spec/ruby/core/enumerator/size_spec.rb
@@ -11,7 +11,7 @@ describe "Enumerator#size" do
it "returns returning value from size.call if set size is a Proc" do
base_size = 100
- enum = Enumerator.new(lambda { base_size + 1 }) {}
+ enum = Enumerator.new(-> { base_size + 1 }) {}
base_size = 200
enum.size.should == 201
base_size = 300
diff --git a/spec/ruby/core/enumerator/with_index_spec.rb b/spec/ruby/core/enumerator/with_index_spec.rb
index ca9f5a133e..ac37cee508 100644
--- a/spec/ruby/core/enumerator/with_index_spec.rb
+++ b/spec/ruby/core/enumerator/with_index_spec.rb
@@ -14,13 +14,13 @@ describe "Enumerator#with_index" do
end
it "accepts an optional argument when given a block" do
- lambda do
+ -> do
@enum.with_index(1) { |f| f}
end.should_not raise_error(ArgumentError)
end
it "accepts an optional argument when not given a block" do
- lambda do
+ -> do
@enum.with_index(1)
end.should_not raise_error(ArgumentError)
end
@@ -36,7 +36,7 @@ describe "Enumerator#with_index" do
end
it "raises a TypeError when the argument cannot be converted to numeric" do
- lambda do
+ -> do
@enum.with_index('1') {|*i| i}
end.should raise_error(TypeError)
end
diff --git a/spec/ruby/core/env/fetch_spec.rb b/spec/ruby/core/env/fetch_spec.rb
index c8a11430ab..eeaf290cf0 100644
--- a/spec/ruby/core/env/fetch_spec.rb
+++ b/spec/ruby/core/env/fetch_spec.rb
@@ -9,11 +9,11 @@ describe "ENV.fetch" do
end
it "raises a TypeError if the key is not a String" do
- lambda { ENV.fetch :should_never_be_set }.should raise_error(TypeError)
+ -> { ENV.fetch :should_never_be_set }.should raise_error(TypeError)
end
context "when the key is not found" do
- it_behaves_like :key_error, ->(obj, key) { obj.fetch(key) }, ENV
+ it_behaves_like :key_error, -> obj, key { obj.fetch(key) }, ENV
it "formats the object with #inspect in the KeyError message" do
-> {
@@ -31,7 +31,7 @@ describe "ENV.fetch" do
end
it "warns on block and default parameter given" do
- lambda do
+ -> do
ENV.fetch("should_never_be_set", "default") { 1 }.should == 1
end.should complain(/block supersedes default value argument/)
end
diff --git a/spec/ruby/core/env/reject_spec.rb b/spec/ruby/core/env/reject_spec.rb
index 409efa1385..1026c2f451 100644
--- a/spec/ruby/core/env/reject_spec.rb
+++ b/spec/ruby/core/env/reject_spec.rb
@@ -29,7 +29,7 @@ describe "ENV.reject!" do
orig = ENV.to_hash
begin
ENV.clear
- lambda { ENV.reject! }.should_not raise_error(LocalJumpError)
+ -> { ENV.reject! }.should_not raise_error(LocalJumpError)
ensure
ENV.replace orig
end
@@ -67,7 +67,7 @@ describe "ENV.reject" do
orig = ENV.to_hash
begin
ENV.clear
- lambda { ENV.reject }.should_not raise_error(LocalJumpError)
+ -> { ENV.reject }.should_not raise_error(LocalJumpError)
ensure
ENV.replace orig
end
diff --git a/spec/ruby/core/env/shared/store.rb b/spec/ruby/core/env/shared/store.rb
index 4949ca8c73..6ae91ef8fc 100644
--- a/spec/ruby/core/env/shared/store.rb
+++ b/spec/ruby/core/env/shared/store.rb
@@ -34,19 +34,19 @@ describe :env_store, shared: true do
end
it "raises TypeError when the key is not coercible to String" do
- lambda { ENV.send(@method, Object.new, "bar") }.should raise_error(TypeError)
+ -> { ENV.send(@method, Object.new, "bar") }.should raise_error(TypeError)
end
it "raises TypeError when the value is not coercible to String" do
- lambda { ENV.send(@method, "foo", Object.new) }.should raise_error(TypeError)
+ -> { ENV.send(@method, "foo", Object.new) }.should raise_error(TypeError)
end
it "raises Errno::EINVAL when the key contains the '=' character" do
- lambda { ENV.send(@method, "foo=", "bar") }.should raise_error(Errno::EINVAL)
+ -> { ENV.send(@method, "foo=", "bar") }.should raise_error(Errno::EINVAL)
end
it "raises Errno::EINVAL when the key is an empty string" do
- lambda { ENV.send(@method, "", "bar") }.should raise_error(Errno::EINVAL)
+ -> { ENV.send(@method, "", "bar") }.should raise_error(Errno::EINVAL)
end
it "does nothing when the key is not a valid environment variable key and the value is nil" do
diff --git a/spec/ruby/core/exception/dup_spec.rb b/spec/ruby/core/exception/dup_spec.rb
index c7fcd280dd..edd54bfb37 100644
--- a/spec/ruby/core/exception/dup_spec.rb
+++ b/spec/ruby/core/exception/dup_spec.rb
@@ -20,7 +20,7 @@ describe "Exception#dup" do
it "does not copy singleton methods" do
def @obj.special() :the_one end
dup = @obj.dup
- lambda { dup.special }.should raise_error(NameError)
+ -> { dup.special }.should raise_error(NameError)
end
it "does not copy modules included in the singleton class" do
@@ -29,7 +29,7 @@ describe "Exception#dup" do
end
dup = @obj.dup
- lambda { dup.repr }.should raise_error(NameError)
+ -> { dup.repr }.should raise_error(NameError)
end
it "does not copy constants defined in the singleton class" do
@@ -38,7 +38,7 @@ describe "Exception#dup" do
end
dup = @obj.dup
- lambda { class << dup; CLONE; end }.should raise_error(NameError)
+ -> { class << dup; CLONE; end }.should raise_error(NameError)
end
it "does copy the message" do
diff --git a/spec/ruby/core/exception/result_spec.rb b/spec/ruby/core/exception/result_spec.rb
index 62247e9d85..5ba26ebab1 100644
--- a/spec/ruby/core/exception/result_spec.rb
+++ b/spec/ruby/core/exception/result_spec.rb
@@ -20,7 +20,7 @@ describe "StopIteration#result" do
it "returns the method-returned-object from an Enumerator" do
@enum.next
@enum.next
- lambda { @enum.next }.should(
+ -> { @enum.next }.should(
raise_error(StopIteration) do |error|
error.result.should equal(:method_returned)
end
diff --git a/spec/ruby/core/exception/set_backtrace_spec.rb b/spec/ruby/core/exception/set_backtrace_spec.rb
index 4ebe574dcb..ba2e1bf7aa 100644
--- a/spec/ruby/core/exception/set_backtrace_spec.rb
+++ b/spec/ruby/core/exception/set_backtrace_spec.rb
@@ -36,21 +36,21 @@ describe "Exception#set_backtrace" do
it "raises a TypeError when passed a Symbol" do
err = RuntimeError.new
- lambda { err.set_backtrace :unhappy }.should raise_error(TypeError)
+ -> { err.set_backtrace :unhappy }.should raise_error(TypeError)
end
it "raises a TypeError when the Array contains a Symbol" do
err = RuntimeError.new
- lambda { err.set_backtrace ["String", :unhappy] }.should raise_error(TypeError)
+ -> { err.set_backtrace ["String", :unhappy] }.should raise_error(TypeError)
end
it "raises a TypeError when the array contains nil" do
err = Exception.new
- lambda { err.set_backtrace ["String", nil] }.should raise_error(TypeError)
+ -> { err.set_backtrace ["String", nil] }.should raise_error(TypeError)
end
it "raises a TypeError when the argument is a nested array" do
err = Exception.new
- lambda { err.set_backtrace ["String", ["String"]] }.should raise_error(TypeError)
+ -> { err.set_backtrace ["String", ["String"]] }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/exception/signal_exception_spec.rb b/spec/ruby/core/exception/signal_exception_spec.rb
index 8e2f273a67..e0b30236f7 100644
--- a/spec/ruby/core/exception/signal_exception_spec.rb
+++ b/spec/ruby/core/exception/signal_exception_spec.rb
@@ -9,7 +9,7 @@ describe "SignalException.new" do
end
it "raises an exception with an invalid signal number" do
- lambda { SignalException.new(100000) }.should raise_error(ArgumentError)
+ -> { SignalException.new(100000) }.should raise_error(ArgumentError)
end
it "takes a signal name without SIG prefix as the first argument" do
@@ -27,7 +27,7 @@ describe "SignalException.new" do
end
it "raises an exception with an invalid signal name" do
- lambda { SignalException.new("NONEXISTENT") }.should raise_error(ArgumentError)
+ -> { SignalException.new("NONEXISTENT") }.should raise_error(ArgumentError)
end
it "takes a signal symbol without SIG prefix as the first argument" do
@@ -45,7 +45,7 @@ describe "SignalException.new" do
end
it "raises an exception with an invalid signal name" do
- lambda { SignalException.new(:NONEXISTENT) }.should raise_error(ArgumentError)
+ -> { SignalException.new(:NONEXISTENT) }.should raise_error(ArgumentError)
end
it "takes an optional message argument with a signal number" do
@@ -56,7 +56,7 @@ describe "SignalException.new" do
end
it "raises an exception for an optional argument with a signal name" do
- lambda { SignalException.new("INT","name") }.should raise_error(ArgumentError)
+ -> { SignalException.new("INT","name") }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/exception/system_call_error_spec.rb b/spec/ruby/core/exception/system_call_error_spec.rb
index d9e303bad8..c07c8af72c 100644
--- a/spec/ruby/core/exception/system_call_error_spec.rb
+++ b/spec/ruby/core/exception/system_call_error_spec.rb
@@ -21,7 +21,7 @@ end
describe "SystemCallError.new" do
it "requires at least one argument" do
- lambda { SystemCallError.new }.should raise_error(ArgumentError)
+ -> { SystemCallError.new }.should raise_error(ArgumentError)
end
it "accepts single Fixnum argument as errno" do
diff --git a/spec/ruby/core/false/falseclass_spec.rb b/spec/ruby/core/false/falseclass_spec.rb
index a944edd348..c018ef2421 100644
--- a/spec/ruby/core/false/falseclass_spec.rb
+++ b/spec/ruby/core/false/falseclass_spec.rb
@@ -2,13 +2,13 @@ require_relative '../../spec_helper'
describe "FalseClass" do
it ".allocate raises a TypeError" do
- lambda do
+ -> do
FalseClass.allocate
end.should raise_error(TypeError)
end
it ".new is undefined" do
- lambda do
+ -> do
FalseClass.new
end.should raise_error(NoMethodError)
end
diff --git a/spec/ruby/core/fiber/new_spec.rb b/spec/ruby/core/fiber/new_spec.rb
index c2175cb612..b43c1386be 100644
--- a/spec/ruby/core/fiber/new_spec.rb
+++ b/spec/ruby/core/fiber/new_spec.rb
@@ -16,7 +16,7 @@ describe "Fiber.new" do
end
it "raises an ArgumentError if called without a block" do
- lambda { Fiber.new }.should raise_error(ArgumentError)
+ -> { Fiber.new }.should raise_error(ArgumentError)
end
it "does not invoke the block" do
diff --git a/spec/ruby/core/fiber/yield_spec.rb b/spec/ruby/core/fiber/yield_spec.rb
index 4e241d5921..b010912c87 100644
--- a/spec/ruby/core/fiber/yield_spec.rb
+++ b/spec/ruby/core/fiber/yield_spec.rb
@@ -44,6 +44,6 @@ describe "Fiber.yield" do
end
it "raises a FiberError if called from the root Fiber" do
- lambda{ Fiber.yield }.should raise_error(FiberError)
+ ->{ Fiber.yield }.should raise_error(FiberError)
end
end
diff --git a/spec/ruby/core/file/atime_spec.rb b/spec/ruby/core/file/atime_spec.rb
index c791aa6d74..02e8412722 100644
--- a/spec/ruby/core/file/atime_spec.rb
+++ b/spec/ruby/core/file/atime_spec.rb
@@ -30,7 +30,7 @@ describe "File.atime" do
end
it "raises an Errno::ENOENT exception if the file is not found" do
- lambda { File.atime('a_fake_file') }.should raise_error(Errno::ENOENT)
+ -> { File.atime('a_fake_file') }.should raise_error(Errno::ENOENT)
end
it "accepts an object that has a #to_path method" do
diff --git a/spec/ruby/core/file/basename_spec.rb b/spec/ruby/core/file/basename_spec.rb
index 50365b1125..6d7e432086 100644
--- a/spec/ruby/core/file/basename_spec.rb
+++ b/spec/ruby/core/file/basename_spec.rb
@@ -105,10 +105,10 @@ describe "File.basename" do
end
it "raises a TypeError if the arguments are not String types" do
- lambda { File.basename(nil) }.should raise_error(TypeError)
- lambda { File.basename(1) }.should raise_error(TypeError)
- lambda { File.basename("bar.txt", 1) }.should raise_error(TypeError)
- lambda { File.basename(true) }.should raise_error(TypeError)
+ -> { File.basename(nil) }.should raise_error(TypeError)
+ -> { File.basename(1) }.should raise_error(TypeError)
+ -> { File.basename("bar.txt", 1) }.should raise_error(TypeError)
+ -> { File.basename(true) }.should raise_error(TypeError)
end
it "accepts an object that has a #to_path method" do
@@ -116,7 +116,7 @@ describe "File.basename" do
end
it "raises an ArgumentError if passed more than two arguments" do
- lambda { File.basename('bar.txt', '.txt', '.txt') }.should raise_error(ArgumentError)
+ -> { File.basename('bar.txt', '.txt', '.txt') }.should raise_error(ArgumentError)
end
# specific to MS Windows
diff --git a/spec/ruby/core/file/birthtime_spec.rb b/spec/ruby/core/file/birthtime_spec.rb
index cab749f7b4..755601df64 100644
--- a/spec/ruby/core/file/birthtime_spec.rb
+++ b/spec/ruby/core/file/birthtime_spec.rb
@@ -20,13 +20,13 @@ describe "File.birthtime" do
end
it "raises an Errno::ENOENT exception if the file is not found" do
- lambda { File.birthtime('bogus') }.should raise_error(Errno::ENOENT)
+ -> { File.birthtime('bogus') }.should raise_error(Errno::ENOENT)
end
end
platform_is :openbsd do
it "raises an NotImplementedError" do
- lambda { File.birthtime(@file) }.should raise_error(NotImplementedError)
+ -> { File.birthtime(@file) }.should raise_error(NotImplementedError)
end
end
@@ -52,7 +52,7 @@ describe "File#birthtime" do
platform_is :openbsd do
it "raises an NotImplementedError" do
- lambda { @file.birthtime }.should raise_error(NotImplementedError)
+ -> { @file.birthtime }.should raise_error(NotImplementedError)
end
end
diff --git a/spec/ruby/core/file/chmod_spec.rb b/spec/ruby/core/file/chmod_spec.rb
index 6c4e1099e3..86171691f6 100644
--- a/spec/ruby/core/file/chmod_spec.rb
+++ b/spec/ruby/core/file/chmod_spec.rb
@@ -106,11 +106,11 @@ describe "File.chmod" do
end
it "throws a TypeError if the given path is not coercable into a string" do
- lambda { File.chmod(0, []) }.should raise_error(TypeError)
+ -> { File.chmod(0, []) }.should raise_error(TypeError)
end
it "raises an error for a non existent path" do
- lambda {
+ -> {
File.chmod(0644, "#{@file}.not.existing")
}.should raise_error(Errno::ENOENT)
end
diff --git a/spec/ruby/core/file/chown_spec.rb b/spec/ruby/core/file/chown_spec.rb
index 512d5b4738..8cc8f0d04b 100644
--- a/spec/ruby/core/file/chown_spec.rb
+++ b/spec/ruby/core/file/chown_spec.rb
@@ -66,7 +66,7 @@ describe "File.chown" do
platform_is_not :windows do
it "raises an error for a non existent path" do
- lambda {
+ -> {
File.chown(nil, nil, "#{@fname}_not_existing")
}.should raise_error(Errno::ENOENT)
end
diff --git a/spec/ruby/core/file/ctime_spec.rb b/spec/ruby/core/file/ctime_spec.rb
index 5753e0d90e..68a9fa43cb 100644
--- a/spec/ruby/core/file/ctime_spec.rb
+++ b/spec/ruby/core/file/ctime_spec.rb
@@ -30,7 +30,7 @@ describe "File.ctime" do
end
it "raises an Errno::ENOENT exception if the file is not found" do
- lambda { File.ctime('bogus') }.should raise_error(Errno::ENOENT)
+ -> { File.ctime('bogus') }.should raise_error(Errno::ENOENT)
end
end
diff --git a/spec/ruby/core/file/dirname_spec.rb b/spec/ruby/core/file/dirname_spec.rb
index 0447a4e471..2ef04a7b64 100644
--- a/spec/ruby/core/file/dirname_spec.rb
+++ b/spec/ruby/core/file/dirname_spec.rb
@@ -72,10 +72,10 @@ describe "File.dirname" do
end
it "raises a TypeError if not passed a String type" do
- lambda { File.dirname(nil) }.should raise_error(TypeError)
- lambda { File.dirname(0) }.should raise_error(TypeError)
- lambda { File.dirname(true) }.should raise_error(TypeError)
- lambda { File.dirname(false) }.should raise_error(TypeError)
+ -> { File.dirname(nil) }.should raise_error(TypeError)
+ -> { File.dirname(0) }.should raise_error(TypeError)
+ -> { File.dirname(true) }.should raise_error(TypeError)
+ -> { File.dirname(false) }.should raise_error(TypeError)
end
# Windows specific tests
diff --git a/spec/ruby/core/file/expand_path_spec.rb b/spec/ruby/core/file/expand_path_spec.rb
index aa6a3c9c63..88078645ab 100644
--- a/spec/ruby/core/file/expand_path_spec.rb
+++ b/spec/ruby/core/file/expand_path_spec.rb
@@ -92,7 +92,7 @@ describe "File.expand_path" do
end
it "raises an ArgumentError if the path is not valid" do
- lambda { File.expand_path("~a_not_existing_user") }.should raise_error(ArgumentError)
+ -> { File.expand_path("~a_not_existing_user") }.should raise_error(ArgumentError)
end
it "expands ~ENV['USER'] to the user's home directory" do
@@ -117,9 +117,9 @@ describe "File.expand_path" do
end
it "raises a TypeError if not passed a String type" do
- lambda { File.expand_path(1) }.should raise_error(TypeError)
- lambda { File.expand_path(nil) }.should raise_error(TypeError)
- lambda { File.expand_path(true) }.should raise_error(TypeError)
+ -> { File.expand_path(1) }.should raise_error(TypeError)
+ -> { File.expand_path(nil) }.should raise_error(TypeError)
+ -> { File.expand_path(true) }.should raise_error(TypeError)
end
platform_is_not :windows do
@@ -159,7 +159,7 @@ describe "File.expand_path" do
platform_is_not :windows do
it "raises an Encoding::CompatibilityError if the external encoding is not compatible" do
Encoding.default_external = Encoding::UTF_16BE
- lambda { File.expand_path("./a") }.should raise_error(Encoding::CompatibilityError)
+ -> { File.expand_path("./a") }.should raise_error(Encoding::CompatibilityError)
end
end
@@ -244,7 +244,7 @@ platform_is_not :windows do
it "raises an ArgumentError when passed '~' if HOME == ''" do
ENV["HOME"] = ""
- lambda { File.expand_path("~") }.should raise_error(ArgumentError)
+ -> { File.expand_path("~") }.should raise_error(ArgumentError)
end
end
@@ -259,7 +259,7 @@ platform_is_not :windows do
it "raises an ArgumentError" do
ENV["HOME"] = "non-absolute"
- lambda { File.expand_path("~") }.should raise_error(ArgumentError, 'non-absolute home')
+ -> { File.expand_path("~") }.should raise_error(ArgumentError, 'non-absolute home')
end
end
end
diff --git a/spec/ruby/core/file/extname_spec.rb b/spec/ruby/core/file/extname_spec.rb
index 7632b6adc0..358690b44a 100644
--- a/spec/ruby/core/file/extname_spec.rb
+++ b/spec/ruby/core/file/extname_spec.rb
@@ -33,15 +33,15 @@ describe "File.extname" do
end
it "raises a TypeError if not passed a String type" do
- lambda { File.extname(nil) }.should raise_error(TypeError)
- lambda { File.extname(0) }.should raise_error(TypeError)
- lambda { File.extname(true) }.should raise_error(TypeError)
- lambda { File.extname(false) }.should raise_error(TypeError)
+ -> { File.extname(nil) }.should raise_error(TypeError)
+ -> { File.extname(0) }.should raise_error(TypeError)
+ -> { File.extname(true) }.should raise_error(TypeError)
+ -> { File.extname(false) }.should raise_error(TypeError)
end
it "raises an ArgumentError if not passed one argument" do
- lambda { File.extname }.should raise_error(ArgumentError)
- lambda { File.extname("foo.bar", "foo.baz") }.should raise_error(ArgumentError)
+ -> { File.extname }.should raise_error(ArgumentError)
+ -> { File.extname("foo.bar", "foo.baz") }.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/core/file/flock_spec.rb b/spec/ruby/core/file/flock_spec.rb
index 6990915a65..751e99d994 100644
--- a/spec/ruby/core/file/flock_spec.rb
+++ b/spec/ruby/core/file/flock_spec.rb
@@ -92,13 +92,13 @@ platform_is :solaris do
end
it "fails with EBADF acquiring exclusive lock on read-only File" do
- lambda do
+ -> do
@read_file.flock File::LOCK_EX
end.should raise_error(Errno::EBADF)
end
it "fails with EBADF acquiring shared lock on read-only File" do
- lambda do
+ -> do
@write_file.flock File::LOCK_SH
end.should raise_error(Errno::EBADF)
end
diff --git a/spec/ruby/core/file/ftype_spec.rb b/spec/ruby/core/file/ftype_spec.rb
index e92f04da2c..20e9af7e5f 100644
--- a/spec/ruby/core/file/ftype_spec.rb
+++ b/spec/ruby/core/file/ftype_spec.rb
@@ -7,12 +7,12 @@ describe "File.ftype" do
end
it "raises ArgumentError if not given exactly one filename" do
- lambda { File.ftype }.should raise_error(ArgumentError)
- lambda { File.ftype('blah', 'bleh') }.should raise_error(ArgumentError)
+ -> { File.ftype }.should raise_error(ArgumentError)
+ -> { File.ftype('blah', 'bleh') }.should raise_error(ArgumentError)
end
it "raises Errno::ENOENT if the file is not valid" do
- l = lambda { File.ftype("/#{$$}#{Time.now.to_f}") }
+ l = -> { File.ftype("/#{$$}#{Time.now.to_f}") }
l.should raise_error(Errno::ENOENT)
end
diff --git a/spec/ruby/core/file/join_spec.rb b/spec/ruby/core/file/join_spec.rb
index 333b566c3d..f1eab02de0 100644
--- a/spec/ruby/core/file/join_spec.rb
+++ b/spec/ruby/core/file/join_spec.rb
@@ -104,15 +104,15 @@ describe "File.join" do
it "raises an ArgumentError if passed a recursive array" do
a = ["a"]
a << a
- lambda { File.join a }.should raise_error(ArgumentError)
+ -> { File.join a }.should raise_error(ArgumentError)
end
it "raises a TypeError exception when args are nil" do
- lambda { File.join nil }.should raise_error(TypeError)
+ -> { File.join nil }.should raise_error(TypeError)
end
it "calls #to_str" do
- lambda { File.join(mock('x')) }.should raise_error(TypeError)
+ -> { File.join(mock('x')) }.should raise_error(TypeError)
bin = mock("bin")
bin.should_receive(:to_str).exactly(:twice).and_return("bin")
@@ -129,7 +129,7 @@ describe "File.join" do
end
it "calls #to_path" do
- lambda { File.join(mock('x')) }.should raise_error(TypeError)
+ -> { File.join(mock('x')) }.should raise_error(TypeError)
bin = mock("bin")
bin.should_receive(:to_path).exactly(:twice).and_return("bin")
diff --git a/spec/ruby/core/file/lchmod_spec.rb b/spec/ruby/core/file/lchmod_spec.rb
index 7be09a05ef..9490459a02 100644
--- a/spec/ruby/core/file/lchmod_spec.rb
+++ b/spec/ruby/core/file/lchmod_spec.rb
@@ -36,7 +36,7 @@ describe "File.lchmod" do
end
it "raises a NotImplementedError when called" do
- lambda { File.lchmod 0 }.should raise_error(NotImplementedError)
+ -> { File.lchmod 0 }.should raise_error(NotImplementedError)
end
end
end
diff --git a/spec/ruby/core/file/link_spec.rb b/spec/ruby/core/file/link_spec.rb
index 4e186c6076..11d4c8d25b 100644
--- a/spec/ruby/core/file/link_spec.rb
+++ b/spec/ruby/core/file/link_spec.rb
@@ -22,18 +22,18 @@ describe "File.link" do
it "raises an Errno::EEXIST if the target already exists" do
File.link(@file, @link)
- lambda { File.link(@file, @link) }.should raise_error(Errno::EEXIST)
+ -> { File.link(@file, @link) }.should raise_error(Errno::EEXIST)
end
it "raises an ArgumentError if not passed two arguments" do
- lambda { File.link }.should raise_error(ArgumentError)
- lambda { File.link(@file) }.should raise_error(ArgumentError)
- lambda { File.link(@file, @link, @file) }.should raise_error(ArgumentError)
+ -> { File.link }.should raise_error(ArgumentError)
+ -> { File.link(@file) }.should raise_error(ArgumentError)
+ -> { File.link(@file, @link, @file) }.should raise_error(ArgumentError)
end
it "raises a TypeError if not passed String types" do
- lambda { File.link(@file, nil) }.should raise_error(TypeError)
- lambda { File.link(@file, 1) }.should raise_error(TypeError)
+ -> { File.link(@file, nil) }.should raise_error(TypeError)
+ -> { File.link(@file, 1) }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/core/file/mkfifo_spec.rb b/spec/ruby/core/file/mkfifo_spec.rb
index a6db87a12e..19298c967c 100644
--- a/spec/ruby/core/file/mkfifo_spec.rb
+++ b/spec/ruby/core/file/mkfifo_spec.rb
@@ -19,13 +19,13 @@ describe "File.mkfifo" do
context "when path passed is not a String value" do
it "raises a TypeError" do
- lambda { File.mkfifo(:"/tmp/fifo") }.should raise_error(TypeError)
+ -> { File.mkfifo(:"/tmp/fifo") }.should raise_error(TypeError)
end
end
context "when path does not exist" do
it "raises an Errno::ENOENT exception" do
- lambda { File.mkfifo("/bogus/path") }.should raise_error(Errno::ENOENT)
+ -> { File.mkfifo("/bogus/path") }.should raise_error(Errno::ENOENT)
end
end
diff --git a/spec/ruby/core/file/mtime_spec.rb b/spec/ruby/core/file/mtime_spec.rb
index 833f759eaa..1941e2ff85 100644
--- a/spec/ruby/core/file/mtime_spec.rb
+++ b/spec/ruby/core/file/mtime_spec.rb
@@ -29,7 +29,7 @@ describe "File.mtime" do
end
it "raises an Errno::ENOENT exception if the file is not found" do
- lambda { File.mtime('bogus') }.should raise_error(Errno::ENOENT)
+ -> { File.mtime('bogus') }.should raise_error(Errno::ENOENT)
end
end
diff --git a/spec/ruby/core/file/new_spec.rb b/spec/ruby/core/file/new_spec.rb
index 3bb2712ada..e99f6ba72b 100644
--- a/spec/ruby/core/file/new_spec.rb
+++ b/spec/ruby/core/file/new_spec.rb
@@ -44,7 +44,7 @@ describe "File.new" do
rm_r @file
begin
f = File.new(@file, "w", 0444)
- lambda { f.puts("test") }.should_not raise_error(IOError)
+ -> { f.puts("test") }.should_not raise_error(IOError)
ensure
f.close
end
@@ -85,7 +85,7 @@ describe "File.new" do
end
it "raises an Errorno::EEXIST if the file exists when create a new file with File::CREAT|File::EXCL" do
- lambda { @fh = File.new(@file, File::CREAT|File::EXCL) }.should raise_error(Errno::EEXIST)
+ -> { @fh = File.new(@file, File::CREAT|File::EXCL) }.should raise_error(Errno::EEXIST)
end
it "creates a new file when use File::WRONLY|File::APPEND mode" do
@@ -134,22 +134,22 @@ describe "File.new" do
end
it "raises a TypeError if the first parameter can't be coerced to a string" do
- lambda { File.new(true) }.should raise_error(TypeError)
- lambda { File.new(false) }.should raise_error(TypeError)
+ -> { File.new(true) }.should raise_error(TypeError)
+ -> { File.new(false) }.should raise_error(TypeError)
end
it "raises a TypeError if the first parameter is nil" do
- lambda { File.new(nil) }.should raise_error(TypeError)
+ -> { File.new(nil) }.should raise_error(TypeError)
end
it "raises an Errno::EBADF if the first parameter is an invalid file descriptor" do
- lambda { File.new(-1) }.should raise_error(Errno::EBADF)
+ -> { File.new(-1) }.should raise_error(Errno::EBADF)
end
platform_is_not :windows do
it "can't alter mode or permissions when opening a file" do
@fh = File.new(@file)
- lambda {
+ -> {
f = File.new(@fh.fileno, @flags)
f.autoclose = false
}.should raise_error(Errno::EINVAL)
diff --git a/spec/ruby/core/file/open_spec.rb b/spec/ruby/core/file/open_spec.rb
index 59c13f08ed..d946fc5ecf 100644
--- a/spec/ruby/core/file/open_spec.rb
+++ b/spec/ruby/core/file/open_spec.rb
@@ -38,7 +38,7 @@ describe "File.open" do
end
it "propagates non-StandardErrors produced by close" do
- lambda {
+ -> {
File.open(@file, 'r') { |f| FileSpecs.make_closer f, Exception }
}.should raise_error(Exception)
@@ -46,7 +46,7 @@ describe "File.open" do
end
it "propagates StandardErrors produced by close" do
- lambda {
+ -> {
File.open(@file, 'r') { |f| FileSpecs.make_closer f, StandardError }
}.should raise_error(StandardError)
@@ -166,40 +166,40 @@ describe "File.open" do
end
it "opens a file that no exists when use File::WRONLY mode" do
- lambda { File.open(@nonexistent, File::WRONLY) }.should raise_error(Errno::ENOENT)
+ -> { File.open(@nonexistent, File::WRONLY) }.should raise_error(Errno::ENOENT)
end
it "opens a file that no exists when use File::RDONLY mode" do
- lambda { File.open(@nonexistent, File::RDONLY) }.should raise_error(Errno::ENOENT)
+ -> { File.open(@nonexistent, File::RDONLY) }.should raise_error(Errno::ENOENT)
end
it "opens a file that no exists when use 'r' mode" do
- lambda { File.open(@nonexistent, 'r') }.should raise_error(Errno::ENOENT)
+ -> { File.open(@nonexistent, 'r') }.should raise_error(Errno::ENOENT)
end
it "opens a file that no exists when use File::EXCL mode" do
- lambda { File.open(@nonexistent, File::EXCL) }.should raise_error(Errno::ENOENT)
+ -> { File.open(@nonexistent, File::EXCL) }.should raise_error(Errno::ENOENT)
end
it "opens a file that no exists when use File::NONBLOCK mode" do
- lambda { File.open(@nonexistent, File::NONBLOCK) }.should raise_error(Errno::ENOENT)
+ -> { File.open(@nonexistent, File::NONBLOCK) }.should raise_error(Errno::ENOENT)
end
platform_is_not :openbsd, :windows do
it "opens a file that no exists when use File::TRUNC mode" do
- lambda { File.open(@nonexistent, File::TRUNC) }.should raise_error(Errno::ENOENT)
+ -> { File.open(@nonexistent, File::TRUNC) }.should raise_error(Errno::ENOENT)
end
end
platform_is :openbsd, :windows do
it "does not open a file that does no exists when using File::TRUNC mode" do
- lambda { File.open(@nonexistent, File::TRUNC) }.should raise_error(Errno::EINVAL)
+ -> { File.open(@nonexistent, File::TRUNC) }.should raise_error(Errno::EINVAL)
end
end
platform_is_not :windows do
it "opens a file that no exists when use File::NOCTTY mode" do
- lambda { File.open(@nonexistent, File::NOCTTY) }.should raise_error(Errno::ENOENT)
+ -> { File.open(@nonexistent, File::NOCTTY) }.should raise_error(Errno::ENOENT)
end
end
@@ -223,7 +223,7 @@ describe "File.open" do
# Check the grants associated to the different open modes combinations.
it "raises an ArgumentError exception when call with an unknown mode" do
- lambda { File.open(@file, "q") }.should raise_error(ArgumentError)
+ -> { File.open(@file, "q") }.should raise_error(ArgumentError)
end
it "can read in a block when call open with RDONLY mode" do
@@ -240,13 +240,13 @@ describe "File.open" do
it "raises an IO exception when write in a block opened with RDONLY mode" do
File.open(@file, File::RDONLY) do |f|
- lambda { f.puts "writing ..." }.should raise_error(IOError)
+ -> { f.puts "writing ..." }.should raise_error(IOError)
end
end
it "raises an IO exception when write in a block opened with 'r' mode" do
File.open(@file, "r") do |f|
- lambda { f.puts "writing ..." }.should raise_error(IOError)
+ -> { f.puts "writing ..." }.should raise_error(IOError)
end
end
@@ -257,7 +257,7 @@ describe "File.open" do
end
it "can't read in a block when call open with File::WRONLY||File::RDONLY mode" do
- lambda {
+ -> {
File.open(@file, File::WRONLY|File::RDONLY ) do |f|
f.gets.should == nil
end
@@ -278,44 +278,44 @@ describe "File.open" do
it "raises an IOError when read in a block opened with WRONLY mode" do
File.open(@file, File::WRONLY) do |f|
- lambda { f.gets }.should raise_error(IOError)
+ -> { f.gets }.should raise_error(IOError)
end
end
it "raises an IOError when read in a block opened with 'w' mode" do
File.open(@file, "w") do |f|
- lambda { f.gets }.should raise_error(IOError)
+ -> { f.gets }.should raise_error(IOError)
end
end
it "raises an IOError when read in a block opened with 'a' mode" do
File.open(@file, "a") do |f|
- lambda { f.gets }.should raise_error(IOError)
+ -> { f.gets }.should raise_error(IOError)
end
end
it "raises an IOError when read in a block opened with 'a' mode" do
File.open(@file, "a") do |f|
f.puts("writing").should == nil
- lambda { f.gets }.should raise_error(IOError)
+ -> { f.gets }.should raise_error(IOError)
end
end
it "raises an IOError when read in a block opened with 'a' mode" do
File.open(@file, File::WRONLY|File::APPEND ) do |f|
- lambda { f.gets }.should raise_error(IOError)
+ -> { f.gets }.should raise_error(IOError)
end
end
it "raises an IOError when read in a block opened with File::WRONLY|File::APPEND mode" do
File.open(@file, File::WRONLY|File::APPEND ) do |f|
f.puts("writing").should == nil
- lambda { f.gets }.should raise_error(IOError)
+ -> { f.gets }.should raise_error(IOError)
end
end
it "raises an IOError when read in a block opened with File::RDONLY|File::APPEND mode" do
- lambda {
+ -> {
File.open(@file, File::RDONLY|File::APPEND ) do |f|
f.puts("writing")
end
@@ -332,7 +332,7 @@ describe "File.open" do
end
it "can't read in a block when call open with File::EXCL mode" do
- lambda {
+ -> {
File.open(@file, File::EXCL) do |f|
f.puts("writing").should == nil
end
@@ -355,7 +355,7 @@ describe "File.open" do
end
it "raises an Errorno::EEXIST if the file exists when open with File::CREAT|File::EXCL" do
- lambda {
+ -> {
File.open(@file, File::CREAT|File::EXCL) do |f|
f.puts("writing")
end
@@ -382,7 +382,7 @@ describe "File.open" do
end
it "raises an IOError if the file exists when open with File::RDONLY|File::APPEND" do
- lambda {
+ -> {
File.open(@file, File::RDONLY|File::APPEND) do |f|
f.puts("writing").should == nil
end
@@ -416,7 +416,7 @@ describe "File.open" do
platform_is_not :openbsd, :windows do
it "can't write in a block when call open with File::TRUNC mode" do
- lambda {
+ -> {
File.open(@file, File::TRUNC) do |f|
f.puts("writing")
end
@@ -424,7 +424,7 @@ describe "File.open" do
end
it "raises an Errorno::EEXIST if the file exists when open with File::RDONLY|File::TRUNC" do
- lambda {
+ -> {
File.open(@file, File::RDONLY|File::TRUNC) do |f|
f.puts("writing").should == nil
end
@@ -434,7 +434,7 @@ describe "File.open" do
platform_is :openbsd, :windows do
it "can't write in a block when call open with File::TRUNC mode" do
- lambda {
+ -> {
File.open(@file, File::TRUNC) do |f|
f.puts("writing")
end
@@ -442,7 +442,7 @@ describe "File.open" do
end
it "raises an Errorno::EEXIST if the file exists when open with File::RDONLY|File::TRUNC" do
- lambda {
+ -> {
File.open(@file, File::RDONLY|File::TRUNC) do |f|
f.puts("writing").should == nil
end
@@ -455,7 +455,7 @@ describe "File.open" do
it "raises an Errno::EACCES when opening non-permitted file" do
@fh = File.open(@file, "w")
@fh.chmod(000)
- lambda { fh1 = File.open(@file); fh1.close }.should raise_error(Errno::EACCES)
+ -> { fh1 = File.open(@file); fh1.close }.should raise_error(Errno::EACCES)
end
end
end
@@ -464,7 +464,7 @@ describe "File.open" do
it "raises an Errno::EACCES when opening read-only file" do
@fh = File.open(@file, "w")
@fh.chmod(0444)
- lambda { File.open(@file, "w") }.should raise_error(Errno::EACCES)
+ -> { File.open(@file, "w") }.should raise_error(Errno::EACCES)
end
end
@@ -535,21 +535,21 @@ describe "File.open" do
end
it "raises a TypeError if passed a filename that is not a String or Integer type" do
- lambda { File.open(true) }.should raise_error(TypeError)
- lambda { File.open(false) }.should raise_error(TypeError)
- lambda { File.open(nil) }.should raise_error(TypeError)
+ -> { File.open(true) }.should raise_error(TypeError)
+ -> { File.open(false) }.should raise_error(TypeError)
+ -> { File.open(nil) }.should raise_error(TypeError)
end
it "raises a SystemCallError if passed an invalid Integer type" do
- lambda { File.open(-1) }.should raise_error(SystemCallError)
+ -> { File.open(-1) }.should raise_error(SystemCallError)
end
it "raises an ArgumentError if passed the wrong number of arguments" do
- lambda { File.open(@file, File::CREAT, 0755, 'test') }.should raise_error(ArgumentError)
+ -> { File.open(@file, File::CREAT, 0755, 'test') }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if passed an invalid string for mode" do
- lambda { File.open(@file, 'fake') }.should raise_error(ArgumentError)
+ -> { File.open(@file, 'fake') }.should raise_error(ArgumentError)
end
it "defaults external_encoding to BINARY for binary modes" do
@@ -570,17 +570,17 @@ describe "File.open" do
end
it "accepts extra flags as a keyword argument and combine with a string mode" do
- lambda {
+ -> {
File.open(@file, "w", flags: File::EXCL) { }
}.should raise_error(Errno::EEXIST)
- lambda {
+ -> {
File.open(@file, mode: "w", flags: File::EXCL) { }
}.should raise_error(Errno::EEXIST)
end
it "accepts extra flags as a keyword argument and combine with an integer mode" do
- lambda {
+ -> {
File.open(@file, File::WRONLY | File::CREAT, flags: File::EXCL) { }
}.should raise_error(Errno::EEXIST)
end
@@ -641,12 +641,12 @@ describe "File.open" do
it "throws a Errno::EEXIST error if the file exists" do
touch @xfile
- lambda { File.open(@xfile, "wx") }.should raise_error(Errno::EEXIST)
+ -> { File.open(@xfile, "wx") }.should raise_error(Errno::EEXIST)
end
it "can't be used with 'r' and 'a' flags" do
- lambda { File.open(@xfile, "rx") }.should raise_error(ArgumentError, 'invalid access mode rx')
- lambda { File.open(@xfile, "ax") }.should raise_error(ArgumentError, 'invalid access mode ax')
+ -> { File.open(@xfile, "rx") }.should raise_error(ArgumentError, 'invalid access mode rx')
+ -> { File.open(@xfile, "ax") }.should raise_error(ArgumentError, 'invalid access mode ax')
end
end
end
diff --git a/spec/ruby/core/file/printf_spec.rb b/spec/ruby/core/file/printf_spec.rb
index 95ce3589c5..2530419fc7 100644
--- a/spec/ruby/core/file/printf_spec.rb
+++ b/spec/ruby/core/file/printf_spec.rb
@@ -2,7 +2,7 @@ require_relative '../../spec_helper'
require_relative '../kernel/shared/sprintf'
describe "File#printf" do
- it_behaves_like :kernel_sprintf, -> (format, *args) {
+ it_behaves_like :kernel_sprintf, -> format, *args {
begin
@filename = tmp("printf.txt")
diff --git a/spec/ruby/core/file/readlink_spec.rb b/spec/ruby/core/file/readlink_spec.rb
index 7b1fe74047..eb3bfda30e 100644
--- a/spec/ruby/core/file/readlink_spec.rb
+++ b/spec/ruby/core/file/readlink_spec.rb
@@ -26,12 +26,12 @@ describe "File.readlink" do
it "raises an Errno::ENOENT if there is no such file" do
# TODO: missing_file
- lambda { File.readlink("/this/surely/doesnt/exist") }.should raise_error(Errno::ENOENT)
+ -> { File.readlink("/this/surely/doesnt/exist") }.should raise_error(Errno::ENOENT)
end
it "raises an Errno::EINVAL if called with a normal file" do
touch @file
- lambda { File.readlink(@file) }.should raise_error(Errno::EINVAL)
+ -> { File.readlink(@file) }.should raise_error(Errno::EINVAL)
end
end
diff --git a/spec/ruby/core/file/realdirpath_spec.rb b/spec/ruby/core/file/realdirpath_spec.rb
index 9c90d7330f..74053afce3 100644
--- a/spec/ruby/core/file/realdirpath_spec.rb
+++ b/spec/ruby/core/file/realdirpath_spec.rb
@@ -61,7 +61,7 @@ platform_is_not :windows do
it "raises an Errno::ELOOP if the symlink points to itself" do
File.unlink @link
File.symlink(@link, @link)
- lambda { File.realdirpath(@link) }.should raise_error(Errno::ELOOP)
+ -> { File.realdirpath(@link) }.should raise_error(Errno::ELOOP)
end
it "returns the real (absolute) pathname if the file is absent" do
@@ -69,7 +69,7 @@ platform_is_not :windows do
end
it "raises Errno::ENOENT if the directory is absent" do
- lambda { File.realdirpath(@fake_file_in_fake_dir) }.should raise_error(Errno::ENOENT)
+ -> { File.realdirpath(@fake_file_in_fake_dir) }.should raise_error(Errno::ENOENT)
end
it "returns the real (absolute) pathname if the symlink points to an absent file" do
@@ -77,7 +77,7 @@ platform_is_not :windows do
end
it "raises Errno::ENOENT if the symlink points to an absent directory" do
- lambda { File.realdirpath(@fake_link_to_fake_dir) }.should raise_error(Errno::ENOENT)
+ -> { File.realdirpath(@fake_link_to_fake_dir) }.should raise_error(Errno::ENOENT)
end
end
end
diff --git a/spec/ruby/core/file/realpath_spec.rb b/spec/ruby/core/file/realpath_spec.rb
index d7bb842759..0c5d19287a 100644
--- a/spec/ruby/core/file/realpath_spec.rb
+++ b/spec/ruby/core/file/realpath_spec.rb
@@ -57,15 +57,15 @@ platform_is_not :windows do
it "raises an Errno::ELOOP if the symlink points to itself" do
File.unlink @link
File.symlink(@link, @link)
- lambda { File.realpath(@link) }.should raise_error(Errno::ELOOP)
+ -> { File.realpath(@link) }.should raise_error(Errno::ELOOP)
end
it "raises Errno::ENOENT if the file is absent" do
- lambda { File.realpath(@fake_file) }.should raise_error(Errno::ENOENT)
+ -> { File.realpath(@fake_file) }.should raise_error(Errno::ENOENT)
end
it "raises Errno::ENOENT if the symlink points to an absent file" do
- lambda { File.realpath(@fake_link) }.should raise_error(Errno::ENOENT)
+ -> { File.realpath(@fake_link) }.should raise_error(Errno::ENOENT)
end
end
end
diff --git a/spec/ruby/core/file/rename_spec.rb b/spec/ruby/core/file/rename_spec.rb
index 5f47000d38..d903e7a0d5 100644
--- a/spec/ruby/core/file/rename_spec.rb
+++ b/spec/ruby/core/file/rename_spec.rb
@@ -23,15 +23,15 @@ describe "File.rename" do
it "raises an Errno::ENOENT if the source does not exist" do
rm_r @old
- lambda { File.rename(@old, @new) }.should raise_error(Errno::ENOENT)
+ -> { File.rename(@old, @new) }.should raise_error(Errno::ENOENT)
end
it "raises an ArgumentError if not passed two arguments" do
- lambda { File.rename }.should raise_error(ArgumentError)
- lambda { File.rename(@file) }.should raise_error(ArgumentError)
+ -> { File.rename }.should raise_error(ArgumentError)
+ -> { File.rename(@file) }.should raise_error(ArgumentError)
end
it "raises a TypeError if not passed String types" do
- lambda { File.rename(1, 2) }.should raise_error(TypeError)
+ -> { File.rename(1, 2) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/file/shared/fnmatch.rb b/spec/ruby/core/file/shared/fnmatch.rb
index 49a870e95a..a8488fd30a 100644
--- a/spec/ruby/core/file/shared/fnmatch.rb
+++ b/spec/ruby/core/file/shared/fnmatch.rb
@@ -218,21 +218,21 @@ describe :file_fnmatch, shared: true do
end
it "raises a TypeError if the first and second arguments are not string-like" do
- lambda { File.send(@method, nil, nil, 0, 0) }.should raise_error(ArgumentError)
- lambda { File.send(@method, 1, 'some/thing') }.should raise_error(TypeError)
- lambda { File.send(@method, 'some/thing', 1) }.should raise_error(TypeError)
- lambda { File.send(@method, 1, 1) }.should raise_error(TypeError)
+ -> { File.send(@method, nil, nil, 0, 0) }.should raise_error(ArgumentError)
+ -> { File.send(@method, 1, 'some/thing') }.should raise_error(TypeError)
+ -> { File.send(@method, 'some/thing', 1) }.should raise_error(TypeError)
+ -> { File.send(@method, 1, 1) }.should raise_error(TypeError)
end
it "raises a TypeError if the third argument is not an Integer" do
- lambda { File.send(@method, "*/place", "path/to/file", "flags") }.should raise_error(TypeError)
- lambda { File.send(@method, "*/place", "path/to/file", nil) }.should raise_error(TypeError)
+ -> { File.send(@method, "*/place", "path/to/file", "flags") }.should raise_error(TypeError)
+ -> { File.send(@method, "*/place", "path/to/file", nil) }.should raise_error(TypeError)
end
it "does not raise a TypeError if the third argument can be coerced to an Integer" do
flags = mock("flags")
flags.should_receive(:to_int).and_return(10)
- lambda { File.send(@method, "*/place", "path/to/file", flags) }.should_not raise_error
+ -> { File.send(@method, "*/place", "path/to/file", flags) }.should_not raise_error
end
it "matches multibyte characters" do
diff --git a/spec/ruby/core/file/shared/read.rb b/spec/ruby/core/file/shared/read.rb
index 7fff7f29d6..a2d479966d 100644
--- a/spec/ruby/core/file/shared/read.rb
+++ b/spec/ruby/core/file/shared/read.rb
@@ -3,13 +3,13 @@ require_relative '../../dir/fixtures/common'
describe :file_read_directory, shared: true do
platform_is :darwin, :linux, :openbsd, :windows do
it "raises an Errno::EISDIR when passed a path that is a directory" do
- lambda { @object.send(@method, ".") }.should raise_error(Errno::EISDIR)
+ -> { @object.send(@method, ".") }.should raise_error(Errno::EISDIR)
end
end
platform_is :freebsd, :netbsd do
it "does not raises any exception when passed a path that is a directory" do
- lambda { @object.send(@method, ".") }.should_not raise_error
+ -> { @object.send(@method, ".") }.should_not raise_error
end
end
end
diff --git a/spec/ruby/core/file/shared/stat.rb b/spec/ruby/core/file/shared/stat.rb
index aac710dd2f..fdaf97ea61 100644
--- a/spec/ruby/core/file/shared/stat.rb
+++ b/spec/ruby/core/file/shared/stat.rb
@@ -25,7 +25,7 @@ describe :file_stat, shared: true do
end
it "raises an Errno::ENOENT if the file does not exist" do
- lambda {
+ -> {
File.send(@method, "fake_file")
}.should raise_error(Errno::ENOENT)
end
diff --git a/spec/ruby/core/file/shared/unlink.rb b/spec/ruby/core/file/shared/unlink.rb
index 42b6a77c5d..d72ab4701f 100644
--- a/spec/ruby/core/file/shared/unlink.rb
+++ b/spec/ruby/core/file/shared/unlink.rb
@@ -31,11 +31,11 @@ describe :file_unlink, shared: true do
end
it "raises a TypeError if not passed a String type" do
- lambda { File.send(@method, 1) }.should raise_error(TypeError)
+ -> { File.send(@method, 1) }.should raise_error(TypeError)
end
it "raises an Errno::ENOENT when the given file doesn't exist" do
- lambda { File.send(@method, 'bogus') }.should raise_error(Errno::ENOENT)
+ -> { File.send(@method, 'bogus') }.should raise_error(Errno::ENOENT)
end
it "coerces a given parameter into a string if possible" do
diff --git a/spec/ruby/core/file/size_spec.rb b/spec/ruby/core/file/size_spec.rb
index b0ab2c0651..a2bf408da1 100644
--- a/spec/ruby/core/file/size_spec.rb
+++ b/spec/ruby/core/file/size_spec.rb
@@ -81,7 +81,7 @@ describe "File#size" do
it "raises an IOError on a closed file" do
@file.close
- lambda { @file.size }.should raise_error(IOError)
+ -> { @file.size }.should raise_error(IOError)
end
platform_is_not :windows do
diff --git a/spec/ruby/core/file/split_spec.rb b/spec/ruby/core/file/split_spec.rb
index 2b22b0a08f..7b958621b9 100644
--- a/spec/ruby/core/file/split_spec.rb
+++ b/spec/ruby/core/file/split_spec.rb
@@ -44,12 +44,12 @@ describe "File.split" do
end
it "raises an ArgumentError when not passed a single argument" do
- lambda { File.split }.should raise_error(ArgumentError)
- lambda { File.split('string', 'another string') }.should raise_error(ArgumentError)
+ -> { File.split }.should raise_error(ArgumentError)
+ -> { File.split('string', 'another string') }.should raise_error(ArgumentError)
end
it "raises a TypeError if the argument is not a String type" do
- lambda { File.split(1) }.should raise_error(TypeError)
+ -> { File.split(1) }.should raise_error(TypeError)
end
it "coerces the argument with to_str if it is not a String type" do
diff --git a/spec/ruby/core/file/stat/birthtime_spec.rb b/spec/ruby/core/file/stat/birthtime_spec.rb
index 40e501e87b..a727bbe566 100644
--- a/spec/ruby/core/file/stat/birthtime_spec.rb
+++ b/spec/ruby/core/file/stat/birthtime_spec.rb
@@ -21,7 +21,7 @@ describe "File::Stat#birthtime" do
platform_is :linux, :openbsd do
it "raises an NotImplementedError" do
st = File.stat(@file)
- lambda { st.birthtime }.should raise_error(NotImplementedError)
+ -> { st.birthtime }.should raise_error(NotImplementedError)
end
end
end
diff --git a/spec/ruby/core/file/stat/new_spec.rb b/spec/ruby/core/file/stat/new_spec.rb
index f5f22e6711..c0d9432ac8 100644
--- a/spec/ruby/core/file/stat/new_spec.rb
+++ b/spec/ruby/core/file/stat/new_spec.rb
@@ -13,7 +13,7 @@ describe "File::Stat#initialize" do
end
it "raises an exception if the file doesn't exist" do
- lambda {
+ -> {
File::Stat.new(tmp("i_am_a_dummy_file_that_doesnt_exist"))
}.should raise_error(Errno::ENOENT)
end
diff --git a/spec/ruby/core/file/symlink_spec.rb b/spec/ruby/core/file/symlink_spec.rb
index a8486db04a..0e8b0a5a20 100644
--- a/spec/ruby/core/file/symlink_spec.rb
+++ b/spec/ruby/core/file/symlink_spec.rb
@@ -32,18 +32,18 @@ describe "File.symlink" do
it "raises an Errno::EEXIST if the target already exists" do
File.symlink(@file, @link)
- lambda { File.symlink(@file, @link) }.should raise_error(Errno::EEXIST)
+ -> { File.symlink(@file, @link) }.should raise_error(Errno::EEXIST)
end
it "raises an ArgumentError if not called with two arguments" do
- lambda { File.symlink }.should raise_error(ArgumentError)
- lambda { File.symlink(@file) }.should raise_error(ArgumentError)
+ -> { File.symlink }.should raise_error(ArgumentError)
+ -> { File.symlink(@file) }.should raise_error(ArgumentError)
end
it "raises a TypeError if not called with String types" do
- lambda { File.symlink(@file, nil) }.should raise_error(TypeError)
- lambda { File.symlink(@file, 1) }.should raise_error(TypeError)
- lambda { File.symlink(1, 1) }.should raise_error(TypeError)
+ -> { File.symlink(@file, nil) }.should raise_error(TypeError)
+ -> { File.symlink(@file, 1) }.should raise_error(TypeError)
+ -> { File.symlink(1, 1) }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/core/file/truncate_spec.rb b/spec/ruby/core/file/truncate_spec.rb
index 36fe26a2fe..43b86b7382 100644
--- a/spec/ruby/core/file/truncate_spec.rb
+++ b/spec/ruby/core/file/truncate_spec.rb
@@ -54,29 +54,29 @@ describe "File.truncate" do
rm_r not_existing_file
begin
- lambda { File.truncate(not_existing_file, 5) }.should raise_error(Errno::ENOENT)
+ -> { File.truncate(not_existing_file, 5) }.should raise_error(Errno::ENOENT)
ensure
rm_r not_existing_file
end
end
it "raises an ArgumentError if not passed two arguments" do
- lambda { File.truncate }.should raise_error(ArgumentError)
- lambda { File.truncate(@name) }.should raise_error(ArgumentError)
+ -> { File.truncate }.should raise_error(ArgumentError)
+ -> { File.truncate(@name) }.should raise_error(ArgumentError)
end
platform_is_not :netbsd, :openbsd do
it "raises an Errno::EINVAL if the length argument is not valid" do
- lambda { File.truncate(@name, -1) }.should raise_error(Errno::EINVAL) # May fail
+ -> { File.truncate(@name, -1) }.should raise_error(Errno::EINVAL) # May fail
end
end
it "raises a TypeError if not passed a String type for the first argument" do
- lambda { File.truncate(1, 1) }.should raise_error(TypeError)
+ -> { File.truncate(1, 1) }.should raise_error(TypeError)
end
it "raises a TypeError if not passed an Integer type for the second argument" do
- lambda { File.truncate(@name, nil) }.should raise_error(TypeError)
+ -> { File.truncate(@name, nil) }.should raise_error(TypeError)
end
it "accepts an object that has a #to_path method" do
@@ -149,29 +149,29 @@ describe "File#truncate" do
end
it "raises an ArgumentError if not passed one argument" do
- lambda { @file.truncate }.should raise_error(ArgumentError)
- lambda { @file.truncate(1) }.should_not raise_error(ArgumentError)
+ -> { @file.truncate }.should raise_error(ArgumentError)
+ -> { @file.truncate(1) }.should_not raise_error(ArgumentError)
end
platform_is_not :netbsd do
it "raises an Errno::EINVAL if the length argument is not valid" do
- lambda { @file.truncate(-1) }.should raise_error(Errno::EINVAL) # May fail
+ -> { @file.truncate(-1) }.should raise_error(Errno::EINVAL) # May fail
end
end
it "raises an IOError if file is closed" do
@file.close
@file.closed?.should == true
- lambda { @file.truncate(42) }.should raise_error(IOError)
+ -> { @file.truncate(42) }.should raise_error(IOError)
end
it "raises an IOError if file is not opened for writing" do
File.open(@name, 'r') do |file|
- lambda { file.truncate(42) }.should raise_error(IOError)
+ -> { file.truncate(42) }.should raise_error(IOError)
end
end
it "raises a TypeError if not passed an Integer type for the for the argument" do
- lambda { @file.truncate(nil) }.should raise_error(TypeError)
+ -> { @file.truncate(nil) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/file/umask_spec.rb b/spec/ruby/core/file/umask_spec.rb
index 9a4beb8998..2640e3c316 100644
--- a/spec/ruby/core/file/umask_spec.rb
+++ b/spec/ruby/core/file/umask_spec.rb
@@ -52,6 +52,6 @@ describe "File.umask" do
end
it "raises ArgumentError when more than one argument is provided" do
- lambda { File.umask(022, 022) }.should raise_error(ArgumentError)
+ -> { File.umask(022, 022) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/float/divide_spec.rb b/spec/ruby/core/float/divide_spec.rb
index f41b9f1f93..d8f71a6b98 100644
--- a/spec/ruby/core/float/divide_spec.rb
+++ b/spec/ruby/core/float/divide_spec.rb
@@ -33,7 +33,7 @@ describe "Float#/" do
end
it "raises a TypeError when given a non-Numeric" do
- lambda { 13.0 / "10" }.should raise_error(TypeError)
- lambda { 13.0 / :symbol }.should raise_error(TypeError)
+ -> { 13.0 / "10" }.should raise_error(TypeError)
+ -> { 13.0 / :symbol }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/float/divmod_spec.rb b/spec/ruby/core/float/divmod_spec.rb
index 5983efe1d9..ec55dd3681 100644
--- a/spec/ruby/core/float/divmod_spec.rb
+++ b/spec/ruby/core/float/divmod_spec.rb
@@ -18,22 +18,22 @@ describe "Float#divmod" do
# Behaviour established as correct in r23953
it "raises a FloatDomainError if self is NaN" do
- lambda { nan_value.divmod(1) }.should raise_error(FloatDomainError)
+ -> { nan_value.divmod(1) }.should raise_error(FloatDomainError)
end
# Behaviour established as correct in r23953
it "raises a FloatDomainError if other is NaN" do
- lambda { 1.divmod(nan_value) }.should raise_error(FloatDomainError)
+ -> { 1.divmod(nan_value) }.should raise_error(FloatDomainError)
end
# Behaviour established as correct in r23953
it "raises a FloatDomainError if self is Infinity" do
- lambda { infinity_value.divmod(1) }.should raise_error(FloatDomainError)
+ -> { infinity_value.divmod(1) }.should raise_error(FloatDomainError)
end
it "raises a ZeroDivisionError if other is zero" do
- lambda { 1.0.divmod(0) }.should raise_error(ZeroDivisionError)
- lambda { 1.0.divmod(0.0) }.should raise_error(ZeroDivisionError)
+ -> { 1.0.divmod(0) }.should raise_error(ZeroDivisionError)
+ -> { 1.0.divmod(0.0) }.should raise_error(ZeroDivisionError)
end
# redmine #5276"
diff --git a/spec/ruby/core/float/float_spec.rb b/spec/ruby/core/float/float_spec.rb
index 3ad4ce817a..263ae82079 100644
--- a/spec/ruby/core/float/float_spec.rb
+++ b/spec/ruby/core/float/float_spec.rb
@@ -6,13 +6,13 @@ describe "Float" do
end
it ".allocate raises a TypeError" do
- lambda do
+ -> do
Float.allocate
end.should raise_error(TypeError)
end
it ".new is undefined" do
- lambda do
+ -> do
Float.new
end.should raise_error(NoMethodError)
end
diff --git a/spec/ruby/core/float/gt_spec.rb b/spec/ruby/core/float/gt_spec.rb
index 6ecab3592d..0d73f1c3df 100644
--- a/spec/ruby/core/float/gt_spec.rb
+++ b/spec/ruby/core/float/gt_spec.rb
@@ -11,7 +11,7 @@ describe "Float#>" do
end
it "raises an ArgumentError when given a non-Numeric" do
- lambda { 5.0 > "4" }.should raise_error(ArgumentError)
- lambda { 5.0 > mock('x') }.should raise_error(ArgumentError)
+ -> { 5.0 > "4" }.should raise_error(ArgumentError)
+ -> { 5.0 > mock('x') }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/float/gte_spec.rb b/spec/ruby/core/float/gte_spec.rb
index 0886dffd97..98ec60b70b 100644
--- a/spec/ruby/core/float/gte_spec.rb
+++ b/spec/ruby/core/float/gte_spec.rb
@@ -11,7 +11,7 @@ describe "Float#>=" do
end
it "raises an ArgumentError when given a non-Numeric" do
- lambda { 5.0 >= "4" }.should raise_error(ArgumentError)
- lambda { 5.0 >= mock('x') }.should raise_error(ArgumentError)
+ -> { 5.0 >= "4" }.should raise_error(ArgumentError)
+ -> { 5.0 >= mock('x') }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/float/lt_spec.rb b/spec/ruby/core/float/lt_spec.rb
index 9723b59c5e..c01b6e0e02 100644
--- a/spec/ruby/core/float/lt_spec.rb
+++ b/spec/ruby/core/float/lt_spec.rb
@@ -11,7 +11,7 @@ describe "Float#<" do
end
it "raises an ArgumentError when given a non-Numeric" do
- lambda { 5.0 < "4" }.should raise_error(ArgumentError)
- lambda { 5.0 < mock('x') }.should raise_error(ArgumentError)
+ -> { 5.0 < "4" }.should raise_error(ArgumentError)
+ -> { 5.0 < mock('x') }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/float/lte_spec.rb b/spec/ruby/core/float/lte_spec.rb
index 0a0a06d753..66f2ddc2c7 100644
--- a/spec/ruby/core/float/lte_spec.rb
+++ b/spec/ruby/core/float/lte_spec.rb
@@ -12,7 +12,7 @@ describe "Float#<=" do
end
it "raises an ArgumentError when given a non-Numeric" do
- lambda { 5.0 <= "4" }.should raise_error(ArgumentError)
- lambda { 5.0 <= mock('x') }.should raise_error(ArgumentError)
+ -> { 5.0 <= "4" }.should raise_error(ArgumentError)
+ -> { 5.0 <= mock('x') }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/float/multiply_spec.rb b/spec/ruby/core/float/multiply_spec.rb
index 69a5dcc95a..eca0b52c4f 100644
--- a/spec/ruby/core/float/multiply_spec.rb
+++ b/spec/ruby/core/float/multiply_spec.rb
@@ -11,7 +11,7 @@ describe "Float#*" do
end
it "raises a TypeError when given a non-Numeric" do
- lambda { 13.0 * "10" }.should raise_error(TypeError)
- lambda { 13.0 * :symbol }.should raise_error(TypeError)
+ -> { 13.0 * "10" }.should raise_error(TypeError)
+ -> { 13.0 * :symbol }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/float/rationalize_spec.rb b/spec/ruby/core/float/rationalize_spec.rb
index 978425e084..0c5bef7ac4 100644
--- a/spec/ruby/core/float/rationalize_spec.rb
+++ b/spec/ruby/core/float/rationalize_spec.rb
@@ -29,15 +29,15 @@ describe "Float#rationalize" do
end
it "raises a FloatDomainError for Infinity" do
- lambda {infinity_value.rationalize}.should raise_error(FloatDomainError)
+ -> {infinity_value.rationalize}.should raise_error(FloatDomainError)
end
it "raises a FloatDomainError for NaN" do
- lambda { nan_value.rationalize }.should raise_error(FloatDomainError)
+ -> { nan_value.rationalize }.should raise_error(FloatDomainError)
end
it "raises ArgumentError when passed more than one argument" do
- lambda { 0.3.rationalize(0.1, 0.1) }.should raise_error(ArgumentError)
- lambda { 0.3.rationalize(0.1, 0.1, 2) }.should raise_error(ArgumentError)
+ -> { 0.3.rationalize(0.1, 0.1) }.should raise_error(ArgumentError)
+ -> { 0.3.rationalize(0.1, 0.1, 2) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/float/round_spec.rb b/spec/ruby/core/float/round_spec.rb
index d5ca532c5a..e143682362 100644
--- a/spec/ruby/core/float/round_spec.rb
+++ b/spec/ruby/core/float/round_spec.rb
@@ -16,9 +16,9 @@ describe "Float#round" do
end
it "raises FloatDomainError for exceptional values" do
- lambda { (+infinity_value).round }.should raise_error(FloatDomainError)
- lambda { (-infinity_value).round }.should raise_error(FloatDomainError)
- lambda { nan_value.round }.should raise_error(FloatDomainError)
+ -> { (+infinity_value).round }.should raise_error(FloatDomainError)
+ -> { (-infinity_value).round }.should raise_error(FloatDomainError)
+ -> { nan_value.round }.should raise_error(FloatDomainError)
end
it "rounds self to an optionally given precision" do
@@ -35,20 +35,20 @@ describe "Float#round" do
end
it "raises a TypeError when its argument can not be converted to an Integer" do
- lambda { 1.0.round("4") }.should raise_error(TypeError)
- lambda { 1.0.round(nil) }.should raise_error(TypeError)
+ -> { 1.0.round("4") }.should raise_error(TypeError)
+ -> { 1.0.round(nil) }.should raise_error(TypeError)
end
it "raises FloatDomainError for exceptional values when passed a non-positive precision" do
- lambda { Float::INFINITY.round( 0) }.should raise_error(FloatDomainError)
- lambda { Float::INFINITY.round(-2) }.should raise_error(FloatDomainError)
- lambda { (-Float::INFINITY).round( 0) }.should raise_error(FloatDomainError)
- lambda { (-Float::INFINITY).round(-2) }.should raise_error(FloatDomainError)
+ -> { Float::INFINITY.round( 0) }.should raise_error(FloatDomainError)
+ -> { Float::INFINITY.round(-2) }.should raise_error(FloatDomainError)
+ -> { (-Float::INFINITY).round( 0) }.should raise_error(FloatDomainError)
+ -> { (-Float::INFINITY).round(-2) }.should raise_error(FloatDomainError)
end
it "raises RangeError for NAN when passed a non-positive precision" do
- lambda { Float::NAN.round(0) }.should raise_error(RangeError)
- lambda { Float::NAN.round(-2) }.should raise_error(RangeError)
+ -> { Float::NAN.round(0) }.should raise_error(RangeError)
+ -> { Float::NAN.round(-2) }.should raise_error(RangeError)
end
it "returns self for exceptional values when passed a non-negative precision" do
@@ -106,12 +106,12 @@ describe "Float#round" do
end
it "raises FloatDomainError for exceptional values with a half option" do
- lambda { (+infinity_value).round(half: :up) }.should raise_error(FloatDomainError)
- lambda { (-infinity_value).round(half: :down) }.should raise_error(FloatDomainError)
- lambda { nan_value.round(half: :even) }.should raise_error(FloatDomainError)
+ -> { (+infinity_value).round(half: :up) }.should raise_error(FloatDomainError)
+ -> { (-infinity_value).round(half: :down) }.should raise_error(FloatDomainError)
+ -> { nan_value.round(half: :even) }.should raise_error(FloatDomainError)
end
it "raise for a non-existent round mode" do
- lambda { 14.2.round(half: :nonsense) }.should raise_error(ArgumentError, "invalid rounding mode: nonsense")
+ -> { 14.2.round(half: :nonsense) }.should raise_error(ArgumentError, "invalid rounding mode: nonsense")
end
end
diff --git a/spec/ruby/core/float/shared/modulo.rb b/spec/ruby/core/float/shared/modulo.rb
index 6c423a3a28..6700bd4f4e 100644
--- a/spec/ruby/core/float/shared/modulo.rb
+++ b/spec/ruby/core/float/shared/modulo.rb
@@ -42,7 +42,7 @@ describe :float_modulo, shared: true do
end
it "raises a ZeroDivisionError if other is zero" do
- lambda { 1.0.send(@method, 0) }.should raise_error(ZeroDivisionError)
- lambda { 1.0.send(@method, 0.0) }.should raise_error(ZeroDivisionError)
+ -> { 1.0.send(@method, 0) }.should raise_error(ZeroDivisionError)
+ -> { 1.0.send(@method, 0.0) }.should raise_error(ZeroDivisionError)
end
end
diff --git a/spec/ruby/core/float/shared/quo.rb b/spec/ruby/core/float/shared/quo.rb
index afc921a2c1..3487824f70 100644
--- a/spec/ruby/core/float/shared/quo.rb
+++ b/spec/ruby/core/float/shared/quo.rb
@@ -50,10 +50,10 @@ describe :float_quo, shared: true do
end
it "raises a TypeError when argument isn't numeric" do
- lambda { 27292.2.send(@method, mock('non-numeric')) }.should raise_error(TypeError)
+ -> { 27292.2.send(@method, mock('non-numeric')) }.should raise_error(TypeError)
end
it "raises an ArgumentError when passed multiple arguments" do
- lambda { 272.221.send(@method, 6,0.2) }.should raise_error(ArgumentError)
+ -> { 272.221.send(@method, 6,0.2) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/hash/clear_spec.rb b/spec/ruby/core/hash/clear_spec.rb
index 706fe57e1c..e7816acbbc 100644
--- a/spec/ruby/core/hash/clear_spec.rb
+++ b/spec/ruby/core/hash/clear_spec.rb
@@ -26,7 +26,7 @@ describe "Hash#clear" do
end
it "raises a #{frozen_error_class} if called on a frozen instance" do
- lambda { HashSpecs.frozen_hash.clear }.should raise_error(frozen_error_class)
- lambda { HashSpecs.empty_frozen_hash.clear }.should raise_error(frozen_error_class)
+ -> { HashSpecs.frozen_hash.clear }.should raise_error(frozen_error_class)
+ -> { HashSpecs.empty_frozen_hash.clear }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/hash/compare_by_identity_spec.rb b/spec/ruby/core/hash/compare_by_identity_spec.rb
index 33db59124e..0658b4954a 100644
--- a/spec/ruby/core/hash/compare_by_identity_spec.rb
+++ b/spec/ruby/core/hash/compare_by_identity_spec.rb
@@ -82,7 +82,7 @@ describe "Hash#compare_by_identity" do
it "raises a #{frozen_error_class} on frozen hashes" do
@h = @h.freeze
- lambda { @h.compare_by_identity }.should raise_error(frozen_error_class)
+ -> { @h.compare_by_identity }.should raise_error(frozen_error_class)
end
# Behaviour confirmed in bug #1871
diff --git a/spec/ruby/core/hash/constructor_spec.rb b/spec/ruby/core/hash/constructor_spec.rb
index 14674a018b..ad67274802 100644
--- a/spec/ruby/core/hash/constructor_spec.rb
+++ b/spec/ruby/core/hash/constructor_spec.rb
@@ -65,7 +65,7 @@ describe "Hash.[]" do
end
it "raises an ArgumentError for arrays of more than 2 elements" do
- lambda{ Hash[[[:a, :b, :c]]].should == {} }.should raise_error(ArgumentError)
+ ->{ Hash[[[:a, :b, :c]]].should == {} }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when passed a list of value-invalid-pairs in an array" do
@@ -89,8 +89,8 @@ describe "Hash.[]" do
end
it "raises an ArgumentError when passed an odd number of arguments" do
- lambda { Hash[1, 2, 3] }.should raise_error(ArgumentError)
- lambda { Hash[1, 2, { 3 => 4 }] }.should raise_error(ArgumentError)
+ -> { Hash[1, 2, 3] }.should raise_error(ArgumentError)
+ -> { Hash[1, 2, { 3 => 4 }] }.should raise_error(ArgumentError)
end
it "calls to_hash" do
diff --git a/spec/ruby/core/hash/default_proc_spec.rb b/spec/ruby/core/hash/default_proc_spec.rb
index 2254609607..83ad98e5b6 100644
--- a/spec/ruby/core/hash/default_proc_spec.rb
+++ b/spec/ruby/core/hash/default_proc_spec.rb
@@ -37,7 +37,7 @@ describe "Hash#default_proc=" do
end
it "raises an error if passed stuff not convertible to procs" do
- lambda{{}.default_proc = 42}.should raise_error(TypeError)
+ ->{{}.default_proc = 42}.should raise_error(TypeError)
end
it "returns the passed Proc" do
@@ -58,23 +58,23 @@ describe "Hash#default_proc=" do
it "accepts a lambda with an arity of 2" do
h = {}
- lambda do
- h.default_proc = lambda {|a,b| }
+ -> do
+ h.default_proc = -> a, b { }
end.should_not raise_error(TypeError)
end
it "raises a TypeError if passed a lambda with an arity other than 2" do
h = {}
- lambda do
- h.default_proc = lambda {|a| }
+ -> do
+ h.default_proc = -> a { }
end.should raise_error(TypeError)
- lambda do
- h.default_proc = lambda {|a,b,c| }
+ -> do
+ h.default_proc = -> a, b, c { }
end.should raise_error(TypeError)
end
it "raises a #{frozen_error_class} if self is frozen" do
- lambda { {}.freeze.default_proc = Proc.new {} }.should raise_error(frozen_error_class)
- lambda { {}.freeze.default_proc = nil }.should raise_error(frozen_error_class)
+ -> { {}.freeze.default_proc = Proc.new {} }.should raise_error(frozen_error_class)
+ -> { {}.freeze.default_proc = nil }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/hash/default_spec.rb b/spec/ruby/core/hash/default_spec.rb
index afc4f9780f..6cad65bb62 100644
--- a/spec/ruby/core/hash/default_spec.rb
+++ b/spec/ruby/core/hash/default_spec.rb
@@ -30,7 +30,7 @@ describe "Hash#default=" do
end
it "unsets the default proc" do
- [99, nil, lambda { 6 }].each do |default|
+ [99, nil, -> { 6 }].each do |default|
h = Hash.new { 5 }
h.default_proc.should_not == nil
h.default = default
@@ -40,7 +40,7 @@ describe "Hash#default=" do
end
it "raises a #{frozen_error_class} if called on a frozen instance" do
- lambda { HashSpecs.frozen_hash.default = nil }.should raise_error(frozen_error_class)
- lambda { HashSpecs.empty_frozen_hash.default = nil }.should raise_error(frozen_error_class)
+ -> { HashSpecs.frozen_hash.default = nil }.should raise_error(frozen_error_class)
+ -> { HashSpecs.empty_frozen_hash.default = nil }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/hash/delete_if_spec.rb b/spec/ruby/core/hash/delete_if_spec.rb
index 58fba1ff80..345a24a726 100644
--- a/spec/ruby/core/hash/delete_if_spec.rb
+++ b/spec/ruby/core/hash/delete_if_spec.rb
@@ -35,8 +35,8 @@ describe "Hash#delete_if" do
end
it "raises a #{frozen_error_class} if called on a frozen instance" do
- lambda { HashSpecs.frozen_hash.delete_if { false } }.should raise_error(frozen_error_class)
- lambda { HashSpecs.empty_frozen_hash.delete_if { true } }.should raise_error(frozen_error_class)
+ -> { HashSpecs.frozen_hash.delete_if { false } }.should raise_error(frozen_error_class)
+ -> { HashSpecs.empty_frozen_hash.delete_if { true } }.should raise_error(frozen_error_class)
end
it_behaves_like :hash_iteration_no_block, :delete_if
diff --git a/spec/ruby/core/hash/delete_spec.rb b/spec/ruby/core/hash/delete_spec.rb
index 6f0079dafa..a69815c1d9 100644
--- a/spec/ruby/core/hash/delete_spec.rb
+++ b/spec/ruby/core/hash/delete_spec.rb
@@ -38,7 +38,7 @@ describe "Hash#delete" do
end
it "raises a #{frozen_error_class} if called on a frozen instance" do
- lambda { HashSpecs.frozen_hash.delete("foo") }.should raise_error(frozen_error_class)
- lambda { HashSpecs.empty_frozen_hash.delete("foo") }.should raise_error(frozen_error_class)
+ -> { HashSpecs.frozen_hash.delete("foo") }.should raise_error(frozen_error_class)
+ -> { HashSpecs.empty_frozen_hash.delete("foo") }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/hash/dig_spec.rb b/spec/ruby/core/hash/dig_spec.rb
index dcba049ac4..aa0ecadd2f 100644
--- a/spec/ruby/core/hash/dig_spec.rb
+++ b/spec/ruby/core/hash/dig_spec.rb
@@ -28,7 +28,7 @@ describe "Hash#dig" do
end
it "raises an ArgumentError if no arguments provided" do
- lambda { { the: 'borg' }.dig() }.should raise_error(ArgumentError)
+ -> { { the: 'borg' }.dig() }.should raise_error(ArgumentError)
end
it "handles type-mixed deep digging" do
@@ -47,8 +47,8 @@ describe "Hash#dig" do
it "raises TypeError if an intermediate element does not respond to #dig" do
h = {}
h[:foo] = [ { bar: [ 1 ] }, [ nil, 'str' ] ]
- lambda { h.dig(:foo, 0, :bar, 0, 0) }.should raise_error(TypeError)
- lambda { h.dig(:foo, 1, 1, 0) }.should raise_error(TypeError)
+ -> { h.dig(:foo, 0, :bar, 0, 0) }.should raise_error(TypeError)
+ -> { h.dig(:foo, 1, 1, 0) }.should raise_error(TypeError)
end
it "calls #dig on the result of #[] with the remaining arguments" do
diff --git a/spec/ruby/core/hash/fetch_spec.rb b/spec/ruby/core/hash/fetch_spec.rb
index 197832e311..753167f709 100644
--- a/spec/ruby/core/hash/fetch_spec.rb
+++ b/spec/ruby/core/hash/fetch_spec.rb
@@ -4,10 +4,10 @@ require_relative '../../shared/hash/key_error'
describe "Hash#fetch" do
context "when the key is not found" do
- it_behaves_like :key_error, ->(obj, key) { obj.fetch(key) }, Hash.new(a: 5)
- it_behaves_like :key_error, ->(obj, key) { obj.fetch(key) }, {}
- it_behaves_like :key_error, ->(obj, key) { obj.fetch(key) }, Hash.new { 5 }
- it_behaves_like :key_error, ->(obj, key) { obj.fetch(key) }, Hash.new(5)
+ it_behaves_like :key_error, -> obj, key { obj.fetch(key) }, Hash.new(a: 5)
+ it_behaves_like :key_error, -> obj, key { obj.fetch(key) }, {}
+ it_behaves_like :key_error, -> obj, key { obj.fetch(key) }, Hash.new { 5 }
+ it_behaves_like :key_error, -> obj, key { obj.fetch(key) }, Hash.new(5)
it "formats the object with #inspect in the KeyError message" do
-> {
@@ -31,14 +31,14 @@ describe "Hash#fetch" do
end
it "gives precedence to the default block over the default argument when passed both" do
- lambda {
+ -> {
@result = {}.fetch(9, :foo) { |i| i * i }
}.should complain(/block supersedes default value argument/)
@result.should == 81
end
it "raises an ArgumentError when not passed one or two arguments" do
- lambda { {}.fetch() }.should raise_error(ArgumentError)
- lambda { {}.fetch(1, 2, 3) }.should raise_error(ArgumentError)
+ -> { {}.fetch() }.should raise_error(ArgumentError)
+ -> { {}.fetch(1, 2, 3) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/hash/fetch_values_spec.rb b/spec/ruby/core/hash/fetch_values_spec.rb
index a4af153bf7..041a3f07e9 100644
--- a/spec/ruby/core/hash/fetch_values_spec.rb
+++ b/spec/ruby/core/hash/fetch_values_spec.rb
@@ -15,7 +15,7 @@ describe "Hash#fetch_values" do
end
describe "with unmatched keys" do
- it_behaves_like :key_error, ->(obj, key) { obj.fetch_values(key) }, Hash.new(a: 5)
+ it_behaves_like :key_error, -> obj, key { obj.fetch_values(key) }, Hash.new(a: 5)
it "returns the default value from block" do
@hash.fetch_values(:z) { |key| "`#{key}' is not found" }.should == ["`z' is not found"]
diff --git a/spec/ruby/core/hash/flatten_spec.rb b/spec/ruby/core/hash/flatten_spec.rb
index 5a7ddd8baa..825da15bfc 100644
--- a/spec/ruby/core/hash/flatten_spec.rb
+++ b/spec/ruby/core/hash/flatten_spec.rb
@@ -55,7 +55,7 @@ describe "Hash#flatten" do
end
it "raises a TypeError if given a non-Integer argument" do
- lambda do
+ -> do
@h.flatten(Object.new)
end.should raise_error(TypeError)
end
diff --git a/spec/ruby/core/hash/initialize_spec.rb b/spec/ruby/core/hash/initialize_spec.rb
index 344571631a..00e1174ec8 100644
--- a/spec/ruby/core/hash/initialize_spec.rb
+++ b/spec/ruby/core/hash/initialize_spec.rb
@@ -46,16 +46,16 @@ describe "Hash#initialize" do
end
it "raises a #{frozen_error_class} if called on a frozen instance" do
- block = lambda { HashSpecs.frozen_hash.instance_eval { initialize() }}
+ block = -> { HashSpecs.frozen_hash.instance_eval { initialize() }}
block.should raise_error(frozen_error_class)
- block = lambda { HashSpecs.frozen_hash.instance_eval { initialize(nil) } }
+ block = -> { HashSpecs.frozen_hash.instance_eval { initialize(nil) } }
block.should raise_error(frozen_error_class)
- block = lambda { HashSpecs.frozen_hash.instance_eval { initialize(5) } }
+ block = -> { HashSpecs.frozen_hash.instance_eval { initialize(5) } }
block.should raise_error(frozen_error_class)
- block = lambda { HashSpecs.frozen_hash.instance_eval { initialize { 5 } } }
+ block = -> { HashSpecs.frozen_hash.instance_eval { initialize { 5 } } }
block.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/hash/keep_if_spec.rb b/spec/ruby/core/hash/keep_if_spec.rb
index 80f7fbbf64..278eafc969 100644
--- a/spec/ruby/core/hash/keep_if_spec.rb
+++ b/spec/ruby/core/hash/keep_if_spec.rb
@@ -28,8 +28,8 @@ describe "Hash#keep_if" do
end
it "raises a #{frozen_error_class} if called on a frozen instance" do
- lambda { HashSpecs.frozen_hash.keep_if { true } }.should raise_error(frozen_error_class)
- lambda { HashSpecs.empty_frozen_hash.keep_if { false } }.should raise_error(frozen_error_class)
+ -> { HashSpecs.frozen_hash.keep_if { true } }.should raise_error(frozen_error_class)
+ -> { HashSpecs.empty_frozen_hash.keep_if { false } }.should raise_error(frozen_error_class)
end
it_behaves_like :hash_iteration_no_block, :keep_if
diff --git a/spec/ruby/core/hash/merge_spec.rb b/spec/ruby/core/hash/merge_spec.rb
index 77e5c42071..91ded30eb7 100644
--- a/spec/ruby/core/hash/merge_spec.rb
+++ b/spec/ruby/core/hash/merge_spec.rb
@@ -28,7 +28,7 @@ describe "Hash#merge" do
r = h1.merge(h2) { |k,x,y| "#{k}:#{x+2*y}" }
r.should == { a: "a:-2", b: "b:9", c: -3, d: 5 }
- lambda {
+ -> {
h1.merge(h2) { |k, x, y| raise(IndexError) }
}.should raise_error(IndexError)
diff --git a/spec/ruby/core/hash/new_spec.rb b/spec/ruby/core/hash/new_spec.rb
index c21266777f..6054b69bdd 100644
--- a/spec/ruby/core/hash/new_spec.rb
+++ b/spec/ruby/core/hash/new_spec.rb
@@ -26,11 +26,11 @@ describe "Hash.new" do
end
it "raises an ArgumentError if more than one argument is passed" do
- lambda { Hash.new(5,6) }.should raise_error(ArgumentError)
+ -> { Hash.new(5,6) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if passed both default argument and default block" do
- lambda { Hash.new(5) { 0 } }.should raise_error(ArgumentError)
- lambda { Hash.new(nil) { 0 } }.should raise_error(ArgumentError)
+ -> { Hash.new(5) { 0 } }.should raise_error(ArgumentError)
+ -> { Hash.new(nil) { 0 } }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/hash/rehash_spec.rb b/spec/ruby/core/hash/rehash_spec.rb
index 32ba3fcfb9..9816648f08 100644
--- a/spec/ruby/core/hash/rehash_spec.rb
+++ b/spec/ruby/core/hash/rehash_spec.rb
@@ -51,7 +51,7 @@ describe "Hash#rehash" do
end
it "raises a #{frozen_error_class} if called on a frozen instance" do
- lambda { HashSpecs.frozen_hash.rehash }.should raise_error(frozen_error_class)
- lambda { HashSpecs.empty_frozen_hash.rehash }.should raise_error(frozen_error_class)
+ -> { HashSpecs.frozen_hash.rehash }.should raise_error(frozen_error_class)
+ -> { HashSpecs.empty_frozen_hash.rehash }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/hash/reject_spec.rb b/spec/ruby/core/hash/reject_spec.rb
index a11e80a34a..8016be5e83 100644
--- a/spec/ruby/core/hash/reject_spec.rb
+++ b/spec/ruby/core/hash/reject_spec.rb
@@ -88,11 +88,11 @@ describe "Hash#reject!" do
end
it "raises a #{frozen_error_class} if called on a frozen instance that is modified" do
- lambda { HashSpecs.empty_frozen_hash.reject! { true } }.should raise_error(frozen_error_class)
+ -> { HashSpecs.empty_frozen_hash.reject! { true } }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} if called on a frozen instance that would not be modified" do
- lambda { HashSpecs.frozen_hash.reject! { false } }.should raise_error(frozen_error_class)
+ -> { HashSpecs.frozen_hash.reject! { false } }.should raise_error(frozen_error_class)
end
it_behaves_like :hash_iteration_no_block, :reject!
diff --git a/spec/ruby/core/hash/shared/comparison.rb b/spec/ruby/core/hash/shared/comparison.rb
index bbb9bfd6ad..07564e4cec 100644
--- a/spec/ruby/core/hash/shared/comparison.rb
+++ b/spec/ruby/core/hash/shared/comparison.rb
@@ -1,8 +1,8 @@
describe :hash_comparison, shared: true do
it "raises a TypeError if the right operand is not a hash" do
- lambda { { a: 1 }.send(@method, 1) }.should raise_error(TypeError)
- lambda { { a: 1 }.send(@method, nil) }.should raise_error(TypeError)
- lambda { { a: 1 }.send(@method, []) }.should raise_error(TypeError)
+ -> { { a: 1 }.send(@method, 1) }.should raise_error(TypeError)
+ -> { { a: 1 }.send(@method, nil) }.should raise_error(TypeError)
+ -> { { a: 1 }.send(@method, []) }.should raise_error(TypeError)
end
it "returns false if both hashes have the same keys but different values" do
diff --git a/spec/ruby/core/hash/shared/replace.rb b/spec/ruby/core/hash/shared/replace.rb
index eb51130781..b3d098763b 100644
--- a/spec/ruby/core/hash/shared/replace.rb
+++ b/spec/ruby/core/hash/shared/replace.rb
@@ -32,19 +32,19 @@ describe :hash_replace, shared: true do
hash_a.default(5).should == 10
hash_a = Hash.new { |h, k| k * 5 }
- hash_b = Hash.new(lambda { raise "Should not invoke lambda" })
+ hash_b = Hash.new(-> { raise "Should not invoke lambda" })
hash_a.send(@method, hash_b)
hash_a.default.should == hash_b.default
end
it "raises a #{frozen_error_class} if called on a frozen instance that would not be modified" do
- lambda do
+ -> do
HashSpecs.frozen_hash.send(@method, HashSpecs.frozen_hash)
end.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} if called on a frozen instance that is modified" do
- lambda do
+ -> do
HashSpecs.frozen_hash.send(@method, HashSpecs.empty_frozen_hash)
end.should raise_error(frozen_error_class)
end
diff --git a/spec/ruby/core/hash/shared/select.rb b/spec/ruby/core/hash/shared/select.rb
index cc1a54da25..bb781817cb 100644
--- a/spec/ruby/core/hash/shared/select.rb
+++ b/spec/ruby/core/hash/shared/select.rb
@@ -75,11 +75,11 @@ describe :hash_select!, shared: true do
end
it "raises a #{frozen_error_class} if called on an empty frozen instance" do
- lambda { HashSpecs.empty_frozen_hash.send(@method) { false } }.should raise_error(frozen_error_class)
+ -> { HashSpecs.empty_frozen_hash.send(@method) { false } }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} if called on a frozen instance that would not be modified" do
- lambda { HashSpecs.frozen_hash.send(@method) { true } }.should raise_error(frozen_error_class)
+ -> { HashSpecs.frozen_hash.send(@method) { true } }.should raise_error(frozen_error_class)
end
it_should_behave_like :hash_iteration_no_block
diff --git a/spec/ruby/core/hash/shared/store.rb b/spec/ruby/core/hash/shared/store.rb
index de61ed1ad1..ff40bef3ef 100644
--- a/spec/ruby/core/hash/shared/store.rb
+++ b/spec/ruby/core/hash/shared/store.rb
@@ -87,7 +87,7 @@ describe :hash_store, shared: true do
end
it "raises a #{frozen_error_class} if called on a frozen instance" do
- lambda { HashSpecs.frozen_hash.send(@method, 1, 2) }.should raise_error(frozen_error_class)
+ -> { HashSpecs.frozen_hash.send(@method, 1, 2) }.should raise_error(frozen_error_class)
end
it "does not raise an exception if changing the value of an existing key during iteration" do
diff --git a/spec/ruby/core/hash/shared/to_s.rb b/spec/ruby/core/hash/shared/to_s.rb
index 88333e0f42..d180d08c2c 100644
--- a/spec/ruby/core/hash/shared/to_s.rb
+++ b/spec/ruby/core/hash/shared/to_s.rb
@@ -61,7 +61,7 @@ describe :hash_to_s, shared: true do
obj.should_receive(:inspect).and_return(obj)
obj.should_receive(:to_s).and_raise(Exception)
- lambda { { a: obj }.send(@method) }.should raise_error(Exception)
+ -> { { a: obj }.send(@method) }.should raise_error(Exception)
end
it "handles hashes with recursive values" do
diff --git a/spec/ruby/core/hash/shared/update.rb b/spec/ruby/core/hash/shared/update.rb
index e808add5c0..3af41c450a 100644
--- a/spec/ruby/core/hash/shared/update.rb
+++ b/spec/ruby/core/hash/shared/update.rb
@@ -35,7 +35,7 @@ describe :hash_update, shared: true do
end
it "raises a #{frozen_error_class} on a frozen instance that is modified" do
- lambda do
+ -> do
HashSpecs.frozen_hash.send(@method, 1 => 2)
end.should raise_error(frozen_error_class)
end
@@ -47,12 +47,12 @@ describe :hash_update, shared: true do
def obj.to_hash() raise Exception, "should not receive #to_hash" end
obj.freeze
- lambda { HashSpecs.frozen_hash.send(@method, obj) }.should raise_error(frozen_error_class)
+ -> { HashSpecs.frozen_hash.send(@method, obj) }.should raise_error(frozen_error_class)
end
# see redmine #1571
it "raises a #{frozen_error_class} on a frozen instance that would not be modified" do
- lambda do
+ -> do
HashSpecs.frozen_hash.send(@method, HashSpecs.empty_frozen_hash)
end.should raise_error(frozen_error_class)
end
diff --git a/spec/ruby/core/hash/shift_spec.rb b/spec/ruby/core/hash/shift_spec.rb
index 47c9ac1821..d9f121e38b 100644
--- a/spec/ruby/core/hash/shift_spec.rb
+++ b/spec/ruby/core/hash/shift_spec.rb
@@ -58,8 +58,8 @@ describe "Hash#shift" do
end
it "raises a #{frozen_error_class} if called on a frozen instance" do
- lambda { HashSpecs.frozen_hash.shift }.should raise_error(frozen_error_class)
- lambda { HashSpecs.empty_frozen_hash.shift }.should raise_error(frozen_error_class)
+ -> { HashSpecs.frozen_hash.shift }.should raise_error(frozen_error_class)
+ -> { HashSpecs.empty_frozen_hash.shift }.should raise_error(frozen_error_class)
end
it "works when the hash is at capacity" do
diff --git a/spec/ruby/core/hash/to_proc_spec.rb b/spec/ruby/core/hash/to_proc_spec.rb
index ca55604043..3e7e57d11f 100644
--- a/spec/ruby/core/hash/to_proc_spec.rb
+++ b/spec/ruby/core/hash/to_proc_spec.rb
@@ -24,11 +24,11 @@ describe "Hash#to_proc" do
end
it "raises ArgumentError if not passed exactly one argument" do
- lambda {
+ -> {
@proc.call
}.should raise_error(ArgumentError)
- lambda {
+ -> {
@proc.call 1, 2
}.should raise_error(ArgumentError)
end
@@ -81,7 +81,7 @@ describe "Hash#to_proc" do
end
it "raises an ArgumentError when calling #call on the Proc with no arguments" do
- lambda { @hash.to_proc.call }.should raise_error(ArgumentError)
+ -> { @hash.to_proc.call }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/core/hash/try_convert_spec.rb b/spec/ruby/core/hash/try_convert_spec.rb
index 50bb59816c..44195c5010 100644
--- a/spec/ruby/core/hash/try_convert_spec.rb
+++ b/spec/ruby/core/hash/try_convert_spec.rb
@@ -39,12 +39,12 @@ describe "Hash.try_convert" do
it "sends #to_hash to the argument and raises TypeError if it's not a kind of Hash" do
obj = mock("to_hash")
obj.should_receive(:to_hash).and_return(Object.new)
- lambda { Hash.try_convert obj }.should raise_error(TypeError)
+ -> { Hash.try_convert obj }.should raise_error(TypeError)
end
it "does not rescue exceptions raised by #to_hash" do
obj = mock("to_hash")
obj.should_receive(:to_hash).and_raise(RuntimeError)
- lambda { Hash.try_convert obj }.should raise_error(RuntimeError)
+ -> { Hash.try_convert obj }.should raise_error(RuntimeError)
end
end
diff --git a/spec/ruby/core/integer/allbits_spec.rb b/spec/ruby/core/integer/allbits_spec.rb
index d7bd58d638..f4a6fe9905 100644
--- a/spec/ruby/core/integer/allbits_spec.rb
+++ b/spec/ruby/core/integer/allbits_spec.rb
@@ -28,12 +28,12 @@ ruby_version_is '2.5' do
end
it "raises a TypeError when given a non-Integer" do
- lambda {
+ -> {
(obj = mock('10')).should_receive(:coerce).any_number_of_times.and_return([42,10])
13.allbits?(obj)
}.should raise_error(TypeError)
- lambda { 13.allbits?("10") }.should raise_error(TypeError)
- lambda { 13.allbits?(:symbol) }.should raise_error(TypeError)
+ -> { 13.allbits?("10") }.should raise_error(TypeError)
+ -> { 13.allbits?(:symbol) }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/core/integer/anybits_spec.rb b/spec/ruby/core/integer/anybits_spec.rb
index 36803694aa..91f349258a 100644
--- a/spec/ruby/core/integer/anybits_spec.rb
+++ b/spec/ruby/core/integer/anybits_spec.rb
@@ -27,12 +27,12 @@ ruby_version_is '2.5' do
end
it "raises a TypeError when given a non-Integer" do
- lambda {
+ -> {
(obj = mock('10')).should_receive(:coerce).any_number_of_times.and_return([42,10])
13.anybits?(obj)
}.should raise_error(TypeError)
- lambda { 13.anybits?("10") }.should raise_error(TypeError)
- lambda { 13.anybits?(:symbol) }.should raise_error(TypeError)
+ -> { 13.anybits?("10") }.should raise_error(TypeError)
+ -> { 13.anybits?(:symbol) }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/core/integer/bit_and_spec.rb b/spec/ruby/core/integer/bit_and_spec.rb
index 8565f82397..15a8026855 100644
--- a/spec/ruby/core/integer/bit_and_spec.rb
+++ b/spec/ruby/core/integer/bit_and_spec.rb
@@ -35,14 +35,14 @@ describe "Integer#&" do
end
it "raises a TypeError when passed a Float" do
- lambda { (3 & 3.4) }.should raise_error(TypeError)
+ -> { (3 & 3.4) }.should raise_error(TypeError)
end
it "raises a TypeError and does not call #to_int when defined on an object" do
obj = mock("fixnum bit and")
obj.should_not_receive(:to_int)
- lambda { 3 & obj }.should raise_error(TypeError)
+ -> { 3 & obj }.should raise_error(TypeError)
end
end
@@ -84,14 +84,14 @@ describe "Integer#&" do
end
it "raises a TypeError when passed a Float" do
- lambda { (@bignum & 3.4) }.should raise_error(TypeError)
+ -> { (@bignum & 3.4) }.should raise_error(TypeError)
end
it "raises a TypeError and does not call #to_int when defined on an object" do
obj = mock("bignum bit and")
obj.should_not_receive(:to_int)
- lambda { @bignum & obj }.should raise_error(TypeError)
+ -> { @bignum & obj }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/core/integer/bit_or_spec.rb b/spec/ruby/core/integer/bit_or_spec.rb
index 16ab430f8b..e486eeec10 100644
--- a/spec/ruby/core/integer/bit_or_spec.rb
+++ b/spec/ruby/core/integer/bit_or_spec.rb
@@ -15,14 +15,14 @@ describe "Integer#|" do
end
it "raises a TypeError when passed a Float" do
- lambda { (3 | 3.4) }.should raise_error(TypeError)
+ -> { (3 | 3.4) }.should raise_error(TypeError)
end
it "raises a TypeError and does not call #to_int when defined on an object" do
obj = mock("integer bit or")
obj.should_not_receive(:to_int)
- lambda { 3 | obj }.should raise_error(TypeError)
+ -> { 3 | obj }.should raise_error(TypeError)
end
end
@@ -51,18 +51,18 @@ describe "Integer#|" do
it "raises a TypeError when passed a Float" do
not_supported_on :opal do
- lambda {
+ -> {
bignum_value | bignum_value(0xffff).to_f
}.should raise_error(TypeError)
end
- lambda { @bignum | 9.9 }.should raise_error(TypeError)
+ -> { @bignum | 9.9 }.should raise_error(TypeError)
end
it "raises a TypeError and does not call #to_int when defined on an object" do
obj = mock("bignum bit or")
obj.should_not_receive(:to_int)
- lambda { @bignum | obj }.should raise_error(TypeError)
+ -> { @bignum | obj }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/core/integer/bit_xor_spec.rb b/spec/ruby/core/integer/bit_xor_spec.rb
index 65f88341e0..ac8826a52f 100644
--- a/spec/ruby/core/integer/bit_xor_spec.rb
+++ b/spec/ruby/core/integer/bit_xor_spec.rb
@@ -13,14 +13,14 @@ describe "Integer#^" do
end
it "raises a TypeError when passed a Float" do
- lambda { (3 ^ 3.4) }.should raise_error(TypeError)
+ -> { (3 ^ 3.4) }.should raise_error(TypeError)
end
it "raises a TypeError and does not call #to_int when defined on an object" do
obj = mock("integer bit xor")
obj.should_not_receive(:to_int)
- lambda { 3 ^ obj }.should raise_error(TypeError)
+ -> { 3 ^ obj }.should raise_error(TypeError)
end
end
@@ -55,18 +55,18 @@ describe "Integer#^" do
it "raises a TypeError when passed a Float" do
not_supported_on :opal do
- lambda {
+ -> {
bignum_value ^ bignum_value(0xffff).to_f
}.should raise_error(TypeError)
end
- lambda { @bignum ^ 14.5 }.should raise_error(TypeError)
+ -> { @bignum ^ 14.5 }.should raise_error(TypeError)
end
it "raises a TypeError and does not call #to_int when defined on an object" do
obj = mock("bignum bit xor")
obj.should_not_receive(:to_int)
- lambda { @bignum ^ obj }.should raise_error(TypeError)
+ -> { @bignum ^ obj }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/core/integer/chr_spec.rb b/spec/ruby/core/integer/chr_spec.rb
index 02d0283182..a8755eeb84 100644
--- a/spec/ruby/core/integer/chr_spec.rb
+++ b/spec/ruby/core/integer/chr_spec.rb
@@ -10,8 +10,8 @@ describe "Integer#chr without argument" do
end
it "raises a RangeError is self is less than 0" do
- lambda { -1.chr }.should raise_error(RangeError)
- lambda { -bignum_value.chr }.should raise_error(RangeError)
+ -> { -1.chr }.should raise_error(RangeError)
+ -> { -bignum_value.chr }.should raise_error(RangeError)
end
describe "when Encoding.default_internal is nil" do
@@ -44,8 +44,8 @@ describe "Integer#chr without argument" do
end
it "raises a RangeError is self is greater than 255" do
- lambda { 256.chr }.should raise_error(RangeError)
- lambda { bignum_value.chr }.should raise_error(RangeError)
+ -> { 256.chr }.should raise_error(RangeError)
+ -> { bignum_value.chr }.should raise_error(RangeError)
end
end
@@ -133,7 +133,7 @@ describe "Integer#chr without argument" do
[620, "TIS-620"]
].each do |integer, encoding_name|
Encoding.default_internal = Encoding.find(encoding_name)
- lambda { integer.chr }.should raise_error(RangeError)
+ -> { integer.chr }.should raise_error(RangeError)
end
end
end
@@ -150,7 +150,7 @@ describe "Integer#chr with an encoding argument" do
end
it "accepts a String as an argument" do
- lambda { 0xA4A2.chr('euc-jp') }.should_not raise_error
+ -> { 0xA4A2.chr('euc-jp') }.should_not raise_error
end
it "converts a String to an Encoding as Encoding.find does" do
@@ -161,12 +161,12 @@ describe "Integer#chr with an encoding argument" do
# http://redmine.ruby-lang.org/issues/4869
it "raises a RangeError is self is less than 0" do
- lambda { -1.chr(Encoding::UTF_8) }.should raise_error(RangeError)
- lambda { -bignum_value.chr(Encoding::EUC_JP) }.should raise_error(RangeError)
+ -> { -1.chr(Encoding::UTF_8) }.should raise_error(RangeError)
+ -> { -bignum_value.chr(Encoding::EUC_JP) }.should raise_error(RangeError)
end
it "raises a RangeError if self is too large" do
- lambda { 2206368128.chr(Encoding::UTF_8) }.should raise_error(RangeError)
+ -> { 2206368128.chr(Encoding::UTF_8) }.should raise_error(RangeError)
end
it "returns a String with the specified encoding" do
@@ -237,7 +237,7 @@ describe "Integer#chr with an encoding argument" do
[0xDC00, "UTF-16"],
[0xDFFF, "UTF-16"],
].each do |integer, encoding_name|
- lambda { integer.chr(encoding_name) }.should raise_error(RangeError)
+ -> { integer.chr(encoding_name) }.should raise_error(RangeError)
end
end
end
diff --git a/spec/ruby/core/integer/coerce_spec.rb b/spec/ruby/core/integer/coerce_spec.rb
index 8db15bbaed..9a19baf2ea 100644
--- a/spec/ruby/core/integer/coerce_spec.rb
+++ b/spec/ruby/core/integer/coerce_spec.rb
@@ -1,5 +1,7 @@
require_relative '../../spec_helper'
+require 'bigdecimal'
+
describe "Integer#coerce" do
context "fixnum" do
describe "when given a Fixnum" do
@@ -11,7 +13,7 @@ describe "Integer#coerce" do
describe "when given a String" do
it "raises an ArgumentError when trying to coerce with a non-number String" do
- lambda { 1.coerce(":)") }.should raise_error(ArgumentError)
+ -> { 1.coerce(":)") }.should raise_error(ArgumentError)
end
it "returns an array containing two Floats" do
@@ -21,7 +23,7 @@ describe "Integer#coerce" do
end
it "raises a TypeError when trying to coerce with nil" do
- lambda { 1.coerce(nil) }.should raise_error(TypeError)
+ -> { 1.coerce(nil) }.should raise_error(TypeError)
end
it "tries to convert the given Object into a Float by using #to_f" do
@@ -29,13 +31,13 @@ describe "Integer#coerce" do
2.coerce(obj).should == [1.0, 2.0]
(obj = mock('0')).should_receive(:to_f).and_return('0')
- lambda { 2.coerce(obj).should == [1.0, 2.0] }.should raise_error(TypeError)
+ -> { 2.coerce(obj).should == [1.0, 2.0] }.should raise_error(TypeError)
end
it "raises a TypeError when given an Object that does not respond to #to_f" do
- lambda { 1.coerce(mock('x')) }.should raise_error(TypeError)
- lambda { 1.coerce(1..4) }.should raise_error(TypeError)
- lambda { 1.coerce(:test) }.should raise_error(TypeError)
+ -> { 1.coerce(mock('x')) }.should raise_error(TypeError)
+ -> { 1.coerce(1..4) }.should raise_error(TypeError)
+ -> { 1.coerce(:test) }.should raise_error(TypeError)
end
end
@@ -62,10 +64,10 @@ describe "Integer#coerce" do
it "raises a TypeError when not passed a Fixnum or Bignum" do
a = bignum_value
- lambda { a.coerce(nil) }.should raise_error(TypeError)
- lambda { a.coerce(mock('str')) }.should raise_error(TypeError)
- lambda { a.coerce(1..4) }.should raise_error(TypeError)
- lambda { a.coerce(:test) }.should raise_error(TypeError)
+ -> { a.coerce(nil) }.should raise_error(TypeError)
+ -> { a.coerce(mock('str')) }.should raise_error(TypeError)
+ -> { a.coerce(1..4) }.should raise_error(TypeError)
+ -> { a.coerce(:test) }.should raise_error(TypeError)
end
it "coerces both values to Floats and returns [other, self] when passed a Float" do
@@ -88,4 +90,15 @@ describe "Integer#coerce" do
ary.should == [1.2, a.to_f]
end
end
+
+ context "bigdecimal" do
+ it "produces Floats" do
+ x, y = 3.coerce(BigDecimal("3.4"))
+ x.class.should == Float
+ x.should == 3.4
+ y.class.should == Float
+ y.should == 3.0
+ end
+ end
+
end
diff --git a/spec/ruby/core/integer/comparison_spec.rb b/spec/ruby/core/integer/comparison_spec.rb
index 4cf1d7cdc7..762af51535 100644
--- a/spec/ruby/core/integer/comparison_spec.rb
+++ b/spec/ruby/core/integer/comparison_spec.rb
@@ -127,7 +127,7 @@ describe "Integer#<=>" do
ruby_version_is ""..."2.5" do
it "returns nil if #coerce raises an exception" do
@num.should_receive(:coerce).with(@big).and_raise(RuntimeError)
- lambda {
+ -> {
@result = (@big <=> @num)
}.should complain(/Numerical comparison operators will no more rescue exceptions/)
@result.should be_nil
@@ -137,7 +137,7 @@ describe "Integer#<=>" do
ruby_version_is "2.5" do
it "lets the exception go through if #coerce raises an exception" do
@num.should_receive(:coerce).with(@big).and_raise(RuntimeError.new("my error"))
- lambda {
+ -> {
@big <=> @num
}.should raise_error(RuntimeError, "my error")
end
@@ -145,7 +145,7 @@ describe "Integer#<=>" do
it "raises an exception if #coerce raises a non-StandardError exception" do
@num.should_receive(:coerce).with(@big).and_raise(Exception)
- lambda { @big <=> @num }.should raise_error(Exception)
+ -> { @big <=> @num }.should raise_error(Exception)
end
it "returns nil if #coerce does not return an Array" do
diff --git a/spec/ruby/core/integer/digits_spec.rb b/spec/ruby/core/integer/digits_spec.rb
index 85afb6f50f..4a8e33980c 100644
--- a/spec/ruby/core/integer/digits_spec.rb
+++ b/spec/ruby/core/integer/digits_spec.rb
@@ -19,14 +19,14 @@ describe "Integer#digits" do
end
it "raises ArgumentError when calling with a radix less than 2" do
- lambda { 12345.digits(1) }.should raise_error(ArgumentError)
+ -> { 12345.digits(1) }.should raise_error(ArgumentError)
end
it "raises ArgumentError when calling with a negative radix" do
- lambda { 12345.digits(-2) }.should raise_error(ArgumentError)
+ -> { 12345.digits(-2) }.should raise_error(ArgumentError)
end
it "raises Math::DomainError when calling digits on a negative number" do
- lambda { -12345.digits(7) }.should raise_error(Math::DomainError)
+ -> { -12345.digits(7) }.should raise_error(Math::DomainError)
end
end
diff --git a/spec/ruby/core/integer/div_spec.rb b/spec/ruby/core/integer/div_spec.rb
index ca69ff4681..087d012fe0 100644
--- a/spec/ruby/core/integer/div_spec.rb
+++ b/spec/ruby/core/integer/div_spec.rb
@@ -46,21 +46,21 @@ describe "Integer#div" do
end
it "raises a ZeroDivisionError when the given argument is 0 and a Float" do
- lambda { 0.div(0.0) }.should raise_error(ZeroDivisionError)
- lambda { 10.div(0.0) }.should raise_error(ZeroDivisionError)
- lambda { -10.div(0.0) }.should raise_error(ZeroDivisionError)
+ -> { 0.div(0.0) }.should raise_error(ZeroDivisionError)
+ -> { 10.div(0.0) }.should raise_error(ZeroDivisionError)
+ -> { -10.div(0.0) }.should raise_error(ZeroDivisionError)
end
it "raises a ZeroDivisionError when the given argument is 0 and not a Float" do
- lambda { 13.div(0) }.should raise_error(ZeroDivisionError)
- lambda { 13.div(-0) }.should raise_error(ZeroDivisionError)
+ -> { 13.div(0) }.should raise_error(ZeroDivisionError)
+ -> { 13.div(-0) }.should raise_error(ZeroDivisionError)
end
it "raises a TypeError when given a non-numeric argument" do
- lambda { 13.div(mock('10')) }.should raise_error(TypeError)
- lambda { 5.div("2") }.should raise_error(TypeError)
- lambda { 5.div(:"2") }.should raise_error(TypeError)
- lambda { 5.div([]) }.should raise_error(TypeError)
+ -> { 13.div(mock('10')) }.should raise_error(TypeError)
+ -> { 5.div("2") }.should raise_error(TypeError)
+ -> { 5.div(:"2") }.should raise_error(TypeError)
+ -> { 5.div([]) }.should raise_error(TypeError)
end
end
@@ -118,9 +118,9 @@ describe "Integer#div" do
end
it "raises a TypeError when given a non-numeric" do
- lambda { @bignum.div(mock("10")) }.should raise_error(TypeError)
- lambda { @bignum.div("2") }.should raise_error(TypeError)
- lambda { @bignum.div(:symbol) }.should raise_error(TypeError)
+ -> { @bignum.div(mock("10")) }.should raise_error(TypeError)
+ -> { @bignum.div("2") }.should raise_error(TypeError)
+ -> { @bignum.div(:symbol) }.should raise_error(TypeError)
end
it "returns a result of integer division of self by a float argument" do
@@ -134,13 +134,13 @@ describe "Integer#div" do
# #5490
it "raises ZeroDivisionError if the argument is 0 and is a Float" do
- lambda { @bignum.div(0.0) }.should raise_error(ZeroDivisionError)
- lambda { @bignum.div(-0.0) }.should raise_error(ZeroDivisionError)
+ -> { @bignum.div(0.0) }.should raise_error(ZeroDivisionError)
+ -> { @bignum.div(-0.0) }.should raise_error(ZeroDivisionError)
end
it "raises ZeroDivisionError if the argument is 0 and is not a Float" do
- lambda { @bignum.div(0) }.should raise_error(ZeroDivisionError)
- lambda { @bignum.div(-0) }.should raise_error(ZeroDivisionError)
+ -> { @bignum.div(0) }.should raise_error(ZeroDivisionError)
+ -> { @bignum.div(-0) }.should raise_error(ZeroDivisionError)
end
end
end
diff --git a/spec/ruby/core/integer/divide_spec.rb b/spec/ruby/core/integer/divide_spec.rb
index 2d49307628..a32d68c229 100644
--- a/spec/ruby/core/integer/divide_spec.rb
+++ b/spec/ruby/core/integer/divide_spec.rb
@@ -27,7 +27,7 @@ describe "Integer#/" do
end
it "raises a ZeroDivisionError if the given argument is zero and not a Float" do
- lambda { 1 / 0 }.should raise_error(ZeroDivisionError)
+ -> { 1 / 0 }.should raise_error(ZeroDivisionError)
end
it "does NOT raise ZeroDivisionError if the given argument is zero and is a Float" do
@@ -41,9 +41,9 @@ describe "Integer#/" do
end
it "raises a TypeError when given a non-Integer" do
- lambda { 13 / mock('10') }.should raise_error(TypeError)
- lambda { 13 / "10" }.should raise_error(TypeError)
- lambda { 13 / :symbol }.should raise_error(TypeError)
+ -> { 13 / mock('10') }.should raise_error(TypeError)
+ -> { 13 / "10" }.should raise_error(TypeError)
+ -> { 13 / :symbol }.should raise_error(TypeError)
end
end
@@ -83,13 +83,13 @@ describe "Integer#/" do
end
it "raises a ZeroDivisionError if other is zero and not a Float" do
- lambda { @bignum / 0 }.should raise_error(ZeroDivisionError)
+ -> { @bignum / 0 }.should raise_error(ZeroDivisionError)
end
it "raises a TypeError when given a non-numeric" do
- lambda { @bignum / mock('10') }.should raise_error(TypeError)
- lambda { @bignum / "2" }.should raise_error(TypeError)
- lambda { @bignum / :symbol }.should raise_error(TypeError)
+ -> { @bignum / mock('10') }.should raise_error(TypeError)
+ -> { @bignum / "2" }.should raise_error(TypeError)
+ -> { @bignum / :symbol }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/core/integer/divmod_spec.rb b/spec/ruby/core/integer/divmod_spec.rb
index 27fb34574c..d88925caad 100644
--- a/spec/ruby/core/integer/divmod_spec.rb
+++ b/spec/ruby/core/integer/divmod_spec.rb
@@ -14,24 +14,24 @@ describe "Integer#divmod" do
end
it "raises a ZeroDivisionError when the given argument is 0" do
- lambda { 13.divmod(0) }.should raise_error(ZeroDivisionError)
- lambda { 0.divmod(0) }.should raise_error(ZeroDivisionError)
- lambda { -10.divmod(0) }.should raise_error(ZeroDivisionError)
+ -> { 13.divmod(0) }.should raise_error(ZeroDivisionError)
+ -> { 0.divmod(0) }.should raise_error(ZeroDivisionError)
+ -> { -10.divmod(0) }.should raise_error(ZeroDivisionError)
end
it "raises a ZeroDivisionError when the given argument is 0 and a Float" do
- lambda { 0.divmod(0.0) }.should raise_error(ZeroDivisionError)
- lambda { 10.divmod(0.0) }.should raise_error(ZeroDivisionError)
- lambda { -10.divmod(0.0) }.should raise_error(ZeroDivisionError)
+ -> { 0.divmod(0.0) }.should raise_error(ZeroDivisionError)
+ -> { 10.divmod(0.0) }.should raise_error(ZeroDivisionError)
+ -> { -10.divmod(0.0) }.should raise_error(ZeroDivisionError)
end
it "raises a TypeError when given a non-Integer" do
- lambda {
+ -> {
(obj = mock('10')).should_receive(:to_int).any_number_of_times.and_return(10)
13.divmod(obj)
}.should raise_error(TypeError)
- lambda { 13.divmod("10") }.should raise_error(TypeError)
- lambda { 13.divmod(:symbol) }.should raise_error(TypeError)
+ -> { 13.divmod("10") }.should raise_error(TypeError)
+ -> { 13.divmod(:symbol) }.should raise_error(TypeError)
end
end
@@ -94,24 +94,24 @@ describe "Integer#divmod" do
end
it "raises a ZeroDivisionError when the given argument is 0" do
- lambda { @bignum.divmod(0) }.should raise_error(ZeroDivisionError)
- lambda { (-@bignum).divmod(0) }.should raise_error(ZeroDivisionError)
+ -> { @bignum.divmod(0) }.should raise_error(ZeroDivisionError)
+ -> { (-@bignum).divmod(0) }.should raise_error(ZeroDivisionError)
end
# Behaviour established as correct in r23953
it "raises a FloatDomainError if other is NaN" do
- lambda { @bignum.divmod(nan_value) }.should raise_error(FloatDomainError)
+ -> { @bignum.divmod(nan_value) }.should raise_error(FloatDomainError)
end
it "raises a ZeroDivisionError when the given argument is 0 and a Float" do
- lambda { @bignum.divmod(0.0) }.should raise_error(ZeroDivisionError)
- lambda { (-@bignum).divmod(0.0) }.should raise_error(ZeroDivisionError)
+ -> { @bignum.divmod(0.0) }.should raise_error(ZeroDivisionError)
+ -> { (-@bignum).divmod(0.0) }.should raise_error(ZeroDivisionError)
end
it "raises a TypeError when the given argument is not an Integer" do
- lambda { @bignum.divmod(mock('10')) }.should raise_error(TypeError)
- lambda { @bignum.divmod("10") }.should raise_error(TypeError)
- lambda { @bignum.divmod(:symbol) }.should raise_error(TypeError)
+ -> { @bignum.divmod(mock('10')) }.should raise_error(TypeError)
+ -> { @bignum.divmod("10") }.should raise_error(TypeError)
+ -> { @bignum.divmod(:symbol) }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/core/integer/downto_spec.rb b/spec/ruby/core/integer/downto_spec.rb
index 92dee89fc9..af7a7e36b9 100644
--- a/spec/ruby/core/integer/downto_spec.rb
+++ b/spec/ruby/core/integer/downto_spec.rb
@@ -27,8 +27,8 @@ describe "Integer#downto [stop] when self and stop are Fixnums" do
end
it "raises an ArgumentError for invalid endpoints" do
- lambda {1.downto("A") {|x| p x } }.should raise_error(ArgumentError)
- lambda {1.downto(nil) {|x| p x } }.should raise_error(ArgumentError)
+ -> {1.downto("A") {|x| p x } }.should raise_error(ArgumentError)
+ -> {1.downto(nil) {|x| p x } }.should raise_error(ArgumentError)
end
describe "when no block is given" do
@@ -45,9 +45,9 @@ describe "Integer#downto [stop] when self and stop are Fixnums" do
describe "size" do
it "raises an ArgumentError for invalid endpoints" do
enum = 1.downto("A")
- lambda { enum.size }.should raise_error(ArgumentError)
+ -> { enum.size }.should raise_error(ArgumentError)
enum = 1.downto(nil)
- lambda { enum.size }.should raise_error(ArgumentError)
+ -> { enum.size }.should raise_error(ArgumentError)
end
it "returns self - stop + 1" do
diff --git a/spec/ruby/core/integer/element_reference_spec.rb b/spec/ruby/core/integer/element_reference_spec.rb
index 6c72a717d6..99283fac34 100644
--- a/spec/ruby/core/integer/element_reference_spec.rb
+++ b/spec/ruby/core/integer/element_reference_spec.rb
@@ -59,13 +59,13 @@ describe "Integer#[]" do
end
it "raises a TypeError when passed a String" do
- lambda { 3["3"] }.should raise_error(TypeError)
+ -> { 3["3"] }.should raise_error(TypeError)
end
it "raises a TypeError when #to_int does not return an Integer" do
obj = mock('asdf')
obj.should_receive(:to_int).and_return("asdf")
- lambda { 3[obj] }.should raise_error(TypeError)
+ -> { 3[obj] }.should raise_error(TypeError)
end
it "calls #to_int to coerce a String to a Bignum and returns 0" do
@@ -102,10 +102,10 @@ describe "Integer#[]" do
it "raises a TypeError when the given argument can't be converted to Integer" do
obj = mock('asdf')
- lambda { @bignum[obj] }.should raise_error(TypeError)
+ -> { @bignum[obj] }.should raise_error(TypeError)
obj.should_receive(:to_int).and_return("asdf")
- lambda { @bignum[obj] }.should raise_error(TypeError)
+ -> { @bignum[obj] }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/core/integer/fdiv_spec.rb b/spec/ruby/core/integer/fdiv_spec.rb
index b27e6f1389..6de170278f 100644
--- a/spec/ruby/core/integer/fdiv_spec.rb
+++ b/spec/ruby/core/integer/fdiv_spec.rb
@@ -35,11 +35,11 @@ describe "Integer#fdiv" do
end
it "raises a TypeError when argument isn't numeric" do
- lambda { 1.fdiv(mock('non-numeric')) }.should raise_error(TypeError)
+ -> { 1.fdiv(mock('non-numeric')) }.should raise_error(TypeError)
end
it "raises an ArgumentError when passed multiple arguments" do
- lambda { 1.fdiv(6,0.2) }.should raise_error(ArgumentError)
+ -> { 1.fdiv(6,0.2) }.should raise_error(ArgumentError)
end
it "follows the coercion protocol" do
diff --git a/spec/ruby/core/integer/gcd_spec.rb b/spec/ruby/core/integer/gcd_spec.rb
index 238bf66cc0..8aa654a16a 100644
--- a/spec/ruby/core/integer/gcd_spec.rb
+++ b/spec/ruby/core/integer/gcd_spec.rb
@@ -55,15 +55,15 @@ describe "Integer#gcd" do
end
it "raises an ArgumentError if not given an argument" do
- lambda { 12.gcd }.should raise_error(ArgumentError)
+ -> { 12.gcd }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if given more than one argument" do
- lambda { 12.gcd(30, 20) }.should raise_error(ArgumentError)
+ -> { 12.gcd(30, 20) }.should raise_error(ArgumentError)
end
it "raises a TypeError unless the argument is an Integer" do
- lambda { 39.gcd(3.8) }.should raise_error(TypeError)
- lambda { 45872.gcd([]) }.should raise_error(TypeError)
+ -> { 39.gcd(3.8) }.should raise_error(TypeError)
+ -> { 45872.gcd([]) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/integer/gcdlcm_spec.rb b/spec/ruby/core/integer/gcdlcm_spec.rb
index 362f8a51bd..5b3669e62a 100644
--- a/spec/ruby/core/integer/gcdlcm_spec.rb
+++ b/spec/ruby/core/integer/gcdlcm_spec.rb
@@ -39,15 +39,15 @@ describe "Integer#gcdlcm" do
end
it "raises an ArgumentError if not given an argument" do
- lambda { 12.gcdlcm }.should raise_error(ArgumentError)
+ -> { 12.gcdlcm }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if given more than one argument" do
- lambda { 12.gcdlcm(30, 20) }.should raise_error(ArgumentError)
+ -> { 12.gcdlcm(30, 20) }.should raise_error(ArgumentError)
end
it "raises a TypeError unless the argument is an Integer" do
- lambda { 39.gcdlcm(3.8) }.should raise_error(TypeError)
- lambda { 45872.gcdlcm([]) }.should raise_error(TypeError)
+ -> { 39.gcdlcm(3.8) }.should raise_error(TypeError)
+ -> { 45872.gcdlcm([]) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/integer/gt_spec.rb b/spec/ruby/core/integer/gt_spec.rb
index 14c51c9acc..428a6f6888 100644
--- a/spec/ruby/core/integer/gt_spec.rb
+++ b/spec/ruby/core/integer/gt_spec.rb
@@ -23,8 +23,8 @@ describe "Integer#>" do
end
it "raises an ArgumentError when given a non-Integer" do
- lambda { 5 > "4" }.should raise_error(ArgumentError)
- lambda { 5 > mock('x') }.should raise_error(ArgumentError)
+ -> { 5 > "4" }.should raise_error(ArgumentError)
+ -> { 5 > mock('x') }.should raise_error(ArgumentError)
end
end
@@ -42,8 +42,8 @@ describe "Integer#>" do
end
it "raises an ArgumentError when given a non-Integer" do
- lambda { @bignum > "4" }.should raise_error(ArgumentError)
- lambda { @bignum > mock('str') }.should raise_error(ArgumentError)
+ -> { @bignum > "4" }.should raise_error(ArgumentError)
+ -> { @bignum > mock('str') }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/core/integer/gte_spec.rb b/spec/ruby/core/integer/gte_spec.rb
index 3d5c48faa5..ce1385c360 100644
--- a/spec/ruby/core/integer/gte_spec.rb
+++ b/spec/ruby/core/integer/gte_spec.rb
@@ -24,8 +24,8 @@ describe "Integer#>=" do
end
it "raises an ArgumentError when given a non-Integer" do
- lambda { 5 >= "4" }.should raise_error(ArgumentError)
- lambda { 5 >= mock('x') }.should raise_error(ArgumentError)
+ -> { 5 >= "4" }.should raise_error(ArgumentError)
+ -> { 5 >= mock('x') }.should raise_error(ArgumentError)
end
end
@@ -42,8 +42,8 @@ describe "Integer#>=" do
end
it "raises an ArgumentError when given a non-Integer" do
- lambda { @bignum >= "4" }.should raise_error(ArgumentError)
- lambda { @bignum >= mock('str') }.should raise_error(ArgumentError)
+ -> { @bignum >= "4" }.should raise_error(ArgumentError)
+ -> { @bignum >= mock('str') }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/core/integer/lcm_spec.rb b/spec/ruby/core/integer/lcm_spec.rb
index 6d608bdf41..77d3ad3488 100644
--- a/spec/ruby/core/integer/lcm_spec.rb
+++ b/spec/ruby/core/integer/lcm_spec.rb
@@ -44,15 +44,15 @@ describe "Integer#lcm" do
end
it "raises an ArgumentError if not given an argument" do
- lambda { 12.lcm }.should raise_error(ArgumentError)
+ -> { 12.lcm }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if given more than one argument" do
- lambda { 12.lcm(30, 20) }.should raise_error(ArgumentError)
+ -> { 12.lcm(30, 20) }.should raise_error(ArgumentError)
end
it "raises a TypeError unless the argument is an Integer" do
- lambda { 39.lcm(3.8) }.should raise_error(TypeError)
- lambda { 45872.lcm([]) }.should raise_error(TypeError)
+ -> { 39.lcm(3.8) }.should raise_error(TypeError)
+ -> { 45872.lcm([]) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/integer/left_shift_spec.rb b/spec/ruby/core/integer/left_shift_spec.rb
index a240c541c5..4b5ef9386e 100644
--- a/spec/ruby/core/integer/left_shift_spec.rb
+++ b/spec/ruby/core/integer/left_shift_spec.rb
@@ -79,15 +79,15 @@ describe "Integer#<< (with n << m)" do
obj = mock("a string")
obj.should_receive(:to_int).and_return("asdf")
- lambda { 3 << obj }.should raise_error(TypeError)
+ -> { 3 << obj }.should raise_error(TypeError)
end
it "raises a TypeError when passed nil" do
- lambda { 3 << nil }.should raise_error(TypeError)
+ -> { 3 << nil }.should raise_error(TypeError)
end
it "raises a TypeError when passed a String" do
- lambda { 3 << "4" }.should raise_error(TypeError)
+ -> { 3 << "4" }.should raise_error(TypeError)
end
end
@@ -151,15 +151,15 @@ describe "Integer#<< (with n << m)" do
obj = mock("a string")
obj.should_receive(:to_int).and_return("asdf")
- lambda { @bignum << obj }.should raise_error(TypeError)
+ -> { @bignum << obj }.should raise_error(TypeError)
end
it "raises a TypeError when passed nil" do
- lambda { @bignum << nil }.should raise_error(TypeError)
+ -> { @bignum << nil }.should raise_error(TypeError)
end
it "raises a TypeError when passed a String" do
- lambda { @bignum << "4" }.should raise_error(TypeError)
+ -> { @bignum << "4" }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/core/integer/lt_spec.rb b/spec/ruby/core/integer/lt_spec.rb
index a33a297d8b..dfe2d9e369 100644
--- a/spec/ruby/core/integer/lt_spec.rb
+++ b/spec/ruby/core/integer/lt_spec.rb
@@ -23,8 +23,8 @@ describe "Integer#<" do
end
it "raises an ArgumentError when given a non-Integer" do
- lambda { 5 < "4" }.should raise_error(ArgumentError)
- lambda { 5 < mock('x') }.should raise_error(ArgumentError)
+ -> { 5 < "4" }.should raise_error(ArgumentError)
+ -> { 5 < mock('x') }.should raise_error(ArgumentError)
end
end
@@ -44,8 +44,8 @@ describe "Integer#<" do
end
it "raises an ArgumentError when given a non-Integer" do
- lambda { @bignum < "4" }.should raise_error(ArgumentError)
- lambda { @bignum < mock('str') }.should raise_error(ArgumentError)
+ -> { @bignum < "4" }.should raise_error(ArgumentError)
+ -> { @bignum < mock('str') }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/core/integer/lte_spec.rb b/spec/ruby/core/integer/lte_spec.rb
index 1d3ecea2ac..3d843a5dd9 100644
--- a/spec/ruby/core/integer/lte_spec.rb
+++ b/spec/ruby/core/integer/lte_spec.rb
@@ -24,8 +24,8 @@ describe "Integer#<=" do
end
it "raises an ArgumentError when given a non-Integer" do
- lambda { 5 <= "4" }.should raise_error(ArgumentError)
- lambda { 5 <= mock('x') }.should raise_error(ArgumentError)
+ -> { 5 <= "4" }.should raise_error(ArgumentError)
+ -> { 5 <= mock('x') }.should raise_error(ArgumentError)
end
end
@@ -47,8 +47,8 @@ describe "Integer#<=" do
end
it "raises an ArgumentError when given a non-Integer" do
- lambda { @bignum <= "4" }.should raise_error(ArgumentError)
- lambda { @bignum <= mock('str') }.should raise_error(ArgumentError)
+ -> { @bignum <= "4" }.should raise_error(ArgumentError)
+ -> { @bignum <= mock('str') }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/core/integer/minus_spec.rb b/spec/ruby/core/integer/minus_spec.rb
index 84db427172..34dd36c1a7 100644
--- a/spec/ruby/core/integer/minus_spec.rb
+++ b/spec/ruby/core/integer/minus_spec.rb
@@ -20,12 +20,12 @@ describe "Integer#-" do
end
it "raises a TypeError when given a non-Integer" do
- lambda {
+ -> {
(obj = mock('10')).should_receive(:to_int).any_number_of_times.and_return(10)
13 - obj
}.should raise_error(TypeError)
- lambda { 13 - "10" }.should raise_error(TypeError)
- lambda { 13 - :symbol }.should raise_error(TypeError)
+ -> { 13 - "10" }.should raise_error(TypeError)
+ -> { 13 - :symbol }.should raise_error(TypeError)
end
end
@@ -41,9 +41,9 @@ describe "Integer#-" do
end
it "raises a TypeError when given a non-Integer" do
- lambda { @bignum - mock('10') }.should raise_error(TypeError)
- lambda { @bignum - "10" }.should raise_error(TypeError)
- lambda { @bignum - :symbol }.should raise_error(TypeError)
+ -> { @bignum - mock('10') }.should raise_error(TypeError)
+ -> { @bignum - "10" }.should raise_error(TypeError)
+ -> { @bignum - :symbol }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/core/integer/multiply_spec.rb b/spec/ruby/core/integer/multiply_spec.rb
index 1683b0c96e..919786cbcc 100644
--- a/spec/ruby/core/integer/multiply_spec.rb
+++ b/spec/ruby/core/integer/multiply_spec.rb
@@ -21,12 +21,12 @@ describe "Integer#*" do
end
it "raises a TypeError when given a non-Integer" do
- lambda {
+ -> {
(obj = mock('10')).should_receive(:to_int).any_number_of_times.and_return(10)
13 * obj
}.should raise_error(TypeError)
- lambda { 13 * "10" }.should raise_error(TypeError)
- lambda { 13 * :symbol }.should raise_error(TypeError)
+ -> { 13 * "10" }.should raise_error(TypeError)
+ -> { 13 * :symbol }.should raise_error(TypeError)
end
end
@@ -43,9 +43,9 @@ describe "Integer#*" do
end
it "raises a TypeError when given a non-Integer" do
- lambda { @bignum * mock('10') }.should raise_error(TypeError)
- lambda { @bignum * "10" }.should raise_error(TypeError)
- lambda { @bignum * :symbol }.should raise_error(TypeError)
+ -> { @bignum * mock('10') }.should raise_error(TypeError)
+ -> { @bignum * "10" }.should raise_error(TypeError)
+ -> { @bignum * :symbol }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/core/integer/nobits_spec.rb b/spec/ruby/core/integer/nobits_spec.rb
index da689de5df..af3b9e7db0 100644
--- a/spec/ruby/core/integer/nobits_spec.rb
+++ b/spec/ruby/core/integer/nobits_spec.rb
@@ -27,12 +27,12 @@ ruby_version_is '2.5' do
end
it "raises a TypeError when given a non-Integer" do
- lambda {
+ -> {
(obj = mock('10')).should_receive(:coerce).any_number_of_times.and_return([42,10])
13.nobits?(obj)
}.should raise_error(TypeError)
- lambda { 13.nobits?("10") }.should raise_error(TypeError)
- lambda { 13.nobits?(:symbol) }.should raise_error(TypeError)
+ -> { 13.nobits?("10") }.should raise_error(TypeError)
+ -> { 13.nobits?(:symbol) }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/core/integer/plus_spec.rb b/spec/ruby/core/integer/plus_spec.rb
index 2880840bc1..7e919a16db 100644
--- a/spec/ruby/core/integer/plus_spec.rb
+++ b/spec/ruby/core/integer/plus_spec.rb
@@ -20,12 +20,12 @@ describe "Integer#+" do
end
it "raises a TypeError when given a non-Integer" do
- lambda {
+ -> {
(obj = mock('10')).should_receive(:to_int).any_number_of_times.and_return(10)
13 + obj
}.should raise_error(TypeError)
- lambda { 13 + "10" }.should raise_error(TypeError)
- lambda { 13 + :symbol }.should raise_error(TypeError)
+ -> { 13 + "10" }.should raise_error(TypeError)
+ -> { 13 + :symbol }.should raise_error(TypeError)
end
end
@@ -41,9 +41,9 @@ describe "Integer#+" do
end
it "raises a TypeError when given a non-Integer" do
- lambda { @bignum + mock('10') }.should raise_error(TypeError)
- lambda { @bignum + "10" }.should raise_error(TypeError)
- lambda { @bignum + :symbol}.should raise_error(TypeError)
+ -> { @bignum + mock('10') }.should raise_error(TypeError)
+ -> { @bignum + "10" }.should raise_error(TypeError)
+ -> { @bignum + :symbol}.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/core/integer/rationalize_spec.rb b/spec/ruby/core/integer/rationalize_spec.rb
index 590ab40cb2..09d741af33 100644
--- a/spec/ruby/core/integer/rationalize_spec.rb
+++ b/spec/ruby/core/integer/rationalize_spec.rb
@@ -33,7 +33,7 @@ describe "Integer#rationalize" do
end
it "raises ArgumentError when passed more than one argument" do
- lambda { 1.rationalize(0.1, 0.1) }.should raise_error(ArgumentError)
- lambda { 1.rationalize(0.1, 0.1, 2) }.should raise_error(ArgumentError)
+ -> { 1.rationalize(0.1, 0.1) }.should raise_error(ArgumentError)
+ -> { 1.rationalize(0.1, 0.1, 2) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/integer/remainder_spec.rb b/spec/ruby/core/integer/remainder_spec.rb
index 473c59a2f0..cd10dad6f2 100644
--- a/spec/ruby/core/integer/remainder_spec.rb
+++ b/spec/ruby/core/integer/remainder_spec.rb
@@ -38,14 +38,14 @@ describe "Integer#remainder" do
end
it "raises a ZeroDivisionError if other is zero and not a Float" do
- lambda { bignum_value(66).remainder(0) }.should raise_error(ZeroDivisionError)
+ -> { bignum_value(66).remainder(0) }.should raise_error(ZeroDivisionError)
end
it "does raises ZeroDivisionError if other is zero and a Float" do
a = bignum_value(7)
b = bignum_value(32)
- lambda { a.remainder(0.0) }.should raise_error(ZeroDivisionError)
- lambda { b.remainder(-0.0) }.should raise_error(ZeroDivisionError)
+ -> { a.remainder(0.0) }.should raise_error(ZeroDivisionError)
+ -> { b.remainder(-0.0) }.should raise_error(ZeroDivisionError)
end
end
end
diff --git a/spec/ruby/core/integer/right_shift_spec.rb b/spec/ruby/core/integer/right_shift_spec.rb
index 641d4da662..3eeaf3eb2f 100644
--- a/spec/ruby/core/integer/right_shift_spec.rb
+++ b/spec/ruby/core/integer/right_shift_spec.rb
@@ -79,15 +79,15 @@ describe "Integer#>> (with n >> m)" do
obj = mock("a string")
obj.should_receive(:to_int).and_return("asdf")
- lambda { 3 >> obj }.should raise_error(TypeError)
+ -> { 3 >> obj }.should raise_error(TypeError)
end
it "raises a TypeError when passed nil" do
- lambda { 3 >> nil }.should raise_error(TypeError)
+ -> { 3 >> nil }.should raise_error(TypeError)
end
it "raises a TypeError when passed a String" do
- lambda { 3 >> "4" }.should raise_error(TypeError)
+ -> { 3 >> "4" }.should raise_error(TypeError)
end
end
@@ -177,15 +177,15 @@ describe "Integer#>> (with n >> m)" do
obj = mock("a string")
obj.should_receive(:to_int).and_return("asdf")
- lambda { @bignum >> obj }.should raise_error(TypeError)
+ -> { @bignum >> obj }.should raise_error(TypeError)
end
it "raises a TypeError when passed nil" do
- lambda { @bignum >> nil }.should raise_error(TypeError)
+ -> { @bignum >> nil }.should raise_error(TypeError)
end
it "raises a TypeError when passed a String" do
- lambda { @bignum >> "4" }.should raise_error(TypeError)
+ -> { @bignum >> "4" }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/core/integer/round_spec.rb b/spec/ruby/core/integer/round_spec.rb
index a45a7b5fb3..feb6d475d3 100644
--- a/spec/ruby/core/integer/round_spec.rb
+++ b/spec/ruby/core/integer/round_spec.rb
@@ -31,24 +31,24 @@ describe "Integer#round" do
platform_is_not wordsize: 32 do
it "raises a RangeError when passed a big negative value" do
- lambda { 42.round(fixnum_min) }.should raise_error(RangeError)
+ -> { 42.round(fixnum_min) }.should raise_error(RangeError)
end
end
it "raises a RangeError when passed Float::INFINITY" do
- lambda { 42.round(Float::INFINITY) }.should raise_error(RangeError)
+ -> { 42.round(Float::INFINITY) }.should raise_error(RangeError)
end
it "raises a RangeError when passed a beyond signed int" do
- lambda { 42.round(1<<31) }.should raise_error(RangeError)
+ -> { 42.round(1<<31) }.should raise_error(RangeError)
end
it "raises a TypeError when passed a String" do
- lambda { 42.round("4") }.should raise_error(TypeError)
+ -> { 42.round("4") }.should raise_error(TypeError)
end
it "raises a TypeError when its argument cannot be converted to an Integer" do
- lambda { 42.round(nil) }.should raise_error(TypeError)
+ -> { 42.round(nil) }.should raise_error(TypeError)
end
it "calls #to_int on the argument to convert it to an Integer" do
@@ -60,7 +60,7 @@ describe "Integer#round" do
it "raises a TypeError when #to_int does not return an Integer" do
obj = mock("Object")
obj.stub!(:to_int).and_return([])
- lambda { 42.round(obj) }.should raise_error(TypeError)
+ -> { 42.round(obj) }.should raise_error(TypeError)
end
it "returns different rounded values depending on the half option" do
@@ -95,7 +95,7 @@ describe "Integer#round" do
end
it "raises ArgumentError for an unknown rounding mode" do
- lambda { 42.round(-1, half: :foo) }.should raise_error(ArgumentError, /invalid rounding mode: foo/)
- lambda { 42.round(1, half: :foo) }.should raise_error(ArgumentError, /invalid rounding mode: foo/)
+ -> { 42.round(-1, half: :foo) }.should raise_error(ArgumentError, /invalid rounding mode: foo/)
+ -> { 42.round(1, half: :foo) }.should raise_error(ArgumentError, /invalid rounding mode: foo/)
end
end
diff --git a/spec/ruby/core/integer/shared/exponent.rb b/spec/ruby/core/integer/shared/exponent.rb
index 810e2a7101..f292cc2448 100644
--- a/spec/ruby/core/integer/shared/exponent.rb
+++ b/spec/ruby/core/integer/shared/exponent.rb
@@ -99,9 +99,9 @@ describe :integer_exponent, shared: true do
end
it "raises a TypeError when given a non-Integer" do
- lambda { @bignum.send(@method, mock('10')) }.should raise_error(TypeError)
- lambda { @bignum.send(@method, "10") }.should raise_error(TypeError)
- lambda { @bignum.send(@method, :symbol) }.should raise_error(TypeError)
+ -> { @bignum.send(@method, mock('10')) }.should raise_error(TypeError)
+ -> { @bignum.send(@method, "10") }.should raise_error(TypeError)
+ -> { @bignum.send(@method, :symbol) }.should raise_error(TypeError)
end
it "switch to a Float when the values is too big" do
diff --git a/spec/ruby/core/integer/shared/modulo.rb b/spec/ruby/core/integer/shared/modulo.rb
index d545a9af55..b06d81e17d 100644
--- a/spec/ruby/core/integer/shared/modulo.rb
+++ b/spec/ruby/core/integer/shared/modulo.rb
@@ -21,24 +21,24 @@ describe :integer_modulo, shared: true do
end
it "raises a ZeroDivisionError when the given argument is 0" do
- lambda { 13.send(@method, 0) }.should raise_error(ZeroDivisionError)
- lambda { 0.send(@method, 0) }.should raise_error(ZeroDivisionError)
- lambda { -10.send(@method, 0) }.should raise_error(ZeroDivisionError)
+ -> { 13.send(@method, 0) }.should raise_error(ZeroDivisionError)
+ -> { 0.send(@method, 0) }.should raise_error(ZeroDivisionError)
+ -> { -10.send(@method, 0) }.should raise_error(ZeroDivisionError)
end
it "raises a ZeroDivisionError when the given argument is 0 and a Float" do
- lambda { 0.send(@method, 0.0) }.should raise_error(ZeroDivisionError)
- lambda { 10.send(@method, 0.0) }.should raise_error(ZeroDivisionError)
- lambda { -10.send(@method, 0.0) }.should raise_error(ZeroDivisionError)
+ -> { 0.send(@method, 0.0) }.should raise_error(ZeroDivisionError)
+ -> { 10.send(@method, 0.0) }.should raise_error(ZeroDivisionError)
+ -> { -10.send(@method, 0.0) }.should raise_error(ZeroDivisionError)
end
it "raises a TypeError when given a non-Integer" do
- lambda {
+ -> {
(obj = mock('10')).should_receive(:to_int).any_number_of_times.and_return(10)
13.send(@method, obj)
}.should raise_error(TypeError)
- lambda { 13.send(@method, "10") }.should raise_error(TypeError)
- lambda { 13.send(@method, :symbol) }.should raise_error(TypeError)
+ -> { 13.send(@method, "10") }.should raise_error(TypeError)
+ -> { 13.send(@method, :symbol) }.should raise_error(TypeError)
end
end
@@ -56,19 +56,19 @@ describe :integer_modulo, shared: true do
end
it "raises a ZeroDivisionError when the given argument is 0" do
- lambda { @bignum.send(@method, 0) }.should raise_error(ZeroDivisionError)
- lambda { (-@bignum).send(@method, 0) }.should raise_error(ZeroDivisionError)
+ -> { @bignum.send(@method, 0) }.should raise_error(ZeroDivisionError)
+ -> { (-@bignum).send(@method, 0) }.should raise_error(ZeroDivisionError)
end
it "raises a ZeroDivisionError when the given argument is 0 and a Float" do
- lambda { @bignum.send(@method, 0.0) }.should raise_error(ZeroDivisionError)
- lambda { -@bignum.send(@method, 0.0) }.should raise_error(ZeroDivisionError)
+ -> { @bignum.send(@method, 0.0) }.should raise_error(ZeroDivisionError)
+ -> { -@bignum.send(@method, 0.0) }.should raise_error(ZeroDivisionError)
end
it "raises a TypeError when given a non-Integer" do
- lambda { @bignum.send(@method, mock('10')) }.should raise_error(TypeError)
- lambda { @bignum.send(@method, "10") }.should raise_error(TypeError)
- lambda { @bignum.send(@method, :symbol) }.should raise_error(TypeError)
+ -> { @bignum.send(@method, mock('10')) }.should raise_error(TypeError)
+ -> { @bignum.send(@method, "10") }.should raise_error(TypeError)
+ -> { @bignum.send(@method, :symbol) }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/core/integer/sqrt_spec.rb b/spec/ruby/core/integer/sqrt_spec.rb
index e40bd12b19..e56da058a0 100644
--- a/spec/ruby/core/integer/sqrt_spec.rb
+++ b/spec/ruby/core/integer/sqrt_spec.rb
@@ -15,7 +15,7 @@ ruby_version_is "2.5" do
end
it "raises a Math::DomainError if the argument is negative" do
- lambda { Integer.sqrt(-4) }.should raise_error(Math::DomainError)
+ -> { Integer.sqrt(-4) }.should raise_error(Math::DomainError)
end
it "accepts any argument that can be coerced to Integer" do
@@ -27,7 +27,7 @@ ruby_version_is "2.5" do
end
it "raises a TypeError if the argument cannot be coerced to Integer" do
- lambda { Integer.sqrt("test") }.should raise_error(TypeError)
+ -> { Integer.sqrt("test") }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/core/integer/to_r_spec.rb b/spec/ruby/core/integer/to_r_spec.rb
index dbb12166f1..4a40575b7f 100644
--- a/spec/ruby/core/integer/to_r_spec.rb
+++ b/spec/ruby/core/integer/to_r_spec.rb
@@ -20,7 +20,7 @@ describe "Integer#to_r" do
end
it "raises an ArgumentError if given any arguments" do
- lambda { 287.to_r(2) }.should raise_error(ArgumentError)
- lambda { 9102826.to_r(309, [], 71) }.should raise_error(ArgumentError)
+ -> { 287.to_r(2) }.should raise_error(ArgumentError)
+ -> { 9102826.to_r(309, [], 71) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/integer/to_s_spec.rb b/spec/ruby/core/integer/to_s_spec.rb
index 687dc9d18f..7988bfde7a 100644
--- a/spec/ruby/core/integer/to_s_spec.rb
+++ b/spec/ruby/core/integer/to_s_spec.rb
@@ -13,10 +13,10 @@ describe "Integer#to_s" do
end
it "raises an ArgumentError if the base is less than 2 or higher than 36" do
- lambda { 123.to_s(-1) }.should raise_error(ArgumentError)
- lambda { 123.to_s(0) }.should raise_error(ArgumentError)
- lambda { 123.to_s(1) }.should raise_error(ArgumentError)
- lambda { 123.to_s(37) }.should raise_error(ArgumentError)
+ -> { 123.to_s(-1) }.should raise_error(ArgumentError)
+ -> { 123.to_s(0) }.should raise_error(ArgumentError)
+ -> { 123.to_s(1) }.should raise_error(ArgumentError)
+ -> { 123.to_s(37) }.should raise_error(ArgumentError)
end
end
@@ -59,10 +59,10 @@ describe "Integer#to_s" do
end
it "raises an ArgumentError if the base is less than 2 or higher than 36" do
- lambda { 123.to_s(-1) }.should raise_error(ArgumentError)
- lambda { 123.to_s(0) }.should raise_error(ArgumentError)
- lambda { 123.to_s(1) }.should raise_error(ArgumentError)
- lambda { 123.to_s(37) }.should raise_error(ArgumentError)
+ -> { 123.to_s(-1) }.should raise_error(ArgumentError)
+ -> { 123.to_s(0) }.should raise_error(ArgumentError)
+ -> { 123.to_s(1) }.should raise_error(ArgumentError)
+ -> { 123.to_s(37) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/integer/upto_spec.rb b/spec/ruby/core/integer/upto_spec.rb
index 7cab834ad4..6049eb173e 100644
--- a/spec/ruby/core/integer/upto_spec.rb
+++ b/spec/ruby/core/integer/upto_spec.rb
@@ -27,8 +27,8 @@ describe "Integer#upto [stop] when self and stop are Fixnums" do
end
it "raises an ArgumentError for non-numeric endpoints" do
- lambda { 1.upto("A") {|x| p x} }.should raise_error(ArgumentError)
- lambda { 1.upto(nil) {|x| p x} }.should raise_error(ArgumentError)
+ -> { 1.upto("A") {|x| p x} }.should raise_error(ArgumentError)
+ -> { 1.upto(nil) {|x| p x} }.should raise_error(ArgumentError)
end
describe "when no block is given" do
@@ -45,9 +45,9 @@ describe "Integer#upto [stop] when self and stop are Fixnums" do
describe "size" do
it "raises an ArgumentError for non-numeric endpoints" do
enum = 1.upto("A")
- lambda { enum.size }.should raise_error(ArgumentError)
+ -> { enum.size }.should raise_error(ArgumentError)
enum = 1.upto(nil)
- lambda { enum.size }.should raise_error(ArgumentError)
+ -> { enum.size }.should raise_error(ArgumentError)
end
it "returns stop - self + 1" do
diff --git a/spec/ruby/core/io/advise_spec.rb b/spec/ruby/core/io/advise_spec.rb
index 81d5a49849..59469fa164 100644
--- a/spec/ruby/core/io/advise_spec.rb
+++ b/spec/ruby/core/io/advise_spec.rb
@@ -12,37 +12,37 @@ describe "IO#advise" do
end
it "raises a TypeError if advise is not a Symbol" do
- lambda {
+ -> {
@io.advise("normal")
}.should raise_error(TypeError)
end
it "raises a TypeError if offset cannot be coerced to an Integer" do
- lambda {
+ -> {
@io.advise(:normal, "wat")
}.should raise_error(TypeError)
end
it "raises a TypeError if len cannot be coerced to an Integer" do
- lambda {
+ -> {
@io.advise(:normal, 0, "wat")
}.should raise_error(TypeError)
end
it "raises a RangeError if offset is too big" do
- lambda {
+ -> {
@io.advise(:normal, 10 ** 32)
}.should raise_error(RangeError)
end
it "raises a RangeError if len is too big" do
- lambda {
+ -> {
@io.advise(:normal, 0, 10 ** 32)
}.should raise_error(RangeError)
end
it "raises a NotImplementedError if advise is not recognized" do
- lambda{
+ ->{
@io.advise(:foo)
}.should raise_error(NotImplementedError)
end
@@ -92,6 +92,6 @@ describe "IO#advise" do
it "raises an IOError if the stream is closed" do
@io.close
- lambda { @io.advise(:normal) }.should raise_error(IOError)
+ -> { @io.advise(:normal) }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/core/io/binmode_spec.rb b/spec/ruby/core/io/binmode_spec.rb
index cc10e297dd..b698777cad 100644
--- a/spec/ruby/core/io/binmode_spec.rb
+++ b/spec/ruby/core/io/binmode_spec.rb
@@ -17,7 +17,7 @@ describe "IO#binmode" do
end
it "raises an IOError on closed stream" do
- lambda { IOSpecs.closed_io.binmode }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.binmode }.should raise_error(IOError)
end
it "sets external encoding to binary" do
diff --git a/spec/ruby/core/io/binread_spec.rb b/spec/ruby/core/io/binread_spec.rb
index 961044da58..a3f752d8f9 100644
--- a/spec/ruby/core/io/binread_spec.rb
+++ b/spec/ruby/core/io/binread_spec.rb
@@ -38,10 +38,10 @@ describe "IO.binread" do
end
it "raises an ArgumentError when not passed a valid length" do
- lambda { IO.binread @fname, -1 }.should raise_error(ArgumentError)
+ -> { IO.binread @fname, -1 }.should raise_error(ArgumentError)
end
it "raises an Errno::EINVAL when not passed a valid offset" do
- lambda { IO.binread @fname, 0, -1 }.should raise_error(Errno::EINVAL)
+ -> { IO.binread @fname, 0, -1 }.should raise_error(Errno::EINVAL)
end
end
diff --git a/spec/ruby/core/io/bytes_spec.rb b/spec/ruby/core/io/bytes_spec.rb
index 2d2bd950f1..feeb493566 100644
--- a/spec/ruby/core/io/bytes_spec.rb
+++ b/spec/ruby/core/io/bytes_spec.rb
@@ -31,13 +31,13 @@ describe "IO#bytes" do
it "raises an IOError on closed stream" do
enum = IOSpecs.closed_io.bytes
- lambda { enum.first }.should raise_error(IOError)
+ -> { enum.first }.should raise_error(IOError)
end
it "raises an IOError on an enumerator for a stream that has been closed" do
enum = @io.bytes
enum.first.should == 86
@io.close
- lambda { enum.first }.should raise_error(IOError)
+ -> { enum.first }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/core/io/close_on_exec_spec.rb b/spec/ruby/core/io/close_on_exec_spec.rb
index d6ba3c3cef..f837bb56af 100644
--- a/spec/ruby/core/io/close_on_exec_spec.rb
+++ b/spec/ruby/core/io/close_on_exec_spec.rb
@@ -42,7 +42,7 @@ describe "IO#close_on_exec=" do
it "raises IOError if called on a closed IO" do
@io.close
- lambda { @io.close_on_exec = true }.should raise_error(IOError)
+ -> { @io.close_on_exec = true }.should raise_error(IOError)
end
it "returns nil" do
@@ -74,7 +74,7 @@ describe "IO#close_on_exec?" do
it "raises IOError if called on a closed IO" do
@io.close
- lambda { @io.close_on_exec? }.should raise_error(IOError)
+ -> { @io.close_on_exec? }.should raise_error(IOError)
end
end
end
diff --git a/spec/ruby/core/io/close_read_spec.rb b/spec/ruby/core/io/close_read_spec.rb
index 9783cb252a..6fa4fc8ff8 100644
--- a/spec/ruby/core/io/close_read_spec.rb
+++ b/spec/ruby/core/io/close_read_spec.rb
@@ -16,7 +16,7 @@ describe "IO#close_read" do
it "closes the read end of a duplex I/O stream" do
@io.close_read
- lambda { @io.read }.should raise_error(IOError)
+ -> { @io.read }.should raise_error(IOError)
end
it "does nothing on subsequent invocations" do
@@ -28,14 +28,14 @@ describe "IO#close_read" do
it "allows subsequent invocation of close" do
@io.close_read
- lambda { @io.close }.should_not raise_error
+ -> { @io.close }.should_not raise_error
end
it "raises an IOError if the stream is writable and not duplexed" do
io = File.open @path, 'w'
begin
- lambda { io.close_read }.should raise_error(IOError)
+ -> { io.close_read }.should raise_error(IOError)
ensure
io.close unless io.closed?
end
diff --git a/spec/ruby/core/io/close_spec.rb b/spec/ruby/core/io/close_spec.rb
index b7aa2276d1..21bba32cd8 100644
--- a/spec/ruby/core/io/close_spec.rb
+++ b/spec/ruby/core/io/close_spec.rb
@@ -23,19 +23,19 @@ describe "IO#close" do
it "raises an IOError reading from a closed IO" do
@io.close
- lambda { @io.read }.should raise_error(IOError)
+ -> { @io.read }.should raise_error(IOError)
end
it "raises an IOError writing to a closed IO" do
@io.close
- lambda { @io.write "data" }.should raise_error(IOError)
+ -> { @io.write "data" }.should raise_error(IOError)
end
it 'does not close the stream if autoclose is false' do
other_io = IO.new(@io.fileno)
other_io.autoclose = false
other_io.close
- lambda { @io.write "data" }.should_not raise_error(IOError)
+ -> { @io.write "data" }.should_not raise_error(IOError)
end
it "does nothing if already closed" do
@@ -49,7 +49,7 @@ describe "IO#close" do
read_io, write_io = IO.pipe
going_to_read = false
thread = Thread.new do
- lambda do
+ -> do
going_to_read = true
read_io.read
end.should raise_error(IOError, 'stream closed in another thread')
@@ -72,7 +72,7 @@ describe "IO#close on an IO.popen stream" do
io.close
- lambda { io.pid }.should raise_error(IOError)
+ -> { io.pid }.should raise_error(IOError)
end
it "sets $?" do
diff --git a/spec/ruby/core/io/close_write_spec.rb b/spec/ruby/core/io/close_write_spec.rb
index 8643659025..75e1577654 100644
--- a/spec/ruby/core/io/close_write_spec.rb
+++ b/spec/ruby/core/io/close_write_spec.rb
@@ -15,7 +15,7 @@ describe "IO#close_write" do
it "closes the write end of a duplex I/O stream" do
@io.close_write
- lambda { @io.write "attempt to write" }.should raise_error(IOError)
+ -> { @io.write "attempt to write" }.should raise_error(IOError)
end
it "does nothing on subsequent invocations" do
@@ -27,14 +27,14 @@ describe "IO#close_write" do
it "allows subsequent invocation of close" do
@io.close_write
- lambda { @io.close }.should_not raise_error
+ -> { @io.close }.should_not raise_error
end
it "raises an IOError if the stream is readable and not duplexed" do
io = File.open @path, 'w+'
begin
- lambda { io.close_write }.should raise_error(IOError)
+ -> { io.close_write }.should raise_error(IOError)
ensure
io.close unless io.closed?
end
diff --git a/spec/ruby/core/io/copy_stream_spec.rb b/spec/ruby/core/io/copy_stream_spec.rb
index 622be0818b..c541e96e14 100644
--- a/spec/ruby/core/io/copy_stream_spec.rb
+++ b/spec/ruby/core/io/copy_stream_spec.rb
@@ -31,7 +31,7 @@ describe :io_copy_stream_to_file, shared: true do
obj = mock("io_copy_stream_to")
obj.should_receive(:to_path).and_return(1)
- lambda { IO.copy_stream(@object.from, obj) }.should raise_error(TypeError)
+ -> { IO.copy_stream(@object.from, obj) }.should raise_error(TypeError)
end
end
@@ -71,7 +71,7 @@ describe :io_copy_stream_to_io, shared: true do
it "raises an IOError if the destination IO is not open for writing" do
@to_io.close
@to_io = new_io @to_name, "r"
- lambda { IO.copy_stream @object.from, @to_io }.should raise_error(IOError)
+ -> { IO.copy_stream @object.from, @to_io }.should raise_error(IOError)
end
it "does not close the destination IO" do
@@ -125,7 +125,7 @@ describe "IO.copy_stream" do
it "raises an IOError if the source IO is not open for reading" do
@from_io.close
@from_io = new_io @from_bigfile, "a"
- lambda { IO.copy_stream @from_io, @to_name }.should raise_error(IOError)
+ -> { IO.copy_stream @from_io, @to_name }.should raise_error(IOError)
end
it "does not close the source IO" do
@@ -183,7 +183,7 @@ describe "IO.copy_stream" do
obj = mock("io_copy_stream_from")
obj.should_receive(:to_path).and_return(1)
- lambda { IO.copy_stream(obj, @to_name) }.should raise_error(TypeError)
+ -> { IO.copy_stream(obj, @to_name) }.should raise_error(TypeError)
end
describe "to a file name" do
@@ -222,7 +222,7 @@ describe "IO.copy_stream" do
platform_is_not :windows do
it "raises an error when an offset is specified" do
- lambda { IO.copy_stream(@from_io, @to_name, 8, 4) }.should raise_error(Errno::ESPIPE)
+ -> { IO.copy_stream(@from_io, @to_name, 8, 4) }.should raise_error(Errno::ESPIPE)
end
end
diff --git a/spec/ruby/core/io/dup_spec.rb b/spec/ruby/core/io/dup_spec.rb
index c88d109ec9..de32c5e347 100644
--- a/spec/ruby/core/io/dup_spec.rb
+++ b/spec/ruby/core/io/dup_spec.rb
@@ -49,7 +49,7 @@ end
it "allows closing the new IO without affecting the original" do
@i.close
- lambda { @f.gets }.should_not raise_error(Exception)
+ -> { @f.gets }.should_not raise_error(Exception)
@i.closed?.should == true
@f.closed?.should == false
@@ -57,14 +57,14 @@ end
it "allows closing the original IO without affecting the new one" do
@f.close
- lambda { @i.gets }.should_not raise_error(Exception)
+ -> { @i.gets }.should_not raise_error(Exception)
@i.closed?.should == false
@f.closed?.should == true
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.dup }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.dup }.should raise_error(IOError)
end
it "always sets the close-on-exec flag for the new IO object" do
diff --git a/spec/ruby/core/io/each_byte_spec.rb b/spec/ruby/core/io/each_byte_spec.rb
index 9cdb1ac0c9..ea618e8c0c 100644
--- a/spec/ruby/core/io/each_byte_spec.rb
+++ b/spec/ruby/core/io/each_byte_spec.rb
@@ -12,7 +12,7 @@ describe "IO#each_byte" do
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.each_byte {} }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.each_byte {} }.should raise_error(IOError)
end
it "yields each byte" do
diff --git a/spec/ruby/core/io/each_codepoint_spec.rb b/spec/ruby/core/io/each_codepoint_spec.rb
index 19824c38e4..cddc6b4662 100644
--- a/spec/ruby/core/io/each_codepoint_spec.rb
+++ b/spec/ruby/core/io/each_codepoint_spec.rb
@@ -38,6 +38,6 @@ describe "IO#each_codepoint" do
end
it "raises an exception at incomplete character before EOF when conversion takes place" do
- lambda { @io.each_codepoint {} }.should raise_error(ArgumentError)
+ -> { @io.each_codepoint {} }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/io/eof_spec.rb b/spec/ruby/core/io/eof_spec.rb
index 3ab389af09..8fd3c37132 100644
--- a/spec/ruby/core/io/eof_spec.rb
+++ b/spec/ruby/core/io/eof_spec.rb
@@ -16,7 +16,7 @@ describe "IO#eof?" do
end
it "raises IOError on stream not opened for reading" do
- lambda do
+ -> do
File.open(@name, "w") { |f| f.eof? }
end.should raise_error(IOError)
end
@@ -67,12 +67,12 @@ describe "IO#eof?" do
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.eof? }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.eof? }.should raise_error(IOError)
end
it "raises IOError on stream closed for reading by close_read" do
@io.close_read
- lambda { @io.eof? }.should raise_error(IOError)
+ -> { @io.eof? }.should raise_error(IOError)
end
it "returns true on one-byte stream after single-byte read" do
diff --git a/spec/ruby/core/io/fcntl_spec.rb b/spec/ruby/core/io/fcntl_spec.rb
index 049f92c0a2..30b4876fe3 100644
--- a/spec/ruby/core/io/fcntl_spec.rb
+++ b/spec/ruby/core/io/fcntl_spec.rb
@@ -3,6 +3,6 @@ require_relative 'fixtures/classes'
describe "IO#fcntl" do
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.fcntl(5, 5) }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.fcntl(5, 5) }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/core/io/fileno_spec.rb b/spec/ruby/core/io/fileno_spec.rb
index d7aff99e72..647609bf42 100644
--- a/spec/ruby/core/io/fileno_spec.rb
+++ b/spec/ruby/core/io/fileno_spec.rb
@@ -7,6 +7,6 @@ describe "IO#fileno" do
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.fileno }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.fileno }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/core/io/flush_spec.rb b/spec/ruby/core/io/flush_spec.rb
index c81ff74a69..34cf42c425 100644
--- a/spec/ruby/core/io/flush_spec.rb
+++ b/spec/ruby/core/io/flush_spec.rb
@@ -3,6 +3,35 @@ require_relative 'fixtures/classes'
describe "IO#flush" do
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.flush }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.flush }.should raise_error(IOError)
+ end
+
+ describe "on a pipe" do
+ before :each do
+ @r, @w = IO.pipe
+ end
+
+ after :each do
+ @r.close
+ begin
+ @w.close
+ rescue Errno::EPIPE
+ end
+ end
+
+ # [ruby-core:90895] MJIT worker may leave fd open in a forked child.
+ # For instance, MJIT creates a worker before @r.close with fork(), @r.close happens,
+ # and the MJIT worker keeps the pipe open until the worker execve().
+ # TODO: consider acquiring GVL from MJIT worker.
+ guard_not -> { defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? } do
+ it "raises Errno::EPIPE if sync=false and the read end is closed" do
+ @w.sync = false
+ @w.write "foo"
+ @r.close
+
+ -> { @w.flush }.should raise_error(Errno::EPIPE, /Broken pipe/)
+ -> { @w.close }.should raise_error(Errno::EPIPE, /Broken pipe/)
+ end
+ end
end
end
diff --git a/spec/ruby/core/io/fsync_spec.rb b/spec/ruby/core/io/fsync_spec.rb
index 0261939631..6e6123de94 100644
--- a/spec/ruby/core/io/fsync_spec.rb
+++ b/spec/ruby/core/io/fsync_spec.rb
@@ -12,7 +12,7 @@ describe "IO#fsync" do
end
it "raises an IOError on closed stream" do
- lambda { IOSpecs.closed_io.fsync }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.fsync }.should raise_error(IOError)
end
it "writes the buffered data to permanent storage" do
diff --git a/spec/ruby/core/io/getbyte_spec.rb b/spec/ruby/core/io/getbyte_spec.rb
index 6b665029d6..6ba8f0a3e0 100644
--- a/spec/ruby/core/io/getbyte_spec.rb
+++ b/spec/ruby/core/io/getbyte_spec.rb
@@ -23,7 +23,7 @@ describe "IO#getbyte" do
end
it "raises an IOError on closed stream" do
- lambda { IOSpecs.closed_io.getbyte }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.getbyte }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/core/io/getc_spec.rb b/spec/ruby/core/io/getc_spec.rb
index 7c1c18cd90..3949b5cb28 100644
--- a/spec/ruby/core/io/getc_spec.rb
+++ b/spec/ruby/core/io/getc_spec.rb
@@ -23,7 +23,7 @@ describe "IO#getc" do
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.getc }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.getc }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/core/io/gets_spec.rb b/spec/ruby/core/io/gets_spec.rb
index 371c1c3d3b..8f6ec0dfc7 100644
--- a/spec/ruby/core/io/gets_spec.rb
+++ b/spec/ruby/core/io/gets_spec.rb
@@ -30,7 +30,7 @@ describe "IO#gets" do
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.gets }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.gets }.should raise_error(IOError)
end
describe "with no separator" do
@@ -156,11 +156,11 @@ describe "IO#gets" do
end
it "raises an IOError if the stream is opened for append only" do
- lambda { File.open(@name, "a:utf-8") { |f| f.gets } }.should raise_error(IOError)
+ -> { File.open(@name, "a:utf-8") { |f| f.gets } }.should raise_error(IOError)
end
it "raises an IOError if the stream is opened for writing only" do
- lambda { File.open(@name, "w:utf-8") { |f| f.gets } }.should raise_error(IOError)
+ -> { File.open(@name, "w:utf-8") { |f| f.gets } }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/core/io/initialize_spec.rb b/spec/ruby/core/io/initialize_spec.rb
index 4858e0360c..c8f3faf110 100644
--- a/spec/ruby/core/io/initialize_spec.rb
+++ b/spec/ruby/core/io/initialize_spec.rb
@@ -28,22 +28,22 @@ describe "IO#initialize" do
end
it "raises a TypeError when passed an IO" do
- lambda { @io.send :initialize, STDOUT, 'w' }.should raise_error(TypeError)
+ -> { @io.send :initialize, STDOUT, 'w' }.should raise_error(TypeError)
end
it "raises a TypeError when passed nil" do
- lambda { @io.send :initialize, nil, 'w' }.should raise_error(TypeError)
+ -> { @io.send :initialize, nil, 'w' }.should raise_error(TypeError)
end
it "raises a TypeError when passed a String" do
- lambda { @io.send :initialize, "4", 'w' }.should raise_error(TypeError)
+ -> { @io.send :initialize, "4", 'w' }.should raise_error(TypeError)
end
it "raises IOError on closed stream" do
- lambda { @io.send :initialize, IOSpecs.closed_io.fileno }.should raise_error(IOError)
+ -> { @io.send :initialize, IOSpecs.closed_io.fileno }.should raise_error(IOError)
end
it "raises an Errno::EBADF when given an invalid file descriptor" do
- lambda { @io.send :initialize, -1, 'w' }.should raise_error(Errno::EBADF)
+ -> { @io.send :initialize, -1, 'w' }.should raise_error(Errno::EBADF)
end
end
diff --git a/spec/ruby/core/io/ioctl_spec.rb b/spec/ruby/core/io/ioctl_spec.rb
index 0f2b67ac44..e819a217a8 100644
--- a/spec/ruby/core/io/ioctl_spec.rb
+++ b/spec/ruby/core/io/ioctl_spec.rb
@@ -4,7 +4,7 @@ require_relative 'fixtures/classes'
describe "IO#ioctl" do
platform_is_not :windows do
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.ioctl(5, 5) }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.ioctl(5, 5) }.should raise_error(IOError)
end
end
@@ -22,7 +22,7 @@ describe "IO#ioctl" do
it "raises an Errno error when ioctl fails" do
File.open(__FILE__, 'r') do |f|
- lambda {
+ -> {
# TIOCGWINSZ in /usr/include/asm-generic/ioctls.h
f.ioctl 0x5413, nil
}.should raise_error(Errno::ENOTTY)
diff --git a/spec/ruby/core/io/lineno_spec.rb b/spec/ruby/core/io/lineno_spec.rb
index 322e60d643..3d1b2275cc 100644
--- a/spec/ruby/core/io/lineno_spec.rb
+++ b/spec/ruby/core/io/lineno_spec.rb
@@ -11,7 +11,7 @@ describe "IO#lineno" do
end
it "raises an IOError on a closed stream" do
- lambda { IOSpecs.closed_io.lineno }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.lineno }.should raise_error(IOError)
end
it "returns the current line number" do
@@ -37,7 +37,7 @@ describe "IO#lineno=" do
end
it "raises an IOError on a closed stream" do
- lambda { IOSpecs.closed_io.lineno = 5 }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.lineno = 5 }.should raise_error(IOError)
end
it "calls #to_int on a non-numeric argument" do
@@ -57,7 +57,7 @@ describe "IO#lineno=" do
end
it "raises TypeError on nil argument" do
- lambda { @io.lineno = nil }.should raise_error(TypeError)
+ -> { @io.lineno = nil }.should raise_error(TypeError)
end
it "sets the current line number to the given value" do
diff --git a/spec/ruby/core/io/open_spec.rb b/spec/ruby/core/io/open_spec.rb
index f26753cde7..94df5a5ef6 100644
--- a/spec/ruby/core/io/open_spec.rb
+++ b/spec/ruby/core/io/open_spec.rb
@@ -38,7 +38,7 @@ describe "IO.open" do
end
it "propagates an exception raised by #close that is not a StandardError" do
- lambda do
+ -> do
IO.open(@fd, "w") do |io|
IOSpecs.io_mock(io, :close) do
super()
@@ -51,7 +51,7 @@ describe "IO.open" do
end
it "propagates an exception raised by #close that is a StandardError" do
- lambda do
+ -> do
IO.open(@fd, "w") do |io|
IOSpecs.io_mock(io, :close) do
super()
diff --git a/spec/ruby/core/io/output_spec.rb b/spec/ruby/core/io/output_spec.rb
index d3ec71c563..2aafb305f4 100644
--- a/spec/ruby/core/io/output_spec.rb
+++ b/spec/ruby/core/io/output_spec.rb
@@ -3,24 +3,24 @@ require_relative 'fixtures/classes'
describe "IO#<<" do
it "writes an object to the IO stream" do
- lambda {
+ -> {
$stderr << "Oh noes, an error!"
}.should output_to_fd("Oh noes, an error!", $stderr)
end
it "calls #to_s on the object to print it" do
- lambda {
+ -> {
$stderr << 1337
}.should output_to_fd("1337", $stderr)
end
it "raises an error if the stream is closed" do
io = IOSpecs.closed_io
- lambda { io << "test" }.should raise_error(IOError)
+ -> { io << "test" }.should raise_error(IOError)
end
it "returns self" do
- lambda {
+ -> {
($stderr << "to_stderr").should == $stderr
}.should output(nil, "to_stderr")
end
diff --git a/spec/ruby/core/io/pid_spec.rb b/spec/ruby/core/io/pid_spec.rb
index 97b8a8529d..bc09fe7c3b 100644
--- a/spec/ruby/core/io/pid_spec.rb
+++ b/spec/ruby/core/io/pid_spec.rb
@@ -30,6 +30,6 @@ describe "IO#pid" do
it "raises an IOError on closed stream" do
@io.close
- lambda { @io.pid }.should raise_error(IOError)
+ -> { @io.pid }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/core/io/pipe_spec.rb b/spec/ruby/core/io/pipe_spec.rb
index 005f60fab6..5b2f18d836 100644
--- a/spec/ruby/core/io/pipe_spec.rb
+++ b/spec/ruby/core/io/pipe_spec.rb
@@ -50,7 +50,7 @@ describe "IO.pipe" do
it "closes both IO objects when the block raises" do
r = w = nil
- lambda do
+ -> do
IO.pipe do |_r, _w|
r = _r
w = _w
diff --git a/spec/ruby/core/io/popen_spec.rb b/spec/ruby/core/io/popen_spec.rb
index 289bb076e4..622b3a9394 100644
--- a/spec/ruby/core/io/popen_spec.rb
+++ b/spec/ruby/core/io/popen_spec.rb
@@ -22,7 +22,7 @@ describe "IO.popen" do
it "raises IOError when writing a read-only pipe" do
@io = IO.popen(ruby_cmd('puts "foo"'), "r")
- lambda { @io.write('bar') }.should raise_error(IOError)
+ -> { @io.write('bar') }.should raise_error(IOError)
@io.read.should == "foo\n"
end
end
@@ -55,7 +55,7 @@ describe "IO.popen" do
it "raises IOError when reading a write-only pipe" do
@io = IO.popen(ruby_cmd('IO.copy_stream(STDIN,STDOUT)'), "w")
- lambda { @io.read }.should raise_error(IOError)
+ -> { @io.read }.should raise_error(IOError)
end
it "reads and writes a read/write pipe" do
diff --git a/spec/ruby/core/io/pread_spec.rb b/spec/ruby/core/io/pread_spec.rb
index b5b516fa53..bfe6472fef 100644
--- a/spec/ruby/core/io/pread_spec.rb
+++ b/spec/ruby/core/io/pread_spec.rb
@@ -33,19 +33,19 @@ ruby_version_is "2.5" do
end
it "raises EOFError if end-of-file is reached" do
- lambda { @file.pread(1, 10) }.should raise_error(EOFError)
+ -> { @file.pread(1, 10) }.should raise_error(EOFError)
end
it "raises IOError when file is not open in read mode" do
File.open(@fname, "w") do |file|
- lambda { file.pread(1, 1) }.should raise_error(IOError)
+ -> { file.pread(1, 1) }.should raise_error(IOError)
end
end
it "raises IOError when file is closed" do
file = File.open(@fname, "r+")
file.close
- lambda { file.pread(1, 1) }.should raise_error(IOError)
+ -> { file.pread(1, 1) }.should raise_error(IOError)
end
end
end
diff --git a/spec/ruby/core/io/print_spec.rb b/spec/ruby/core/io/print_spec.rb
index 0dd48344ce..2021cd5420 100644
--- a/spec/ruby/core/io/print_spec.rb
+++ b/spec/ruby/core/io/print_spec.rb
@@ -48,6 +48,6 @@ describe IO, "#print" do
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.print("stuff") }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.print("stuff") }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/core/io/printf_spec.rb b/spec/ruby/core/io/printf_spec.rb
index be4e5c339e..baa00f14ce 100644
--- a/spec/ruby/core/io/printf_spec.rb
+++ b/spec/ruby/core/io/printf_spec.rb
@@ -27,6 +27,6 @@ describe "IO#printf" do
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.printf("stuff") }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.printf("stuff") }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/core/io/puts_spec.rb b/spec/ruby/core/io/puts_spec.rb
index e8d599730f..3e4b877b7f 100644
--- a/spec/ruby/core/io/puts_spec.rb
+++ b/spec/ruby/core/io/puts_spec.rb
@@ -25,7 +25,7 @@ describe "IO#puts" do
end
it "writes just a newline when given just a newline" do
- lambda { $stdout.puts "\n" }.should output_to_fd("\n", STDOUT)
+ -> { $stdout.puts "\n" }.should output_to_fd("\n", STDOUT)
end
it "writes empty string with a newline when given nil as an arg" do
@@ -111,7 +111,7 @@ describe "IO#puts" do
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.puts("stuff") }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.puts("stuff") }.should raise_error(IOError)
end
it "writes crlf when IO is opened with newline: :crlf" do
diff --git a/spec/ruby/core/io/pwrite_spec.rb b/spec/ruby/core/io/pwrite_spec.rb
index fd3d1b98e9..929ed08698 100644
--- a/spec/ruby/core/io/pwrite_spec.rb
+++ b/spec/ruby/core/io/pwrite_spec.rb
@@ -31,14 +31,14 @@ ruby_version_is "2.5" do
it "raises IOError when file is not open in write mode" do
File.open(@fname, "r") do |file|
- lambda { file.pwrite("foo", 1) }.should raise_error(IOError)
+ -> { file.pwrite("foo", 1) }.should raise_error(IOError)
end
end
it "raises IOError when file is closed" do
file = File.open(@fname, "w+")
file.close
- lambda { file.pwrite("foo", 1) }.should raise_error(IOError)
+ -> { file.pwrite("foo", 1) }.should raise_error(IOError)
end
end
end
diff --git a/spec/ruby/core/io/read_nonblock_spec.rb b/spec/ruby/core/io/read_nonblock_spec.rb
index 59f5064922..63ccab5a44 100644
--- a/spec/ruby/core/io/read_nonblock_spec.rb
+++ b/spec/ruby/core/io/read_nonblock_spec.rb
@@ -12,7 +12,7 @@ describe "IO#read_nonblock" do
end
it "raises an exception extending IO::WaitReadable when there is no data" do
- lambda { @read.read_nonblock(5) }.should raise_error(IO::WaitReadable) { |e|
+ -> { @read.read_nonblock(5) }.should raise_error(IO::WaitReadable) { |e|
platform_is_not :windows do
e.should be_kind_of(Errno::EAGAIN)
end
@@ -85,7 +85,7 @@ describe "IO#read_nonblock" do
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.read_nonblock(5) }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.read_nonblock(5) }.should raise_error(IOError)
end
it "raises EOFError when the end is reached" do
@@ -94,6 +94,6 @@ describe "IO#read_nonblock" do
@read.read_nonblock(5)
- lambda { @read.read_nonblock(5) }.should raise_error(EOFError)
+ -> { @read.read_nonblock(5) }.should raise_error(EOFError)
end
end
diff --git a/spec/ruby/core/io/read_spec.rb b/spec/ruby/core/io/read_spec.rb
index e005e14fdf..267d840cd3 100644
--- a/spec/ruby/core/io/read_spec.rb
+++ b/spec/ruby/core/io/read_spec.rb
@@ -36,11 +36,11 @@ describe "IO.read" do
end
it "raises an IOError if the options Hash specifies write mode" do
- lambda { IO.read(@fname, 3, 0, {mode: "w"}) }.should raise_error(IOError)
+ -> { IO.read(@fname, 3, 0, {mode: "w"}) }.should raise_error(IOError)
end
it "raises an IOError if the options Hash specifies append only mode" do
- lambda { IO.read(@fname, {mode: "a"}) }.should raise_error(IOError)
+ -> { IO.read(@fname, {mode: "a"}) }.should raise_error(IOError)
end
it "reads the file if the options Hash includes read mode" do
@@ -79,20 +79,20 @@ describe "IO.read" do
it "raises an Errno::ENOENT when the requested file does not exist" do
rm_r @fname
- lambda { IO.read @fname }.should raise_error(Errno::ENOENT)
+ -> { IO.read @fname }.should raise_error(Errno::ENOENT)
end
it "raises a TypeError when not passed a String type" do
- lambda { IO.read nil }.should raise_error(TypeError)
+ -> { IO.read nil }.should raise_error(TypeError)
end
it "raises an ArgumentError when not passed a valid length" do
- lambda { IO.read @fname, -1 }.should raise_error(ArgumentError)
+ -> { IO.read @fname, -1 }.should raise_error(ArgumentError)
end
it "raises an Errno::EINVAL when not passed a valid offset" do
- lambda { IO.read @fname, 0, -1 }.should raise_error(Errno::EINVAL)
- lambda { IO.read @fname, -1, -1 }.should raise_error(Errno::EINVAL)
+ -> { IO.read @fname, 0, -1 }.should raise_error(Errno::EINVAL)
+ -> { IO.read @fname, -1, -1 }.should raise_error(Errno::EINVAL)
end
it "uses the external encoding specified via the :external_encoding option" do
@@ -137,7 +137,7 @@ describe "IO.read from a pipe" do
platform_is_not :windows do
it "raises Errno::ESPIPE if passed an offset" do
- lambda {
+ -> {
IO.read("|sh -c 'echo hello'", 1, 1)
}.should raise_error(Errno::ESPIPE)
end
@@ -148,7 +148,7 @@ quarantine! do # The process tried to write to a nonexistent pipe.
# TODO: It should raise Errno::ESPIPE on Windows as well
# once https://bugs.ruby-lang.org/issues/12230 is fixed.
it "raises Errno::EINVAL if passed an offset" do
- lambda {
+ -> {
IO.read("|cmd.exe /C echo hello", 1, 1)
}.should raise_error(Errno::EINVAL)
end
@@ -301,7 +301,7 @@ describe "IO#read" do
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.read }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.read }.should raise_error(IOError)
end
diff --git a/spec/ruby/core/io/readbyte_spec.rb b/spec/ruby/core/io/readbyte_spec.rb
index eb25975f58..14426c28ac 100644
--- a/spec/ruby/core/io/readbyte_spec.rb
+++ b/spec/ruby/core/io/readbyte_spec.rb
@@ -17,7 +17,7 @@ describe "IO#readbyte" do
it "raises EOFError on EOF" do
@io.seek(999999)
- lambda do
+ -> do
@io.readbyte
end.should raise_error EOFError
end
diff --git a/spec/ruby/core/io/readchar_spec.rb b/spec/ruby/core/io/readchar_spec.rb
index 74f78b5a6e..b5f762a846 100644
--- a/spec/ruby/core/io/readchar_spec.rb
+++ b/spec/ruby/core/io/readchar_spec.rb
@@ -21,11 +21,11 @@ describe "IO#readchar" do
it "raises an EOFError when invoked at the end of the stream" do
@io.read
- lambda { @io.readchar }.should raise_error(EOFError)
+ -> { @io.readchar }.should raise_error(EOFError)
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.readchar }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.readchar }.should raise_error(IOError)
end
end
@@ -39,6 +39,6 @@ describe "IO#readchar" do
end
it "raises EOFError on empty stream" do
- lambda { @io.readchar }.should raise_error(EOFError)
+ -> { @io.readchar }.should raise_error(EOFError)
end
end
diff --git a/spec/ruby/core/io/readline_spec.rb b/spec/ruby/core/io/readline_spec.rb
index 3eae6bfa47..7cb1601816 100644
--- a/spec/ruby/core/io/readline_spec.rb
+++ b/spec/ruby/core/io/readline_spec.rb
@@ -29,11 +29,11 @@ describe "IO#readline" do
it "raises EOFError on end of stream" do
IOSpecs.lines.length.times { @io.readline }
- lambda { @io.readline }.should raise_error(EOFError)
+ -> { @io.readline }.should raise_error(EOFError)
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.readline }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.readline }.should raise_error(IOError)
end
it "assigns the returned line to $_" do
diff --git a/spec/ruby/core/io/readlines_spec.rb b/spec/ruby/core/io/readlines_spec.rb
index 5a7e9b5aa8..0d4f002972 100644
--- a/spec/ruby/core/io/readlines_spec.rb
+++ b/spec/ruby/core/io/readlines_spec.rb
@@ -17,7 +17,7 @@ describe "IO#readlines" do
it "raises an IOError if the stream is closed" do
@io.close
- lambda { @io.readlines }.should raise_error(IOError)
+ -> { @io.readlines }.should raise_error(IOError)
end
describe "when passed no arguments" do
@@ -138,13 +138,13 @@ describe "IO#readlines" do
end
it "raises an IOError if the stream is opened for append only" do
- lambda do
+ -> do
File.open(@name, "a:utf-8") { |f| f.readlines }
end.should raise_error(IOError)
end
it "raises an IOError if the stream is opened for write only" do
- lambda do
+ -> do
File.open(@name, "w:utf-8") { |f| f.readlines }
end.should raise_error(IOError)
end
diff --git a/spec/ruby/core/io/readpartial_spec.rb b/spec/ruby/core/io/readpartial_spec.rb
index 1ab01dcf49..2b33a0d5b1 100644
--- a/spec/ruby/core/io/readpartial_spec.rb
+++ b/spec/ruby/core/io/readpartial_spec.rb
@@ -15,10 +15,10 @@ describe "IO#readpartial" do
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.readpartial(10) }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.readpartial(10) }.should raise_error(IOError)
@rd.close
- lambda { @rd.readpartial(10) }.should raise_error(IOError)
+ -> { @rd.readpartial(10) }.should raise_error(IOError)
end
it "reads at most the specified number of bytes" do
@@ -70,23 +70,23 @@ describe "IO#readpartial" do
@wr.write("abc")
@wr.close
@rd.readpartial(10).should == 'abc'
- lambda { @rd.readpartial(10) }.should raise_error(EOFError)
+ -> { @rd.readpartial(10) }.should raise_error(EOFError)
end
it "discards the existing buffer content upon error" do
buffer = 'hello'
@wr.close
- lambda { @rd.readpartial(1, buffer) }.should raise_error(EOFError)
+ -> { @rd.readpartial(1, buffer) }.should raise_error(EOFError)
buffer.should be_empty
end
it "raises IOError if the stream is closed" do
@wr.close
- lambda { @rd.readpartial(1) }.should raise_error(IOError)
+ -> { @rd.readpartial(1) }.should raise_error(IOError)
end
it "raises ArgumentError if the negative argument is provided" do
- lambda { @rd.readpartial(-1) }.should raise_error(ArgumentError)
+ -> { @rd.readpartial(-1) }.should raise_error(ArgumentError)
end
it "immediately returns an empty string if the length argument is 0" do
diff --git a/spec/ruby/core/io/reopen_spec.rb b/spec/ruby/core/io/reopen_spec.rb
index 84c23472b7..133ff03ea5 100644
--- a/spec/ruby/core/io/reopen_spec.rb
+++ b/spec/ruby/core/io/reopen_spec.rb
@@ -33,29 +33,29 @@ describe "IO#reopen" do
it "raises an IOError if the object returned by #to_io is closed" do
obj = mock("io")
obj.should_receive(:to_io).and_return(IOSpecs.closed_io)
- lambda { @io.reopen obj }.should raise_error(IOError)
+ -> { @io.reopen obj }.should raise_error(IOError)
end
it "raises a TypeError if #to_io does not return an IO instance" do
obj = mock("io")
obj.should_receive(:to_io).and_return("something else")
- lambda { @io.reopen obj }.should raise_error(TypeError)
+ -> { @io.reopen obj }.should raise_error(TypeError)
end
it "raises an IOError when called on a closed stream with an object" do
@io.close
obj = mock("io")
obj.should_not_receive(:to_io)
- lambda { @io.reopen(STDOUT) }.should raise_error(IOError)
+ -> { @io.reopen(STDOUT) }.should raise_error(IOError)
end
it "raises an IOError if the IO argument is closed" do
- lambda { @io.reopen(IOSpecs.closed_io) }.should raise_error(IOError)
+ -> { @io.reopen(IOSpecs.closed_io) }.should raise_error(IOError)
end
it "raises an IOError when called on a closed stream with an IO" do
@io.close
- lambda { @io.reopen(STDOUT) }.should raise_error(IOError)
+ -> { @io.reopen(STDOUT) }.should raise_error(IOError)
end
end
@@ -188,7 +188,7 @@ describe "IO#reopen with a String" do
it "raises an Errno::ENOENT if the file does not exist and the IO is not opened in write mode" do
@io = new_io @name, "r"
- lambda { @io.reopen(@other_name) }.should raise_error(Errno::ENOENT)
+ -> { @io.reopen(@other_name) }.should raise_error(Errno::ENOENT)
end
end
diff --git a/spec/ruby/core/io/rewind_spec.rb b/spec/ruby/core/io/rewind_spec.rb
index d1ec7a69c7..954d56d30c 100644
--- a/spec/ruby/core/io/rewind_spec.rb
+++ b/spec/ruby/core/io/rewind_spec.rb
@@ -33,6 +33,6 @@ describe "IO#rewind" do
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.rewind }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.rewind }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/core/io/seek_spec.rb b/spec/ruby/core/io/seek_spec.rb
index 9978d7c0e7..7e9c308272 100644
--- a/spec/ruby/core/io/seek_spec.rb
+++ b/spec/ruby/core/io/seek_spec.rb
@@ -17,7 +17,7 @@ describe "IO#seek" do
end
it "moves the read position relative to the current position with SEEK_CUR" do
- lambda { @io.seek(-1) }.should raise_error(Errno::EINVAL)
+ -> { @io.seek(-1) }.should raise_error(Errno::EINVAL)
@io.seek(10, IO::SEEK_CUR)
@io.readline.should == "igne une.\n"
@io.seek(-5, IO::SEEK_CUR)
diff --git a/spec/ruby/core/io/select_spec.rb b/spec/ruby/core/io/select_spec.rb
index e69669efd2..4603c1fbbc 100644
--- a/spec/ruby/core/io/select_spec.rb
+++ b/spec/ruby/core/io/select_spec.rb
@@ -80,28 +80,28 @@ describe "IO.select" do
end
it "raises TypeError if supplied objects are not IO" do
- lambda { IO.select([Object.new]) }.should raise_error(TypeError)
- lambda { IO.select(nil, [Object.new]) }.should raise_error(TypeError)
+ -> { IO.select([Object.new]) }.should raise_error(TypeError)
+ -> { IO.select(nil, [Object.new]) }.should raise_error(TypeError)
obj = mock("io")
obj.should_receive(:to_io).any_number_of_times.and_return(nil)
- lambda { IO.select([obj]) }.should raise_error(TypeError)
- lambda { IO.select(nil, [obj]) }.should raise_error(TypeError)
+ -> { IO.select([obj]) }.should raise_error(TypeError)
+ -> { IO.select(nil, [obj]) }.should raise_error(TypeError)
end
it "raises a TypeError if the specified timeout value is not Numeric" do
- lambda { IO.select([@rd], nil, nil, Object.new) }.should raise_error(TypeError)
+ -> { IO.select([@rd], nil, nil, Object.new) }.should raise_error(TypeError)
end
it "raises TypeError if the first three arguments are not Arrays" do
- lambda { IO.select(Object.new)}.should raise_error(TypeError)
- lambda { IO.select(nil, Object.new)}.should raise_error(TypeError)
- lambda { IO.select(nil, nil, Object.new)}.should raise_error(TypeError)
+ -> { IO.select(Object.new)}.should raise_error(TypeError)
+ -> { IO.select(nil, Object.new)}.should raise_error(TypeError)
+ -> { IO.select(nil, nil, Object.new)}.should raise_error(TypeError)
end
it "raises an ArgumentError when passed a negative timeout" do
- lambda { IO.select(nil, nil, nil, -5)}.should raise_error(ArgumentError)
+ -> { IO.select(nil, nil, nil, -5)}.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/io/shared/binwrite.rb b/spec/ruby/core/io/shared/binwrite.rb
index 1a88442a3b..17682a1a93 100644
--- a/spec/ruby/core/io/shared/binwrite.rb
+++ b/spec/ruby/core/io/shared/binwrite.rb
@@ -68,7 +68,7 @@ describe :io_binwrite, shared: true do
end
it "raises an error if readonly mode is specified" do
- lambda { IO.send(@method, @filename, "abcde", mode: "r") }.should raise_error(IOError)
+ -> { IO.send(@method, @filename, "abcde", mode: "r") }.should raise_error(IOError)
end
it "truncates if empty :opts provided and offset skipped" do
diff --git a/spec/ruby/core/io/shared/chars.rb b/spec/ruby/core/io/shared/chars.rb
index 7f2edd2b6d..266566f221 100644
--- a/spec/ruby/core/io/shared/chars.rb
+++ b/spec/ruby/core/io/shared/chars.rb
@@ -46,11 +46,11 @@ describe :io_chars, shared: true do
end
it "raises an IOError when an enumerator created on a closed stream is accessed" do
- lambda { IOSpecs.closed_io.send(@method).first }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.send(@method).first }.should raise_error(IOError)
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.send(@method) {} }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.send(@method) {} }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/core/io/shared/codepoints.rb b/spec/ruby/core/io/shared/codepoints.rb
index a5062e7f79..6872846c1a 100644
--- a/spec/ruby/core/io/shared/codepoints.rb
+++ b/spec/ruby/core/io/shared/codepoints.rb
@@ -39,7 +39,7 @@ describe :io_codepoints, shared: true do
it "raises an error if reading invalid sequence" do
@io.pos = 60 # inside of a multibyte sequence
- lambda { @enum.first }.should raise_error(ArgumentError)
+ -> { @enum.first }.should raise_error(ArgumentError)
end
it "does not change $_" do
@@ -49,6 +49,6 @@ describe :io_codepoints, shared: true do
end
it "raises an IOError when self is not readable" do
- lambda { IOSpecs.closed_io.send(@method).to_a }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.send(@method).to_a }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/core/io/shared/each.rb b/spec/ruby/core/io/shared/each.rb
index da562e03b1..0b2dfa3548 100644
--- a/spec/ruby/core/io/shared/each.rb
+++ b/spec/ruby/core/io/shared/each.rb
@@ -38,7 +38,7 @@ describe :io_each, shared: true do
end
it "raises an IOError when self is not readable" do
- lambda { IOSpecs.closed_io.send(@method) {} }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.send(@method) {} }.should raise_error(IOError)
end
it "makes line count accessible via lineno" do
@@ -74,7 +74,7 @@ describe :io_each, shared: true do
describe "when limit is 0" do
it "raises an ArgumentError" do
# must pass block so Enumerator is evaluated and raises
- lambda { @io.send(@method, 0){} }.should raise_error(ArgumentError)
+ -> { @io.send(@method, 0){} }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/core/io/shared/new.rb b/spec/ruby/core/io/shared/new.rb
index f6069a4cdc..2101958170 100644
--- a/spec/ruby/core/io/shared/new.rb
+++ b/spec/ruby/core/io/shared/new.rb
@@ -115,14 +115,14 @@ describe :io_new, shared: true do
end
it "ignores the :encoding option when the :external_encoding option is present" do
- lambda {
+ -> {
@io = IO.send(@method, @fd, 'w', {external_encoding: 'utf-8', encoding: 'iso-8859-1:iso-8859-1'})
}.should complain(/Ignoring encoding parameter/)
@io.external_encoding.to_s.should == 'UTF-8'
end
it "ignores the :encoding option when the :internal_encoding option is present" do
- lambda {
+ -> {
@io = IO.send(@method, @fd, 'w', {internal_encoding: 'ibm866', encoding: 'iso-8859-1:iso-8859-1'})
}.should complain(/Ignoring encoding parameter/)
@io.internal_encoding.to_s.should == 'IBM866'
@@ -282,96 +282,96 @@ describe :io_new_errors, shared: true do
end
it "raises an Errno::EBADF if the file descriptor is not valid" do
- lambda { IO.send(@method, -1, "w") }.should raise_error(Errno::EBADF)
+ -> { IO.send(@method, -1, "w") }.should raise_error(Errno::EBADF)
end
it "raises an IOError if passed a closed stream" do
- lambda { IO.send(@method, IOSpecs.closed_io.fileno, 'w') }.should raise_error(IOError)
+ -> { IO.send(@method, IOSpecs.closed_io.fileno, 'w') }.should raise_error(IOError)
end
platform_is_not :windows do
it "raises an Errno::EINVAL if the new mode is not compatible with the descriptor's current mode" do
- lambda { IO.send(@method, @fd, "r") }.should raise_error(Errno::EINVAL)
+ -> { IO.send(@method, @fd, "r") }.should raise_error(Errno::EINVAL)
end
end
it "raises ArgumentError if passed an empty mode string" do
- lambda { IO.send(@method, @fd, "") }.should raise_error(ArgumentError)
+ -> { IO.send(@method, @fd, "") }.should raise_error(ArgumentError)
end
it "raises an error if passed modes two ways" do
- lambda {
+ -> {
IO.send(@method, @fd, "w", mode: "w")
}.should raise_error(ArgumentError)
end
it "raises an error if passed encodings two ways" do
- lambda {
+ -> {
@io = IO.send(@method, @fd, 'w:ISO-8859-1', {encoding: 'ISO-8859-1'})
}.should raise_error(ArgumentError)
- lambda {
+ -> {
@io = IO.send(@method, @fd, 'w:ISO-8859-1', {external_encoding: 'ISO-8859-1'})
}.should raise_error(ArgumentError)
- lambda {
+ -> {
@io = IO.send(@method, @fd, 'w:ISO-8859-1:UTF-8', {internal_encoding: 'ISO-8859-1'})
}.should raise_error(ArgumentError)
end
it "raises an error if passed matching binary/text mode two ways" do
- lambda {
+ -> {
@io = IO.send(@method, @fd, "wb", binmode: true)
}.should raise_error(ArgumentError)
- lambda {
+ -> {
@io = IO.send(@method, @fd, "wt", textmode: true)
}.should raise_error(ArgumentError)
- lambda {
+ -> {
@io = IO.send(@method, @fd, "wb", textmode: false)
}.should raise_error(ArgumentError)
- lambda {
+ -> {
@io = IO.send(@method, @fd, "wt", binmode: false)
}.should raise_error(ArgumentError)
end
it "raises an error if passed conflicting binary/text mode two ways" do
- lambda {
+ -> {
@io = IO.send(@method, @fd, "wb", binmode: false)
}.should raise_error(ArgumentError)
- lambda {
+ -> {
@io = IO.send(@method, @fd, "wt", textmode: false)
}.should raise_error(ArgumentError)
- lambda {
+ -> {
@io = IO.send(@method, @fd, "wb", textmode: true)
}.should raise_error(ArgumentError)
- lambda {
+ -> {
@io = IO.send(@method, @fd, "wt", binmode: true)
}.should raise_error(ArgumentError)
end
it "raises an error when trying to set both binmode and textmode" do
- lambda {
+ -> {
@io = IO.send(@method, @fd, "w", textmode: true, binmode: true)
}.should raise_error(ArgumentError)
- lambda {
+ -> {
@io = IO.send(@method, @fd, File::Constants::WRONLY, textmode: true, binmode: true)
}.should raise_error(ArgumentError)
end
it "raises ArgumentError if not passed a hash or nil for options" do
- lambda {
+ -> {
@io = IO.send(@method, @fd, 'w', false)
}.should raise_error(ArgumentError)
- lambda {
+ -> {
@io = IO.send(@method, @fd, false, false)
}.should raise_error(ArgumentError)
- lambda {
+ -> {
@io = IO.send(@method, @fd, nil, false)
}.should raise_error(ArgumentError)
end
it "raises TypeError if passed a hash for mode and nil for options" do
- lambda {
+ -> {
@io = IO.send(@method, @fd, {mode: 'w'}, nil)
}.should raise_error(TypeError)
end
diff --git a/spec/ruby/core/io/shared/pos.rb b/spec/ruby/core/io/shared/pos.rb
index fef7ab2bf7..fb6d8087bc 100644
--- a/spec/ruby/core/io/shared/pos.rb
+++ b/spec/ruby/core/io/shared/pos.rb
@@ -19,7 +19,7 @@ describe :io_pos, shared: true do
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.send(@method) }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.send(@method) }.should raise_error(IOError)
end
it "resets #eof?" do
@@ -62,11 +62,11 @@ describe :io_set_pos, shared: true do
it "does not accept Bignums that don't fit in a C long" do
File.open @fname do |io|
- lambda { io.send @method, 2**128 }.should raise_error(RangeError)
+ -> { io.send @method, 2**128 }.should raise_error(RangeError)
end
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.send @method, 0 }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.send @method, 0 }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/core/io/shared/readlines.rb b/spec/ruby/core/io/shared/readlines.rb
index 08d41e0a4c..9bc02da0bd 100644
--- a/spec/ruby/core/io/shared/readlines.rb
+++ b/spec/ruby/core/io/shared/readlines.rb
@@ -1,11 +1,11 @@
describe :io_readlines, shared: true do
it "raises TypeError if the first parameter is nil" do
- lambda { IO.send(@method, nil, &@object) }.should raise_error(TypeError)
+ -> { IO.send(@method, nil, &@object) }.should raise_error(TypeError)
end
it "raises an Errno::ENOENT if the file does not exist" do
name = tmp("nonexistent.txt")
- lambda { IO.send(@method, name, &@object) }.should raise_error(Errno::ENOENT)
+ -> { IO.send(@method, name, &@object) }.should raise_error(Errno::ENOENT)
end
it "yields a single string with entire content when the separator is nil" do
@@ -98,7 +98,7 @@ describe :io_readlines_options_19, shared: true do
describe "when passed name, object, object" do
describe "when the first object is a Fixnum" do
it "uses the second object as an options Hash" do
- lambda do
+ -> do
IO.send(@method, @filename, 10, mode: "w", &@object)
end.should raise_error(IOError)
end
@@ -106,7 +106,7 @@ describe :io_readlines_options_19, shared: true do
it "calls #to_hash to convert the second object to a Hash" do
options = mock("io readlines options Hash")
options.should_receive(:to_hash).and_return({ mode: "w" })
- lambda do
+ -> do
IO.send(@method, @filename, 10, options, &@object)
end.should raise_error(IOError)
end
@@ -126,7 +126,7 @@ describe :io_readlines_options_19, shared: true do
end
it "uses the second object as an options Hash" do
- lambda do
+ -> do
IO.send(@method, @filename, " ", mode: "w", &@object)
end.should raise_error(IOError)
end
@@ -134,7 +134,7 @@ describe :io_readlines_options_19, shared: true do
it "calls #to_hash to convert the second object to a Hash" do
options = mock("io readlines options Hash")
options.should_receive(:to_hash).and_return({ mode: "w" })
- lambda do
+ -> do
IO.send(@method, @filename, " ", options, &@object)
end.should raise_error(IOError)
end
@@ -161,7 +161,7 @@ describe :io_readlines_options_19, shared: true do
end
it "uses the second object as an options Hash" do
- lambda do
+ -> do
IO.send(@method, @filename, " ", mode: "w", &@object)
end.should raise_error(IOError)
end
@@ -169,7 +169,7 @@ describe :io_readlines_options_19, shared: true do
it "calls #to_hash to convert the second object to a Hash" do
options = mock("io readlines options Hash")
options.should_receive(:to_hash).and_return({ mode: "w" })
- lambda do
+ -> do
IO.send(@method, @filename, " ", options, &@object)
end.should raise_error(IOError)
end
@@ -201,7 +201,7 @@ describe :io_readlines_options_19, shared: true do
it "calls #to_hash to convert the options object" do
options = mock("io readlines options Hash")
options.should_receive(:to_hash).and_return({ mode: "w" })
- lambda do
+ -> do
IO.send(@method, @filename, " ", 10, options, &@object)
end.should raise_error(IOError)
end
diff --git a/spec/ruby/core/io/shared/tty.rb b/spec/ruby/core/io/shared/tty.rb
index 947b887f81..82a780a9f3 100644
--- a/spec/ruby/core/io/shared/tty.rb
+++ b/spec/ruby/core/io/shared/tty.rb
@@ -20,6 +20,6 @@ describe :io_tty, shared: true do
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.send @method }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.send @method }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/core/io/shared/write.rb b/spec/ruby/core/io/shared/write.rb
index aa6b3eedeb..542d20d2a4 100644
--- a/spec/ruby/core/io/shared/write.rb
+++ b/spec/ruby/core/io/shared/write.rb
@@ -23,7 +23,7 @@ describe :io_write, shared: true do
end
it "checks if the file is writable if writing more than zero bytes" do
- lambda { @readonly_file.send(@method, "abcde") }.should raise_error(IOError)
+ -> { @readonly_file.send(@method, "abcde") }.should raise_error(IOError)
end
it "returns the number of bytes written" do
@@ -50,7 +50,7 @@ describe :io_write, shared: true do
it "does not warn if called after IO#read" do
@file.read(5)
- lambda { @file.send(@method, "fghij") }.should_not complain
+ -> { @file.send(@method, "fghij") }.should_not complain
end
it "writes to the current position after IO#read" do
@@ -66,7 +66,17 @@ describe :io_write, shared: true do
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.send(@method, "hello") }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.send(@method, "hello") }.should raise_error(IOError)
+ end
+
+ it "does not modify the passed argument" do
+ File.open(@filename, "w") do |f|
+ f.set_encoding(Encoding::IBM437)
+ # A character whose codepoint differs between UTF-8 and IBM437
+ f.write "ƒ\n".freeze
+ end
+
+ File.binread(@filename).bytes.should == [159, 10]
end
describe "on a pipe" do
diff --git a/spec/ruby/core/io/stat_spec.rb b/spec/ruby/core/io/stat_spec.rb
index d46d4105ca..58eba02b8f 100644
--- a/spec/ruby/core/io/stat_spec.rb
+++ b/spec/ruby/core/io/stat_spec.rb
@@ -11,7 +11,7 @@ describe "IO#stat" do
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.stat }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.stat }.should raise_error(IOError)
end
it "returns a File::Stat object for the stream" do
diff --git a/spec/ruby/core/io/sync_spec.rb b/spec/ruby/core/io/sync_spec.rb
index c8c1c5a57e..993b7ee244 100644
--- a/spec/ruby/core/io/sync_spec.rb
+++ b/spec/ruby/core/io/sync_spec.rb
@@ -27,7 +27,7 @@ describe "IO#sync=" do
end
it "raises an IOError on closed stream" do
- lambda { IOSpecs.closed_io.sync = true }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.sync = true }.should raise_error(IOError)
end
end
@@ -45,7 +45,7 @@ describe "IO#sync" do
end
it "raises an IOError on closed stream" do
- lambda { IOSpecs.closed_io.sync }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.sync }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/core/io/sysopen_spec.rb b/spec/ruby/core/io/sysopen_spec.rb
index 91f70c3ca9..4607d13687 100644
--- a/spec/ruby/core/io/sysopen_spec.rb
+++ b/spec/ruby/core/io/sysopen_spec.rb
@@ -33,7 +33,7 @@ describe "IO.sysopen" do
end
it "accepts a mode as second argument" do
- lambda { @fd = IO.sysopen(@filename, "w") }.should_not raise_error
+ -> { @fd = IO.sysopen(@filename, "w") }.should_not raise_error
@fd.should_not equal(0)
end
diff --git a/spec/ruby/core/io/sysread_spec.rb b/spec/ruby/core/io/sysread_spec.rb
index 4062620367..024200efea 100644
--- a/spec/ruby/core/io/sysread_spec.rb
+++ b/spec/ruby/core/io/sysread_spec.rb
@@ -58,13 +58,13 @@ describe "IO#sysread on a file" do
it "does not raise error if called after IO#read followed by IO#write" do
@file.read(5)
@file.write("abcde")
- lambda { @file.sysread(5) }.should_not raise_error(IOError)
+ -> { @file.sysread(5) }.should_not raise_error(IOError)
end
it "does not raise error if called after IO#read followed by IO#syswrite" do
@file.read(5)
@file.syswrite("abcde")
- lambda { @file.sysread(5) }.should_not raise_error(IOError)
+ -> { @file.sysread(5) }.should_not raise_error(IOError)
end
it "reads updated content after the flushed buffered IO#write" do
@@ -77,7 +77,7 @@ describe "IO#sysread on a file" do
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.sysread(5) }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.sysread(5) }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/core/io/sysseek_spec.rb b/spec/ruby/core/io/sysseek_spec.rb
index 84e0a1a4ac..df894734e3 100644
--- a/spec/ruby/core/io/sysseek_spec.rb
+++ b/spec/ruby/core/io/sysseek_spec.rb
@@ -23,7 +23,7 @@ describe "IO#sysseek" do
it "raises an error when called after buffered reads" do
@io.readline
- lambda { @io.sysseek(-5, IO::SEEK_CUR) }.should raise_error(IOError)
+ -> { @io.sysseek(-5, IO::SEEK_CUR) }.should raise_error(IOError)
end
it "moves the read position relative to the start with SEEK_SET" do
@@ -36,7 +36,7 @@ describe "IO#sysseek" do
# this is the safest way of checking the EOF when
# sys-* methods are invoked
- lambda { @io.sysread(1) }.should raise_error(EOFError)
+ -> { @io.sysread(1) }.should raise_error(EOFError)
@io.sysseek(-25, IO::SEEK_END)
@io.sysread(7).should == "cinco.\n"
diff --git a/spec/ruby/core/io/syswrite_spec.rb b/spec/ruby/core/io/syswrite_spec.rb
index a4dc8328aa..a28cc62174 100644
--- a/spec/ruby/core/io/syswrite_spec.rb
+++ b/spec/ruby/core/io/syswrite_spec.rb
@@ -31,13 +31,13 @@ describe "IO#syswrite on a file" do
it "warns if called immediately after a buffered IO#write" do
@file.write("abcde")
- lambda { @file.syswrite("fghij") }.should complain(/syswrite/)
+ -> { @file.syswrite("fghij") }.should complain(/syswrite/)
end
it "does not warn if called after IO#write with intervening IO#sysread" do
@file.syswrite("abcde")
@file.sysread(5)
- lambda { @file.syswrite("fghij") }.should_not complain
+ -> { @file.syswrite("fghij") }.should_not complain
end
it "writes to the actual file position when called after buffered IO#read" do
diff --git a/spec/ruby/core/io/to_i_spec.rb b/spec/ruby/core/io/to_i_spec.rb
index 7cd9e170d2..acf138c663 100644
--- a/spec/ruby/core/io/to_i_spec.rb
+++ b/spec/ruby/core/io/to_i_spec.rb
@@ -7,6 +7,6 @@ describe "IO#to_i" do
end
it "raises IOError on closed stream" do
- lambda { IOSpecs.closed_io.to_i }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.to_i }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/core/io/try_convert_spec.rb b/spec/ruby/core/io/try_convert_spec.rb
index cff56ba618..5fbd10b6fa 100644
--- a/spec/ruby/core/io/try_convert_spec.rb
+++ b/spec/ruby/core/io/try_convert_spec.rb
@@ -38,12 +38,12 @@ describe "IO.try_convert" do
it "raises a TypeError if the object does not return an IO from #to_io" do
obj = mock("io")
obj.should_receive(:to_io).and_return("io")
- lambda { IO.try_convert(obj) }.should raise_error(TypeError)
+ -> { IO.try_convert(obj) }.should raise_error(TypeError)
end
it "propagates an exception raised by #to_io" do
obj = mock("io")
obj.should_receive(:to_io).and_raise(TypeError.new)
- lambda{ IO.try_convert(obj) }.should raise_error(TypeError)
+ ->{ IO.try_convert(obj) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/io/ungetbyte_spec.rb b/spec/ruby/core/io/ungetbyte_spec.rb
index f5f9a11be1..1971dee534 100644
--- a/spec/ruby/core/io/ungetbyte_spec.rb
+++ b/spec/ruby/core/io/ungetbyte_spec.rb
@@ -43,7 +43,7 @@ describe "IO#ungetbyte" do
end
it "... but not for Bignum argument (eh?)" do
- lambda {
+ -> {
@io.ungetbyte(0x4f7574206f6620636861722072616e6765)
}.should raise_error(TypeError)
end
@@ -52,7 +52,7 @@ describe "IO#ungetbyte" do
ruby_version_is '2.6'...'2.6.1' do
it "is an RangeError if the integer is not in 8bit" do
for i in [4095, 0x4f7574206f6620636861722072616e6765] do
- lambda { @io.ungetbyte(i) }.should raise_error(RangeError)
+ -> { @io.ungetbyte(i) }.should raise_error(RangeError)
end
end
end
@@ -68,6 +68,6 @@ describe "IO#ungetbyte" do
it "raises an IOError if the IO is closed" do
@io.close
- lambda { @io.ungetbyte(42) }.should raise_error(IOError)
+ -> { @io.ungetbyte(42) }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/core/io/ungetc_spec.rb b/spec/ruby/core/io/ungetc_spec.rb
index 7d090d0e5d..34d4caf745 100644
--- a/spec/ruby/core/io/ungetc_spec.rb
+++ b/spec/ruby/core/io/ungetc_spec.rb
@@ -100,7 +100,7 @@ describe "IO#ungetc" do
it "makes subsequent unbuffered operations to raise IOError" do
@io.getc
@io.ungetc(100)
- lambda { @io.sysread(1) }.should raise_error(IOError)
+ -> { @io.sysread(1) }.should raise_error(IOError)
end
it "does not affect the stream and returns nil when passed nil" do
@@ -130,6 +130,6 @@ describe "IO#ungetc" do
it "raises IOError on closed stream" do
@io.getc
@io.close
- lambda { @io.ungetc(100) }.should raise_error(IOError)
+ -> { @io.ungetc(100) }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/core/io/write_nonblock_spec.rb b/spec/ruby/core/io/write_nonblock_spec.rb
index 285d1af376..18adfcfc4a 100644
--- a/spec/ruby/core/io/write_nonblock_spec.rb
+++ b/spec/ruby/core/io/write_nonblock_spec.rb
@@ -32,7 +32,7 @@ platform_is_not :windows do
end
it "checks if the file is writable if writing zero bytes" do
- lambda {
+ -> {
@readonly_file.write_nonblock("")
}.should raise_error(IOError)
end
@@ -54,7 +54,7 @@ describe 'IO#write_nonblock' do
end
it "raises an exception extending IO::WaitWritable when the write would block" do
- lambda {
+ -> {
loop { @write.write_nonblock('a' * 10_000) }
}.should raise_error(IO::WaitWritable) { |e|
platform_is_not :windows do
diff --git a/spec/ruby/core/io/write_spec.rb b/spec/ruby/core/io/write_spec.rb
index 5fb5cc7013..b28b582019 100644
--- a/spec/ruby/core/io/write_spec.rb
+++ b/spec/ruby/core/io/write_spec.rb
@@ -21,7 +21,7 @@ describe "IO#write on a file" do
end
it "does not check if the file is writable if writing zero bytes" do
- lambda { @readonly_file.write("") }.should_not raise_error
+ -> { @readonly_file.write("") }.should_not raise_error
end
it "returns a length of 0 when writing a blank string" do
@@ -59,7 +59,7 @@ describe "IO#write on a file" do
# pack "\xFEhi" to avoid utf-8 conflict
xFEhi = ([254].pack('C*') + 'hi').force_encoding('utf-8')
File.open(@filename, "w", encoding: Encoding::US_ASCII) do |file|
- lambda { file.write(xFEhi) }.should raise_error(Encoding::InvalidByteSequenceError)
+ -> { file.write(xFEhi) }.should raise_error(Encoding::InvalidByteSequenceError)
end
end
diff --git a/spec/ruby/core/kernel/Array_spec.rb b/spec/ruby/core/kernel/Array_spec.rb
index 5aa54cbcb6..b4a8bb7599 100644
--- a/spec/ruby/core/kernel/Array_spec.rb
+++ b/spec/ruby/core/kernel/Array_spec.rb
@@ -77,14 +77,14 @@ describe :kernel_Array, shared: true do
obj = mock("Array() string")
obj.should_receive(:to_ary).and_return("string")
- lambda { @object.send(@method, obj) }.should raise_error(TypeError)
+ -> { @object.send(@method, obj) }.should raise_error(TypeError)
end
it "raises a TypeError if #to_a does not return an Array" do
obj = mock("Array() string")
obj.should_receive(:to_a).and_return("string")
- lambda { @object.send(@method, obj) }.should raise_error(TypeError)
+ -> { @object.send(@method, obj) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/kernel/Complex_spec.rb b/spec/ruby/core/kernel/Complex_spec.rb
index cb90718759..37f9843931 100644
--- a/spec/ruby/core/kernel/Complex_spec.rb
+++ b/spec/ruby/core/kernel/Complex_spec.rb
@@ -126,16 +126,16 @@ describe "Kernel.Complex()" do
describe "when passed a non-Numeric second argument" do
it "raises TypeError" do
- lambda { Complex(:sym, :sym) }.should raise_error(TypeError)
- lambda { Complex(0, :sym) }.should raise_error(TypeError)
+ -> { Complex(:sym, :sym) }.should raise_error(TypeError)
+ -> { Complex(0, :sym) }.should raise_error(TypeError)
end
end
describe "when passed nil" do
it "raises TypeError" do
- lambda { Complex(nil) }.should raise_error(TypeError, "can't convert nil into Complex")
- lambda { Complex(0, nil) }.should raise_error(TypeError, "can't convert nil into Complex")
- lambda { Complex(nil, 0) }.should raise_error(TypeError, "can't convert nil into Complex")
+ -> { Complex(nil) }.should raise_error(TypeError, "can't convert nil into Complex")
+ -> { Complex(0, nil) }.should raise_error(TypeError, "can't convert nil into Complex")
+ -> { Complex(nil, 0) }.should raise_error(TypeError, "can't convert nil into Complex")
end
end
@@ -155,7 +155,7 @@ describe "Kernel.Complex()" do
describe "and [non-Numeric, Numeric] argument" do
it "throws a TypeError" do
- lambda { Complex(:sym, 0, exception: false) }.should raise_error(TypeError, "not a real")
+ -> { Complex(:sym, 0, exception: false) }.should raise_error(TypeError, "not a real")
end
end
diff --git a/spec/ruby/core/kernel/Float_spec.rb b/spec/ruby/core/kernel/Float_spec.rb
index 43daefa6aa..6580c38137 100644
--- a/spec/ruby/core/kernel/Float_spec.rb
+++ b/spec/ruby/core/kernel/Float_spec.rb
@@ -22,7 +22,7 @@ describe :kernel_float, shared: true do
end
it "raises an ArgumentError for nil" do
- lambda { @object.send(:Float, nil) }.should raise_error(TypeError)
+ -> { @object.send(:Float, nil) }.should raise_error(TypeError)
end
it "returns the identical NaN for NaN" do
@@ -51,24 +51,24 @@ describe :kernel_float, shared: true do
end
it "raises an ArgumentError for a String of word characters" do
- lambda { @object.send(:Float, "float") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "float") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if there are two decimal points in the String" do
- lambda { @object.send(:Float, "10.0.0") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "10.0.0") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError for a String of numbers followed by word characters" do
- lambda { @object.send(:Float, "10D") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "10D") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError for a String of word characters followed by numbers" do
- lambda { @object.send(:Float, "D10") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "D10") }.should raise_error(ArgumentError)
end
it "is strict about the string form even across newlines" do
- lambda { @object.send(:Float, "not a number\n10") }.should raise_error(ArgumentError)
- lambda { @object.send(:Float, "10\nnot a number") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "not a number\n10") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "10\nnot a number") }.should raise_error(ArgumentError)
end
it "converts String subclasses to floats without calling #to_f" do
@@ -90,17 +90,17 @@ describe :kernel_float, shared: true do
end
it "raises an ArgumentError if a + or - is embedded in a String" do
- lambda { @object.send(:Float, "1+1") }.should raise_error(ArgumentError)
- lambda { @object.send(:Float, "1-1") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "1+1") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "1-1") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if a String has a trailing + or -" do
- lambda { @object.send(:Float, "11+") }.should raise_error(ArgumentError)
- lambda { @object.send(:Float, "11-") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "11+") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "11-") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError for a String with a leading _" do
- lambda { @object.send(:Float, "_1") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "_1") }.should raise_error(ArgumentError)
end
it "returns a value for a String with an embedded _" do
@@ -108,31 +108,31 @@ describe :kernel_float, shared: true do
end
it "raises an ArgumentError for a String with a trailing _" do
- lambda { @object.send(:Float, "10_") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "10_") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError for a String of \\0" do
- lambda { @object.send(:Float, "\0") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "\0") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError for a String with a leading \\0" do
- lambda { @object.send(:Float, "\01") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "\01") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError for a String with an embedded \\0" do
- lambda { @object.send(:Float, "1\01") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "1\01") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError for a String with a trailing \\0" do
- lambda { @object.send(:Float, "1\0") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "1\0") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError for a String that is just an empty space" do
- lambda { @object.send(:Float, " ") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, " ") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError for a String that with an embedded space" do
- lambda { @object.send(:Float, "1 2") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "1 2") }.should raise_error(ArgumentError)
end
it "returns a value for a String with a leading space" do
@@ -153,11 +153,11 @@ describe :kernel_float, shared: true do
%w(e E).each do |e|
it "raises an ArgumentError if #{e} is the trailing character" do
- lambda { @object.send(:Float, "2#{e}") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "2#{e}") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if #{e} is the leading character" do
- lambda { @object.send(:Float, "#{e}2") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "#{e}2") }.should raise_error(ArgumentError)
end
it "returns Infinity for '2#{e}1000'" do
@@ -175,18 +175,18 @@ describe :kernel_float, shared: true do
end
it "raises an exception if a space is embedded on either side of the '#{e}'" do
- lambda { @object.send(:Float, "2 0#{e}100") }.should raise_error(ArgumentError)
- lambda { @object.send(:Float, "20#{e}1 00") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "2 0#{e}100") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "20#{e}1 00") }.should raise_error(ArgumentError)
end
it "raises an exception if there's a leading _ on either side of the '#{e}'" do
- lambda { @object.send(:Float, "_20#{e}100") }.should raise_error(ArgumentError)
- lambda { @object.send(:Float, "20#{e}_100") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "_20#{e}100") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "20#{e}_100") }.should raise_error(ArgumentError)
end
it "raises an exception if there's a trailing _ on either side of the '#{e}'" do
- lambda { @object.send(:Float, "20_#{e}100") }.should raise_error(ArgumentError)
- lambda { @object.send(:Float, "20#{e}100_") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "20_#{e}100") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "20#{e}100_") }.should raise_error(ArgumentError)
end
it "allows decimal points on the left side of the '#{e}'" do
@@ -194,7 +194,7 @@ describe :kernel_float, shared: true do
end
it "raises an ArgumentError if there's a decimal point on the right side of the '#{e}'" do
- lambda { @object.send(:Float, "20#{e}2.0") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "20#{e}2.0") }.should raise_error(ArgumentError)
end
end
@@ -209,11 +209,11 @@ describe :kernel_float, shared: true do
end
it "raises an ArgumentError if #{p} is the trailing character" do
- lambda { @object.send(:Float, "0x1#{p}") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "0x1#{p}") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if #{p} is the leading character" do
- lambda { @object.send(:Float, "0x#{p}1") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "0x#{p}1") }.should raise_error(ArgumentError)
end
it "returns Infinity for '0x1#{p}10000'" do
@@ -231,18 +231,18 @@ describe :kernel_float, shared: true do
end
it "raises an exception if a space is embedded on either side of the '#{p}'" do
- lambda { @object.send(:Float, "0x1 0#{p}10") }.should raise_error(ArgumentError)
- lambda { @object.send(:Float, "0x10#{p}1 0") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "0x1 0#{p}10") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "0x10#{p}1 0") }.should raise_error(ArgumentError)
end
it "raises an exception if there's a leading _ on either side of the '#{p}'" do
- lambda { @object.send(:Float, "0x_10#{p}10") }.should raise_error(ArgumentError)
- lambda { @object.send(:Float, "0x10#{p}_10") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "0x_10#{p}10") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "0x10#{p}_10") }.should raise_error(ArgumentError)
end
it "raises an exception if there's a trailing _ on either side of the '#{p}'" do
- lambda { @object.send(:Float, "0x10_#{p}10") }.should raise_error(ArgumentError)
- lambda { @object.send(:Float, "0x10#{p}10_") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "0x10_#{p}10") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "0x10#{p}10_") }.should raise_error(ArgumentError)
end
it "allows hexadecimal points on the left side of the '#{p}'" do
@@ -250,7 +250,7 @@ describe :kernel_float, shared: true do
end
it "raises an ArgumentError if there's a decimal point on the right side of the '#{p}'" do
- lambda { @object.send(:Float, "0x1#{p}1.0") }.should raise_error(ArgumentError)
+ -> { @object.send(:Float, "0x1#{p}1.0") }.should raise_error(ArgumentError)
end
end
end
@@ -282,22 +282,22 @@ describe :kernel_float, shared: true do
end
it "raises a TypeError if #to_f is not provided" do
- lambda { @object.send(:Float, mock('x')) }.should raise_error(TypeError)
+ -> { @object.send(:Float, mock('x')) }.should raise_error(TypeError)
end
it "raises a TypeError if #to_f returns a String" do
(obj = mock('ha!')).should_receive(:to_f).once.and_return('ha!')
- lambda { @object.send(:Float, obj) }.should raise_error(TypeError)
+ -> { @object.send(:Float, obj) }.should raise_error(TypeError)
end
it "raises a TypeError if #to_f returns an Integer" do
(obj = mock('123')).should_receive(:to_f).once.and_return(123)
- lambda { @object.send(:Float, obj) }.should raise_error(TypeError)
+ -> { @object.send(:Float, obj) }.should raise_error(TypeError)
end
it "raises a RangeError when passed a Complex argument" do
c = Complex(2, 3)
- lambda { @object.send(:Float, c) }.should raise_error(RangeError)
+ -> { @object.send(:Float, c) }.should raise_error(RangeError)
end
ruby_version_is "2.6" do
diff --git a/spec/ruby/core/kernel/Hash_spec.rb b/spec/ruby/core/kernel/Hash_spec.rb
index 89e97fb11e..cbe098a8ac 100644
--- a/spec/ruby/core/kernel/Hash_spec.rb
+++ b/spec/ruby/core/kernel/Hash_spec.rb
@@ -43,14 +43,14 @@ describe :kernel_Hash, shared: true do
end
it "raises a TypeError if it doesn't respond to #to_hash" do
- lambda { @object.send(@method, mock("")) }.should raise_error(TypeError)
+ -> { @object.send(@method, mock("")) }.should raise_error(TypeError)
end
it "raises a TypeError if #to_hash does not return an Hash" do
obj = mock("Hash() string")
obj.should_receive(:to_hash).and_return("string")
- lambda { @object.send(@method, obj) }.should raise_error(TypeError)
+ -> { @object.send(@method, obj) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/kernel/Integer_spec.rb b/spec/ruby/core/kernel/Integer_spec.rb
index b7e05e701b..59b41d37e6 100644
--- a/spec/ruby/core/kernel/Integer_spec.rb
+++ b/spec/ruby/core/kernel/Integer_spec.rb
@@ -24,7 +24,7 @@ describe :kernel_integer, shared: true do
obj = mock("object")
obj.should_receive(:to_int).and_return("1")
obj.should_receive(:to_i).and_return(nil)
- lambda { Integer(obj) }.should raise_error(TypeError)
+ -> { Integer(obj) }.should raise_error(TypeError)
end
it "return a result of to_i when to_int does not return an Integer" do
@@ -36,7 +36,7 @@ describe :kernel_integer, shared: true do
end
it "raises a TypeError when passed nil" do
- lambda { Integer(nil) }.should raise_error(TypeError)
+ -> { Integer(nil) }.should raise_error(TypeError)
end
it "returns a Fixnum or Bignum object" do
@@ -78,26 +78,26 @@ describe :kernel_integer, shared: true do
it "raises a TypeError if to_i returns a value that is not an Integer" do
obj = mock("object")
obj.should_receive(:to_i).and_return("1")
- lambda { Integer(obj) }.should raise_error(TypeError)
+ -> { Integer(obj) }.should raise_error(TypeError)
end
it "raises a TypeError if no to_int or to_i methods exist" do
obj = mock("object")
- lambda { Integer(obj) }.should raise_error(TypeError)
+ -> { Integer(obj) }.should raise_error(TypeError)
end
it "raises a TypeError if to_int returns nil and no to_i exists" do
obj = mock("object")
obj.should_receive(:to_i).and_return(nil)
- lambda { Integer(obj) }.should raise_error(TypeError)
+ -> { Integer(obj) }.should raise_error(TypeError)
end
it "raises a FloatDomainError when passed NaN" do
- lambda { Integer(nan_value) }.should raise_error(FloatDomainError)
+ -> { Integer(nan_value) }.should raise_error(FloatDomainError)
end
it "raises a FloatDomainError when passed Infinity" do
- lambda { Integer(infinity_value) }.should raise_error(FloatDomainError)
+ -> { Integer(infinity_value) }.should raise_error(FloatDomainError)
end
ruby_version_is "2.6" do
@@ -160,19 +160,19 @@ end
describe "Integer() given a String", shared: true do
it "raises an ArgumentError if the String is a null byte" do
- lambda { Integer("\0") }.should raise_error(ArgumentError)
+ -> { Integer("\0") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if the String starts with a null byte" do
- lambda { Integer("\01") }.should raise_error(ArgumentError)
+ -> { Integer("\01") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if the String ends with a null byte" do
- lambda { Integer("1\0") }.should raise_error(ArgumentError)
+ -> { Integer("1\0") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if the String contains a null byte" do
- lambda { Integer("1\01") }.should raise_error(ArgumentError)
+ -> { Integer("1\01") }.should raise_error(ArgumentError)
end
it "ignores leading whitespace" do
@@ -188,13 +188,13 @@ describe "Integer() given a String", shared: true do
end
it "raises an ArgumentError if there are leading _s" do
- lambda { Integer("_1") }.should raise_error(ArgumentError)
- lambda { Integer("___1") }.should raise_error(ArgumentError)
+ -> { Integer("_1") }.should raise_error(ArgumentError)
+ -> { Integer("___1") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if there are trailing _s" do
- lambda { Integer("1_") }.should raise_error(ArgumentError)
- lambda { Integer("1___") }.should raise_error(ArgumentError)
+ -> { Integer("1_") }.should raise_error(ArgumentError)
+ -> { Integer("1___") }.should raise_error(ArgumentError)
end
it "ignores an embedded _" do
@@ -202,8 +202,8 @@ describe "Integer() given a String", shared: true do
end
it "raises an ArgumentError if there are multiple embedded _s" do
- lambda { Integer("1__1") }.should raise_error(ArgumentError)
- lambda { Integer("1___1") }.should raise_error(ArgumentError)
+ -> { Integer("1__1") }.should raise_error(ArgumentError)
+ -> { Integer("1___1") }.should raise_error(ArgumentError)
end
it "ignores a single leading +" do
@@ -211,17 +211,17 @@ describe "Integer() given a String", shared: true do
end
it "raises an ArgumentError if there is a space between the + and number" do
- lambda { Integer("+ 1") }.should raise_error(ArgumentError)
+ -> { Integer("+ 1") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if there are multiple leading +s" do
- lambda { Integer("++1") }.should raise_error(ArgumentError)
- lambda { Integer("+++1") }.should raise_error(ArgumentError)
+ -> { Integer("++1") }.should raise_error(ArgumentError)
+ -> { Integer("+++1") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if there are trailing +s" do
- lambda { Integer("1+") }.should raise_error(ArgumentError)
- lambda { Integer("1+++") }.should raise_error(ArgumentError)
+ -> { Integer("1+") }.should raise_error(ArgumentError)
+ -> { Integer("1+++") }.should raise_error(ArgumentError)
end
it "makes the number negative if there's a leading -" do
@@ -229,21 +229,21 @@ describe "Integer() given a String", shared: true do
end
it "raises an ArgumentError if there are multiple leading -s" do
- lambda { Integer("--1") }.should raise_error(ArgumentError)
- lambda { Integer("---1") }.should raise_error(ArgumentError)
+ -> { Integer("--1") }.should raise_error(ArgumentError)
+ -> { Integer("---1") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if there are trailing -s" do
- lambda { Integer("1-") }.should raise_error(ArgumentError)
- lambda { Integer("1---") }.should raise_error(ArgumentError)
+ -> { Integer("1-") }.should raise_error(ArgumentError)
+ -> { Integer("1---") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if there is a period" do
- lambda { Integer("0.0") }.should raise_error(ArgumentError)
+ -> { Integer("0.0") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError for an empty String" do
- lambda { Integer("") }.should raise_error(ArgumentError)
+ -> { Integer("") }.should raise_error(ArgumentError)
end
ruby_version_is "2.6" do
@@ -295,7 +295,7 @@ describe "Integer() given a String", shared: true do
end
it "raises an ArgumentError if the number cannot be parsed as hex" do
- lambda { Integer("0#{x}g") }.should raise_error(ArgumentError)
+ -> { Integer("0#{x}g") }.should raise_error(ArgumentError)
end
end
@@ -316,7 +316,7 @@ describe "Integer() given a String", shared: true do
end
it "raises an ArgumentError if the number cannot be parsed as binary" do
- lambda { Integer("0#{b}2") }.should raise_error(ArgumentError)
+ -> { Integer("0#{b}2") }.should raise_error(ArgumentError)
end
end
@@ -337,7 +337,7 @@ describe "Integer() given a String", shared: true do
end
it "raises an ArgumentError if the number cannot be parsed as octal" do
- lambda { Integer("0#{o}9") }.should raise_error(ArgumentError)
+ -> { Integer("0#{o}9") }.should raise_error(ArgumentError)
end
end
@@ -358,26 +358,26 @@ describe "Integer() given a String", shared: true do
end
it "raises an ArgumentError if the number cannot be parsed as decimal" do
- lambda { Integer("0#{d}a") }.should raise_error(ArgumentError)
+ -> { Integer("0#{d}a") }.should raise_error(ArgumentError)
end
end
end
describe "Integer() given a String and base", shared: true do
it "raises an ArgumentError if the String is a null byte" do
- lambda { Integer("\0", 2) }.should raise_error(ArgumentError)
+ -> { Integer("\0", 2) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if the String starts with a null byte" do
- lambda { Integer("\01", 3) }.should raise_error(ArgumentError)
+ -> { Integer("\01", 3) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if the String ends with a null byte" do
- lambda { Integer("1\0", 4) }.should raise_error(ArgumentError)
+ -> { Integer("1\0", 4) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if the String contains a null byte" do
- lambda { Integer("1\01", 5) }.should raise_error(ArgumentError)
+ -> { Integer("1\01", 5) }.should raise_error(ArgumentError)
end
it "ignores leading whitespace" do
@@ -393,13 +393,13 @@ describe "Integer() given a String and base", shared: true do
end
it "raises an ArgumentError if there are leading _s" do
- lambda { Integer("_1", 7) }.should raise_error(ArgumentError)
- lambda { Integer("___1", 7) }.should raise_error(ArgumentError)
+ -> { Integer("_1", 7) }.should raise_error(ArgumentError)
+ -> { Integer("___1", 7) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if there are trailing _s" do
- lambda { Integer("1_", 12) }.should raise_error(ArgumentError)
- lambda { Integer("1___", 12) }.should raise_error(ArgumentError)
+ -> { Integer("1_", 12) }.should raise_error(ArgumentError)
+ -> { Integer("1___", 12) }.should raise_error(ArgumentError)
end
it "ignores an embedded _" do
@@ -407,8 +407,8 @@ describe "Integer() given a String and base", shared: true do
end
it "raises an ArgumentError if there are multiple embedded _s" do
- lambda { Integer("1__1", 4) }.should raise_error(ArgumentError)
- lambda { Integer("1___1", 4) }.should raise_error(ArgumentError)
+ -> { Integer("1__1", 4) }.should raise_error(ArgumentError)
+ -> { Integer("1___1", 4) }.should raise_error(ArgumentError)
end
it "ignores a single leading +" do
@@ -416,17 +416,17 @@ describe "Integer() given a String and base", shared: true do
end
it "raises an ArgumentError if there is a space between the + and number" do
- lambda { Integer("+ 1", 3) }.should raise_error(ArgumentError)
+ -> { Integer("+ 1", 3) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if there are multiple leading +s" do
- lambda { Integer("++1", 3) }.should raise_error(ArgumentError)
- lambda { Integer("+++1", 3) }.should raise_error(ArgumentError)
+ -> { Integer("++1", 3) }.should raise_error(ArgumentError)
+ -> { Integer("+++1", 3) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if there are trailing +s" do
- lambda { Integer("1+", 3) }.should raise_error(ArgumentError)
- lambda { Integer("1+++", 12) }.should raise_error(ArgumentError)
+ -> { Integer("1+", 3) }.should raise_error(ArgumentError)
+ -> { Integer("1+++", 12) }.should raise_error(ArgumentError)
end
it "makes the number negative if there's a leading -" do
@@ -434,29 +434,29 @@ describe "Integer() given a String and base", shared: true do
end
it "raises an ArgumentError if there are multiple leading -s" do
- lambda { Integer("--1", 9) }.should raise_error(ArgumentError)
- lambda { Integer("---1", 9) }.should raise_error(ArgumentError)
+ -> { Integer("--1", 9) }.should raise_error(ArgumentError)
+ -> { Integer("---1", 9) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if there are trailing -s" do
- lambda { Integer("1-", 12) }.should raise_error(ArgumentError)
- lambda { Integer("1---", 12) }.should raise_error(ArgumentError)
+ -> { Integer("1-", 12) }.should raise_error(ArgumentError)
+ -> { Integer("1---", 12) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if there is a period" do
- lambda { Integer("0.0", 3) }.should raise_error(ArgumentError)
+ -> { Integer("0.0", 3) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError for an empty String" do
- lambda { Integer("", 12) }.should raise_error(ArgumentError)
+ -> { Integer("", 12) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError for a base of 1" do
- lambda { Integer("1", 1) }.should raise_error(ArgumentError)
+ -> { Integer("1", 1) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError for a base of 37" do
- lambda { Integer("1", 37) }.should raise_error(ArgumentError)
+ -> { Integer("1", 37) }.should raise_error(ArgumentError)
end
it "accepts wholly lowercase alphabetic strings for bases > 10" do
@@ -484,8 +484,8 @@ describe "Integer() given a String and base", shared: true do
end
it "raises an ArgumentError for letters invalid in the given base" do
- lambda { Integer('z',19) }.should raise_error(ArgumentError)
- lambda { Integer('c00o',2) }.should raise_error(ArgumentError)
+ -> { Integer('z',19) }.should raise_error(ArgumentError)
+ -> { Integer('c00o',2) }.should raise_error(ArgumentError)
end
%w(x X).each do |x|
@@ -506,12 +506,12 @@ describe "Integer() given a String and base", shared: true do
2.upto(15) do |base|
it "raises an ArgumentError if the number begins with 0#{x} and the base is #{base}" do
- lambda { Integer("0#{x}1", base) }.should raise_error(ArgumentError)
+ -> { Integer("0#{x}1", base) }.should raise_error(ArgumentError)
end
end
it "raises an ArgumentError if the number cannot be parsed as hex and the base is 16" do
- lambda { Integer("0#{x}g", 16) }.should raise_error(ArgumentError)
+ -> { Integer("0#{x}g", 16) }.should raise_error(ArgumentError)
end
end
@@ -532,7 +532,7 @@ describe "Integer() given a String and base", shared: true do
end
it "raises an ArgumentError if the number cannot be parsed as binary and the base is 2" do
- lambda { Integer("0#{b}2", 2) }.should raise_error(ArgumentError)
+ -> { Integer("0#{b}2", 2) }.should raise_error(ArgumentError)
end
end
@@ -553,12 +553,12 @@ describe "Integer() given a String and base", shared: true do
end
it "raises an ArgumentError if the number cannot be parsed as octal and the base is 8" do
- lambda { Integer("0#{o}9", 8) }.should raise_error(ArgumentError)
+ -> { Integer("0#{o}9", 8) }.should raise_error(ArgumentError)
end
2.upto(7) do |base|
it "raises an ArgumentError if the number begins with 0#{o} and the base is #{base}" do
- lambda { Integer("0#{o}1", base) }.should raise_error(ArgumentError)
+ -> { Integer("0#{o}1", base) }.should raise_error(ArgumentError)
end
end
end
@@ -580,17 +580,17 @@ describe "Integer() given a String and base", shared: true do
end
it "raises an ArgumentError if the number cannot be parsed as decimal and the base is 10" do
- lambda { Integer("0#{d}a", 10) }.should raise_error(ArgumentError)
+ -> { Integer("0#{d}a", 10) }.should raise_error(ArgumentError)
end
2.upto(9) do |base|
it "raises an ArgumentError if the number begins with 0#{d} and the base is #{base}" do
- lambda { Integer("0#{d}1", base) }.should raise_error(ArgumentError)
+ -> { Integer("0#{d}1", base) }.should raise_error(ArgumentError)
end
end
it "raises an ArgumentError if a base is given for a non-String value" do
- lambda { Integer(98, 15) }.should raise_error(ArgumentError)
+ -> { Integer(98, 15) }.should raise_error(ArgumentError)
end
end
@@ -616,176 +616,176 @@ end
describe :kernel_Integer, shared: true do
it "raises an ArgumentError when the String contains digits out of range of radix 2" do
str = "23456789abcdefghijklmnopqrstuvwxyz"
- lambda { @object.send(@method, str, 2) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 2) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 3" do
str = "3456789abcdefghijklmnopqrstuvwxyz"
- lambda { @object.send(@method, str, 3) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 3) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 4" do
str = "456789abcdefghijklmnopqrstuvwxyz"
- lambda { @object.send(@method, str, 4) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 4) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 5" do
str = "56789abcdefghijklmnopqrstuvwxyz"
- lambda { @object.send(@method, str, 5) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 5) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 6" do
str = "6789abcdefghijklmnopqrstuvwxyz"
- lambda { @object.send(@method, str, 6) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 6) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 7" do
str = "789abcdefghijklmnopqrstuvwxyz"
- lambda { @object.send(@method, str, 7) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 7) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 8" do
str = "89abcdefghijklmnopqrstuvwxyz"
- lambda { @object.send(@method, str, 8) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 8) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 9" do
str = "9abcdefghijklmnopqrstuvwxyz"
- lambda { @object.send(@method, str, 9) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 9) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 10" do
str = "abcdefghijklmnopqrstuvwxyz"
- lambda { @object.send(@method, str, 10) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 10) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 11" do
str = "bcdefghijklmnopqrstuvwxyz"
- lambda { @object.send(@method, str, 11) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 11) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 12" do
str = "cdefghijklmnopqrstuvwxyz"
- lambda { @object.send(@method, str, 12) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 12) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 13" do
str = "defghijklmnopqrstuvwxyz"
- lambda { @object.send(@method, str, 13) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 13) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 14" do
str = "efghijklmnopqrstuvwxyz"
- lambda { @object.send(@method, str, 14) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 14) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 15" do
str = "fghijklmnopqrstuvwxyz"
- lambda { @object.send(@method, str, 15) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 15) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 16" do
str = "ghijklmnopqrstuvwxyz"
- lambda { @object.send(@method, str, 16) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 16) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 17" do
str = "hijklmnopqrstuvwxyz"
- lambda { @object.send(@method, str, 17) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 17) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 18" do
str = "ijklmnopqrstuvwxyz"
- lambda { @object.send(@method, str, 18) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 18) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 19" do
str = "jklmnopqrstuvwxyz"
- lambda { @object.send(@method, str, 19) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 19) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 20" do
str = "klmnopqrstuvwxyz"
- lambda { @object.send(@method, str, 20) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 20) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 21" do
str = "lmnopqrstuvwxyz"
- lambda { @object.send(@method, str, 21) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 21) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 22" do
str = "mnopqrstuvwxyz"
- lambda { @object.send(@method, str, 22) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 22) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 23" do
str = "nopqrstuvwxyz"
- lambda { @object.send(@method, str, 23) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 23) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 24" do
str = "opqrstuvwxyz"
- lambda { @object.send(@method, str, 24) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 24) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 25" do
str = "pqrstuvwxyz"
- lambda { @object.send(@method, str, 25) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 25) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 26" do
str = "qrstuvwxyz"
- lambda { @object.send(@method, str, 26) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 26) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 27" do
str = "rstuvwxyz"
- lambda { @object.send(@method, str, 27) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 27) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 28" do
str = "stuvwxyz"
- lambda { @object.send(@method, str, 28) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 28) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 29" do
str = "tuvwxyz"
- lambda { @object.send(@method, str, 29) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 29) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 30" do
str = "uvwxyz"
- lambda { @object.send(@method, str, 30) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 30) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 31" do
str = "vwxyz"
- lambda { @object.send(@method, str, 31) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 31) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 32" do
str = "wxyz"
- lambda { @object.send(@method, str, 32) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 32) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 33" do
str = "xyz"
- lambda { @object.send(@method, str, 33) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 33) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 34" do
str = "yz"
- lambda { @object.send(@method, str, 34) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 34) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 35" do
str = "z"
- lambda { @object.send(@method, str, 35) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, str, 35) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the String contains digits out of range of radix 36" do
- lambda { @object.send(@method, "{", 36) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, "{", 36) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/kernel/String_spec.rb b/spec/ruby/core/kernel/String_spec.rb
index 81489875c8..47ee797be5 100644
--- a/spec/ruby/core/kernel/String_spec.rb
+++ b/spec/ruby/core/kernel/String_spec.rb
@@ -32,7 +32,7 @@ describe :kernel_String, shared: true do
undef_method :to_s
end
- lambda { @object.send(@method, obj) }.should raise_error(TypeError)
+ -> { @object.send(@method, obj) }.should raise_error(TypeError)
end
# #5158
@@ -44,7 +44,7 @@ describe :kernel_String, shared: true do
end
end
- lambda { @object.send(@method, obj) }.should raise_error(TypeError)
+ -> { @object.send(@method, obj) }.should raise_error(TypeError)
end
it "raises a TypeError if #to_s is not defined, even though #respond_to?(:to_s) returns true" do
@@ -57,7 +57,7 @@ describe :kernel_String, shared: true do
end
end
- lambda { @object.send(@method, obj) }.should raise_error(TypeError)
+ -> { @object.send(@method, obj) }.should raise_error(TypeError)
end
it "calls #to_s if #respond_to?(:to_s) returns true" do
@@ -74,7 +74,7 @@ describe :kernel_String, shared: true do
it "raises a TypeError if #to_s does not return a String" do
(obj = mock('123')).should_receive(:to_s).and_return(123)
- lambda { @object.send(@method, obj) }.should raise_error(TypeError)
+ -> { @object.send(@method, obj) }.should raise_error(TypeError)
end
it "returns the same object if it is already a String" do
diff --git a/spec/ruby/core/kernel/backtick_spec.rb b/spec/ruby/core/kernel/backtick_spec.rb
index dcba218f61..5ab0fb0eea 100644
--- a/spec/ruby/core/kernel/backtick_spec.rb
+++ b/spec/ruby/core/kernel/backtick_spec.rb
@@ -21,7 +21,7 @@ describe "Kernel#`" do
it "lets the standard error stream pass through to the inherited stderr" do
cmd = ruby_cmd('STDERR.print "error stream"')
- lambda {
+ -> {
`#{cmd}`.should == ""
}.should output_to_fd("error stream", STDERR)
end
@@ -32,7 +32,7 @@ describe "Kernel#`" do
end
it "raises an Errno::ENOENT if the command is not executable" do
- lambda { `nonexistent_command` }.should raise_error(Errno::ENOENT)
+ -> { `nonexistent_command` }.should raise_error(Errno::ENOENT)
end
platform_is_not :windows do
diff --git a/spec/ruby/core/kernel/binding_spec.rb b/spec/ruby/core/kernel/binding_spec.rb
index e9fca6e3ab..f1c9c6ec9f 100644
--- a/spec/ruby/core/kernel/binding_spec.rb
+++ b/spec/ruby/core/kernel/binding_spec.rb
@@ -35,7 +35,7 @@ describe "Kernel#binding" do
end
it "raises a NameError on undefined variable" do
- lambda { eval("a_fake_variable", @b1) }.should raise_error(NameError)
+ -> { eval("a_fake_variable", @b1) }.should raise_error(NameError)
end
it "uses the closure's self as self in the binding" do
diff --git a/spec/ruby/core/kernel/catch_spec.rb b/spec/ruby/core/kernel/catch_spec.rb
index 092fb4968a..4060172429 100644
--- a/spec/ruby/core/kernel/catch_spec.rb
+++ b/spec/ruby/core/kernel/catch_spec.rb
@@ -31,11 +31,11 @@ describe "Kernel.catch" do
end
it "raises an ArgumentError if a Symbol is thrown for a String catch value" do
- lambda { catch("exit") { throw :exit } }.should raise_error(ArgumentError)
+ -> { catch("exit") { throw :exit } }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if a String with different identity is thrown" do
- lambda { catch("exit") { throw "exit" } }.should raise_error(ArgumentError)
+ -> { catch("exit") { throw "exit" } }.should raise_error(ArgumentError)
end
it "catches a Symbol when thrown a matching Symbol" do
@@ -116,7 +116,7 @@ describe "Kernel.catch" do
end
it "raises LocalJumpError if no block is given" do
- lambda { catch :blah }.should raise_error(LocalJumpError)
+ -> { catch :blah }.should raise_error(LocalJumpError)
end
end
diff --git a/spec/ruby/core/kernel/define_singleton_method_spec.rb b/spec/ruby/core/kernel/define_singleton_method_spec.rb
index c2f2da7c79..dc77c3e6f8 100644
--- a/spec/ruby/core/kernel/define_singleton_method_spec.rb
+++ b/spec/ruby/core/kernel/define_singleton_method_spec.rb
@@ -21,7 +21,7 @@ describe "Kernel#define_singleton_method" do
um = KernelSpecs::Parent.method(:parent_class_method).unbind
KernelSpecs::Child.send :define_singleton_method, :child_class_method, um
KernelSpecs::Child.child_class_method.should == :foo
- lambda{KernelSpecs::Parent.child_class_method}.should raise_error(NoMethodError)
+ ->{KernelSpecs::Parent.child_class_method}.should raise_error(NoMethodError)
end
it "will raise when attempting to define an object's singleton method from another object's singleton method" do
@@ -33,7 +33,7 @@ describe "Kernel#define_singleton_method" do
end
end
um = p.method(:singleton_method).unbind
- lambda{ other.send :define_singleton_method, :other_singleton_method, um }.should raise_error(TypeError)
+ ->{ other.send :define_singleton_method, :other_singleton_method, um }.should raise_error(TypeError)
end
end
@@ -41,7 +41,7 @@ describe "Kernel#define_singleton_method" do
it "defines a new method with the given name and the given block as body in self" do
class DefineSingletonMethodSpecClass
define_singleton_method(:block_test1) { self }
- define_singleton_method(:block_test2, &lambda { self })
+ define_singleton_method(:block_test2, &-> { self })
end
o = DefineSingletonMethodSpecClass
@@ -50,11 +50,11 @@ describe "Kernel#define_singleton_method" do
end
it "raises a TypeError when the given method is no Method/Proc" do
- lambda {
+ -> {
Class.new { define_singleton_method(:test, "self") }
}.should raise_error(TypeError)
- lambda {
+ -> {
Class.new { define_singleton_method(:test, 1234) }
}.should raise_error(TypeError)
end
@@ -63,7 +63,7 @@ describe "Kernel#define_singleton_method" do
obj = Object.new
obj.define_singleton_method(:test) { "world!" }
obj.test.should == "world!"
- lambda {
+ -> {
Object.new.test
}.should raise_error(NoMethodError)
end
@@ -81,7 +81,7 @@ describe "Kernel#define_singleton_method" do
it "raises an ArgumentError when no block is given" do
obj = Object.new
- lambda {
+ -> {
obj.define_singleton_method(:test)
}.should raise_error(ArgumentError)
end
@@ -92,7 +92,7 @@ describe "Kernel#define_singleton_method" do
define_singleton_method(name)
end
- lambda {
+ -> {
o.define(:foo) { raise "not used" }
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/core/kernel/dup_spec.rb b/spec/ruby/core/kernel/dup_spec.rb
index ce81f7018a..fe0a269d69 100644
--- a/spec/ruby/core/kernel/dup_spec.rb
+++ b/spec/ruby/core/kernel/dup_spec.rb
@@ -44,7 +44,7 @@ describe "Kernel#dup" do
it "does not copy singleton methods" do
def @obj.special() :the_one end
dup = @obj.dup
- lambda { dup.special }.should raise_error(NameError)
+ -> { dup.special }.should raise_error(NameError)
end
it "does not copy modules included in the singleton class" do
@@ -53,7 +53,7 @@ describe "Kernel#dup" do
end
dup = @obj.dup
- lambda { dup.repr }.should raise_error(NameError)
+ -> { dup.repr }.should raise_error(NameError)
end
it "does not copy constants defined in the singleton class" do
@@ -62,6 +62,6 @@ describe "Kernel#dup" do
end
dup = @obj.dup
- lambda { class << dup; CLONE; end }.should raise_error(NameError)
+ -> { class << dup; CLONE; end }.should raise_error(NameError)
end
end
diff --git a/spec/ruby/core/kernel/eval_spec.rb b/spec/ruby/core/kernel/eval_spec.rb
index 696c55a3ba..9442725eac 100644
--- a/spec/ruby/core/kernel/eval_spec.rb
+++ b/spec/ruby/core/kernel/eval_spec.rb
@@ -76,12 +76,12 @@ describe "Kernel#eval" do
x = 1
bind = proc {}
- lambda { eval("x", bind) }.should raise_error(TypeError)
+ -> { eval("x", bind) }.should raise_error(TypeError)
end
it "does not make Proc locals visible to evaluated code" do
bind = proc { inner = 4 }
- lambda { eval("inner", bind.binding) }.should raise_error(NameError)
+ -> { eval("inner", bind.binding) }.should raise_error(NameError)
end
# REWRITE ME: This obscures the real behavior of where locals are stored
@@ -134,7 +134,7 @@ describe "Kernel#eval" do
it "includes file and line information in syntax error" do
expected = 'speccing.rb'
- lambda {
+ -> {
eval('if true',TOPLEVEL_BINDING, expected)
}.should raise_error(SyntaxError) { |e|
e.message.should =~ /#{expected}:1:.+/
@@ -143,7 +143,7 @@ describe "Kernel#eval" do
it "evaluates string with given filename and negative linenumber" do
expected_file = 'speccing.rb'
- lambda {
+ -> {
eval('if true',TOPLEVEL_BINDING, expected_file, -100)
}.should raise_error(SyntaxError) { |e|
e.message.should =~ /#{expected_file}:-100:.+/
@@ -195,13 +195,13 @@ describe "Kernel#eval" do
end
it "does not pass the block to the method being eval'ed" do
- lambda {
+ -> {
eval('KernelSpecs::EvalTest.call_yield') { "content" }
}.should raise_error(LocalJumpError)
end
it "returns from the scope calling #eval when evaluating 'return'" do
- lambda { eval("return :eval") }.call.should == :eval
+ -> { eval("return :eval") }.call.should == :eval
end
it "unwinds through a Proc-style closure and returns from a lambda-style closure in the closure chain" do
diff --git a/spec/ruby/core/kernel/extend_spec.rb b/spec/ruby/core/kernel/extend_spec.rb
index f4f9dde098..9f98b3681f 100644
--- a/spec/ruby/core/kernel/extend_spec.rb
+++ b/spec/ruby/core/kernel/extend_spec.rb
@@ -53,13 +53,13 @@ describe "Kernel#extend" do
end
it "raises an ArgumentError when no arguments given" do
- lambda { Object.new.extend }.should raise_error(ArgumentError)
+ -> { Object.new.extend }.should raise_error(ArgumentError)
end
it "raises a TypeError when the argument is not a Module" do
o = mock('o')
klass = Class.new
- lambda { o.extend(klass) }.should raise_error(TypeError)
+ -> { o.extend(klass) }.should raise_error(TypeError)
end
describe "on frozen instance" do
@@ -69,11 +69,11 @@ describe "Kernel#extend" do
end
it "raises an ArgumentError when no arguments given" do
- lambda { @frozen.extend }.should raise_error(ArgumentError)
+ -> { @frozen.extend }.should raise_error(ArgumentError)
end
it "raises a #{frozen_error_class}" do
- lambda { @frozen.extend @module }.should raise_error(frozen_error_class)
+ -> { @frozen.extend @module }.should raise_error(frozen_error_class)
end
end
end
diff --git a/spec/ruby/core/kernel/fail_spec.rb b/spec/ruby/core/kernel/fail_spec.rb
index a5948cefae..fab622037e 100644
--- a/spec/ruby/core/kernel/fail_spec.rb
+++ b/spec/ruby/core/kernel/fail_spec.rb
@@ -7,7 +7,7 @@ describe "Kernel#fail" do
end
it "raises a RuntimeError" do
- lambda { fail }.should raise_error(RuntimeError)
+ -> { fail }.should raise_error(RuntimeError)
end
it "accepts an Object with an exception method returning an Exception" do
@@ -15,16 +15,16 @@ describe "Kernel#fail" do
def obj.exception(msg)
StandardError.new msg
end
- lambda { fail obj, "..." }.should raise_error(StandardError, "...")
+ -> { fail obj, "..." }.should raise_error(StandardError, "...")
end
it "instantiates the specified exception class" do
error_class = Class.new(RuntimeError)
- lambda { fail error_class }.should raise_error(error_class)
+ -> { fail error_class }.should raise_error(error_class)
end
it "uses the specified message" do
- lambda {
+ -> {
begin
fail "the duck is not irish."
rescue => e
diff --git a/spec/ruby/core/kernel/fixtures/classes.rb b/spec/ruby/core/kernel/fixtures/classes.rb
index 1f45bbb083..2909a621a9 100644
--- a/spec/ruby/core/kernel/fixtures/classes.rb
+++ b/spec/ruby/core/kernel/fixtures/classes.rb
@@ -328,7 +328,7 @@ module KernelSpecs
def inner
b = mp { return :good }
- pr = lambda { |x| x.call }
+ pr = -> x { x.call }
pr.call(b)
@@ -424,6 +424,20 @@ module KernelSpecs
def f2_call_lineno; method(:f3).source_location[1] + 1; end
def f3_call_lineno; method(:f4).source_location[1] + 1; end
end
+
+ CustomRangeInteger = Struct.new(:value) do
+ def to_int; value; end
+ def <=>(other); to_int <=> other.to_int; end
+ def -(other); self.class.new(to_int - other.to_int); end
+ def +(other); self.class.new(to_int + other.to_int); end
+ end
+
+ CustomRangeFloat = Struct.new(:value) do
+ def to_f; value; end
+ def <=>(other); to_f <=> other.to_f; end
+ def -(other); to_f - other.to_f; end
+ def +(other); self.class.new(to_f + other.to_f); end
+ end
end
class EvalSpecs
@@ -454,12 +468,3 @@ class EvalSpecs
return f
end
end
-
-# for Kernel#sleep to have Channel in it's specs
-# TODO: switch directly to queue for both Kernel#sleep and Thread specs?
-unless defined? Channel
- require 'thread'
- class Channel < Queue
- alias receive shift
- end
-end
diff --git a/spec/ruby/core/kernel/fixtures/eval_return_with_lambda.rb b/spec/ruby/core/kernel/fixtures/eval_return_with_lambda.rb
index a48b5685f3..9e2d045bf3 100644
--- a/spec/ruby/core/kernel/fixtures/eval_return_with_lambda.rb
+++ b/spec/ruby/core/kernel/fixtures/eval_return_with_lambda.rb
@@ -1,5 +1,5 @@
print "a,"
-x = lambda do
+x = -> do
print "b,"
Proc.new do
print "c,"
diff --git a/spec/ruby/core/kernel/freeze_spec.rb b/spec/ruby/core/kernel/freeze_spec.rb
index 018784a4f5..214b619f9f 100644
--- a/spec/ruby/core/kernel/freeze_spec.rb
+++ b/spec/ruby/core/kernel/freeze_spec.rb
@@ -74,12 +74,12 @@ describe "Kernel#freeze" do
def mutate; @foo = 1; end
end.new
o.freeze
- lambda {o.mutate}.should raise_error(RuntimeError)
+ -> {o.mutate}.should raise_error(RuntimeError)
end
it "causes instance_variable_set to raise RuntimeError" do
o = Object.new
o.freeze
- lambda {o.instance_variable_set(:@foo, 1)}.should raise_error(RuntimeError)
+ -> {o.instance_variable_set(:@foo, 1)}.should raise_error(RuntimeError)
end
end
diff --git a/spec/ruby/core/kernel/gsub_spec.rb b/spec/ruby/core/kernel/gsub_spec.rb
index 2bcb29f60e..a0cb9f2a70 100644
--- a/spec/ruby/core/kernel/gsub_spec.rb
+++ b/spec/ruby/core/kernel/gsub_spec.rb
@@ -10,7 +10,7 @@ ruby_version_is ""..."1.9" do
end
it "raises a TypeError if $_ is not a String" do
- lambda {
+ -> {
$_ = 123
gsub(/./, "!")
}.should raise_error(TypeError)
diff --git a/spec/ruby/core/kernel/instance_of_spec.rb b/spec/ruby/core/kernel/instance_of_spec.rb
index 78cddb443f..40e856b0d9 100644
--- a/spec/ruby/core/kernel/instance_of_spec.rb
+++ b/spec/ruby/core/kernel/instance_of_spec.rb
@@ -33,8 +33,8 @@ describe Kernel, "#instance_of?" do
end
it "raises a TypeError if given an object that is not a Class nor a Module" do
- lambda { @o.instance_of?(Object.new) }.should raise_error(TypeError)
- lambda { @o.instance_of?('KernelSpecs::InstanceClass') }.should raise_error(TypeError)
- lambda { @o.instance_of?(1) }.should raise_error(TypeError)
+ -> { @o.instance_of?(Object.new) }.should raise_error(TypeError)
+ -> { @o.instance_of?('KernelSpecs::InstanceClass') }.should raise_error(TypeError)
+ -> { @o.instance_of?(1) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/kernel/instance_variable_defined_spec.rb b/spec/ruby/core/kernel/instance_variable_defined_spec.rb
index 99f5e90b4d..2ebb582b43 100644
--- a/spec/ruby/core/kernel/instance_variable_defined_spec.rb
+++ b/spec/ruby/core/kernel/instance_variable_defined_spec.rb
@@ -27,7 +27,7 @@ describe "Kernel#instance_variable_defined?" do
end
it "raises a TypeError if passed an Object not defining #to_str" do
- lambda do
+ -> do
obj = mock("kernel instance_variable_defined?")
@instance.instance_variable_defined? obj
end.should raise_error(TypeError)
diff --git a/spec/ruby/core/kernel/instance_variable_get_spec.rb b/spec/ruby/core/kernel/instance_variable_get_spec.rb
index 918abd8f5c..84d3188f07 100644
--- a/spec/ruby/core/kernel/instance_variable_get_spec.rb
+++ b/spec/ruby/core/kernel/instance_variable_get_spec.rb
@@ -24,25 +24,25 @@ describe "Kernel#instance_variable_get" do
end
it "raises a TypeError when the passed argument does not respond to #to_str" do
- lambda { @obj.instance_variable_get(Object.new) }.should raise_error(TypeError)
+ -> { @obj.instance_variable_get(Object.new) }.should raise_error(TypeError)
end
it "raises a TypeError when the passed argument can't be converted to a String" do
obj = mock("to_str")
obj.stub!(:to_str).and_return(123)
- lambda { @obj.instance_variable_get(obj) }.should raise_error(TypeError)
+ -> { @obj.instance_variable_get(obj) }.should raise_error(TypeError)
end
it "raises a NameError when the conversion result does not start with an '@'" do
obj = mock("to_str")
obj.stub!(:to_str).and_return("test")
- lambda { @obj.instance_variable_get(obj) }.should raise_error(NameError)
+ -> { @obj.instance_variable_get(obj) }.should raise_error(NameError)
end
it "raises a NameError when passed just '@'" do
obj = mock("to_str")
obj.stub!(:to_str).and_return('@')
- lambda { @obj.instance_variable_get(obj) }.should raise_error(NameError)
+ -> { @obj.instance_variable_get(obj) }.should raise_error(NameError)
end
end
@@ -57,15 +57,15 @@ describe "Kernel#instance_variable_get when passed Symbol" do
end
it "raises a NameError when passed :@ as an instance variable name" do
- lambda { @obj.instance_variable_get(:"@") }.should raise_error(NameError)
+ -> { @obj.instance_variable_get(:"@") }.should raise_error(NameError)
end
it "raises a NameError when the passed Symbol does not start with an '@'" do
- lambda { @obj.instance_variable_get(:test) }.should raise_error(NameError)
+ -> { @obj.instance_variable_get(:test) }.should raise_error(NameError)
end
it "raises a NameError when the passed Symbol is an invalid instance variable name" do
- lambda { @obj.instance_variable_get(:"@0") }.should raise_error(NameError)
+ -> { @obj.instance_variable_get(:"@0") }.should raise_error(NameError)
end
end
@@ -80,15 +80,15 @@ describe "Kernel#instance_variable_get when passed String" do
end
it "raises a NameError when the passed String does not start with an '@'" do
- lambda { @obj.instance_variable_get("test") }.should raise_error(NameError)
+ -> { @obj.instance_variable_get("test") }.should raise_error(NameError)
end
it "raises a NameError when the passed String is an invalid instance variable name" do
- lambda { @obj.instance_variable_get("@0") }.should raise_error(NameError)
+ -> { @obj.instance_variable_get("@0") }.should raise_error(NameError)
end
it "raises a NameError when passed '@' as an instance variable name" do
- lambda { @obj.instance_variable_get("@") }.should raise_error(NameError)
+ -> { @obj.instance_variable_get("@") }.should raise_error(NameError)
end
end
@@ -99,7 +99,7 @@ describe "Kernel#instance_variable_get when passed Fixnum" do
end
it "raises a TypeError" do
- lambda { @obj.instance_variable_get(10) }.should raise_error(TypeError)
- lambda { @obj.instance_variable_get(-10) }.should raise_error(TypeError)
+ -> { @obj.instance_variable_get(10) }.should raise_error(TypeError)
+ -> { @obj.instance_variable_get(-10) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/kernel/instance_variable_set_spec.rb b/spec/ruby/core/kernel/instance_variable_set_spec.rb
index 6d84015f50..c5a4085530 100644
--- a/spec/ruby/core/kernel/instance_variable_set_spec.rb
+++ b/spec/ruby/core/kernel/instance_variable_set_spec.rb
@@ -18,26 +18,26 @@ describe "Kernel#instance_variable_set" do
it "raises a NameError exception if the argument is not of form '@x'" do
no_dog = Class.new
- lambda { no_dog.new.instance_variable_set(:c, "cat") }.should raise_error(NameError)
+ -> { no_dog.new.instance_variable_set(:c, "cat") }.should raise_error(NameError)
end
it "raises a NameError exception if the argument is an invalid instance variable name" do
digit_dog = Class.new
- lambda { digit_dog.new.instance_variable_set(:"@0", "cat") }.should raise_error(NameError)
+ -> { digit_dog.new.instance_variable_set(:"@0", "cat") }.should raise_error(NameError)
end
it "raises a NameError when the argument is '@'" do
dog_at = Class.new
- lambda { dog_at.new.instance_variable_set(:"@", "cat") }.should raise_error(NameError)
+ -> { dog_at.new.instance_variable_set(:"@", "cat") }.should raise_error(NameError)
end
it "raises a TypeError if the instance variable name is a Fixnum" do
- lambda { "".instance_variable_set(1, 2) }.should raise_error(TypeError)
+ -> { "".instance_variable_set(1, 2) }.should raise_error(TypeError)
end
it "raises a TypeError if the instance variable name is an object that does not respond to to_str" do
class KernelSpecs::A; end
- lambda { "".instance_variable_set(KernelSpecs::A.new, 3) }.should raise_error(TypeError)
+ -> { "".instance_variable_set(KernelSpecs::A.new, 3) }.should raise_error(TypeError)
end
it "raises a NameError if the passed object, when coerced with to_str, does not start with @" do
@@ -46,11 +46,11 @@ describe "Kernel#instance_variable_set" do
":c"
end
end
- lambda { "".instance_variable_set(KernelSpecs::B.new, 4) }.should raise_error(NameError)
+ -> { "".instance_variable_set(KernelSpecs::B.new, 4) }.should raise_error(NameError)
end
it "raises a NameError if pass an object that cannot be a symbol" do
- lambda { "".instance_variable_set(:c, 1) }.should raise_error(NameError)
+ -> { "".instance_variable_set(:c, 1) }.should raise_error(NameError)
end
it "accepts as instance variable name any instance of a class that responds to to_str" do
@@ -78,16 +78,16 @@ describe "Kernel#instance_variable_set" do
end
it "keeps stored object after any exceptions" do
- lambda { @frozen.instance_variable_set(:@ivar, :replacement) }.should raise_error(Exception)
+ -> { @frozen.instance_variable_set(:@ivar, :replacement) }.should raise_error(Exception)
@frozen.ivar.should equal(:origin)
end
it "raises a #{frozen_error_class} when passed replacement is identical to stored object" do
- lambda { @frozen.instance_variable_set(:@ivar, :origin) }.should raise_error(frozen_error_class)
+ -> { @frozen.instance_variable_set(:@ivar, :origin) }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} when passed replacement is different from stored object" do
- lambda { @frozen.instance_variable_set(:@ivar, :replacement) }.should raise_error(frozen_error_class)
+ -> { @frozen.instance_variable_set(:@ivar, :replacement) }.should raise_error(frozen_error_class)
end
end
end
diff --git a/spec/ruby/core/kernel/instance_variables_spec.rb b/spec/ruby/core/kernel/instance_variables_spec.rb
index bf17b88c2f..b6d6e27772 100644
--- a/spec/ruby/core/kernel/instance_variables_spec.rb
+++ b/spec/ruby/core/kernel/instance_variables_spec.rb
@@ -9,7 +9,7 @@ describe "Kernel#instance_variables" do
it "returns the correct array if an instance variable is added" do
a = 0
- lambda{ a.instance_variable_set("@test", 1) }.should raise_error(RuntimeError)
+ ->{ a.instance_variable_set("@test", 1) }.should raise_error(RuntimeError)
end
end
diff --git a/spec/ruby/core/kernel/loop_spec.rb b/spec/ruby/core/kernel/loop_spec.rb
index 3386326a13..7c76c7d28e 100644
--- a/spec/ruby/core/kernel/loop_spec.rb
+++ b/spec/ruby/core/kernel/loop_spec.rb
@@ -55,7 +55,7 @@ describe "Kernel.loop" do
end
it "does not rescue other errors" do
- lambda{ loop do raise StandardError end }.should raise_error( StandardError )
+ ->{ loop do raise StandardError end }.should raise_error( StandardError )
end
it "returns StopIteration#result, the result value of a finished iterator" do
diff --git a/spec/ruby/core/kernel/open_spec.rb b/spec/ruby/core/kernel/open_spec.rb
index 3a9f5ea2d5..981b5291b3 100644
--- a/spec/ruby/core/kernel/open_spec.rb
+++ b/spec/ruby/core/kernel/open_spec.rb
@@ -70,7 +70,7 @@ describe "Kernel#open" do
end
it "raises an ArgumentError if not passed one argument" do
- lambda { open }.should raise_error(ArgumentError)
+ -> { open }.should raise_error(ArgumentError)
end
describe "when given an object that responds to to_open" do
@@ -129,9 +129,9 @@ describe "Kernel#open" do
it "raises a TypeError if passed a non-String that does not respond to #to_open" do
obj = mock('non-fileish')
- lambda { open(obj) }.should raise_error(TypeError)
- lambda { open(nil) }.should raise_error(TypeError)
- lambda { open(7) }.should raise_error(TypeError)
+ -> { open(obj) }.should raise_error(TypeError)
+ -> { open(nil) }.should raise_error(TypeError)
+ -> { open(7) }.should raise_error(TypeError)
end
it "accepts nil for mode and permission" do
diff --git a/spec/ruby/core/kernel/p_spec.rb b/spec/ruby/core/kernel/p_spec.rb
index 1221465243..798bd47b34 100644
--- a/spec/ruby/core/kernel/p_spec.rb
+++ b/spec/ruby/core/kernel/p_spec.rb
@@ -42,10 +42,10 @@ describe "Kernel#p" do
o = mock("Inspector Gadget")
o.should_receive(:inspect).any_number_of_times.and_return "Next time, Gadget, NEXT TIME!"
- lambda { p(o) }.should output("Next time, Gadget, NEXT TIME!\n")
- lambda { p(*[o]) }.should output("Next time, Gadget, NEXT TIME!\n")
- lambda { p(*[o, o]) }.should output("Next time, Gadget, NEXT TIME!\nNext time, Gadget, NEXT TIME!\n")
- lambda { p([o])}.should output("[#{o.inspect}]\n")
+ -> { p(o) }.should output("Next time, Gadget, NEXT TIME!\n")
+ -> { p(*[o]) }.should output("Next time, Gadget, NEXT TIME!\n")
+ -> { p(*[o, o]) }.should output("Next time, Gadget, NEXT TIME!\nNext time, Gadget, NEXT TIME!\n")
+ -> { p([o])}.should output("[#{o.inspect}]\n")
end
it "is not affected by setting $\\, $/ or $," do
@@ -55,21 +55,21 @@ describe "Kernel#p" do
suppress_warning {
$, = " *helicopter sound*\n"
}
- lambda { p(o) }.should output_to_fd("Next time, Gadget, NEXT TIME!\n")
+ -> { p(o) }.should output_to_fd("Next time, Gadget, NEXT TIME!\n")
$\ = " *helicopter sound*\n"
- lambda { p(o) }.should output_to_fd("Next time, Gadget, NEXT TIME!\n")
+ -> { p(o) }.should output_to_fd("Next time, Gadget, NEXT TIME!\n")
$/ = " *helicopter sound*\n"
- lambda { p(o) }.should output_to_fd("Next time, Gadget, NEXT TIME!\n")
+ -> { p(o) }.should output_to_fd("Next time, Gadget, NEXT TIME!\n")
end
it "prints nothing if no argument is given" do
- lambda { p }.should output("")
+ -> { p }.should output("")
end
it "prints nothing if called splatting an empty Array" do
- lambda { p(*[]) }.should output("")
+ -> { p(*[]) }.should output("")
end
=begin Not sure how to spec this, but wanted to note the behavior here
diff --git a/spec/ruby/core/kernel/printf_spec.rb b/spec/ruby/core/kernel/printf_spec.rb
index ca88082694..5d68c0a13c 100644
--- a/spec/ruby/core/kernel/printf_spec.rb
+++ b/spec/ruby/core/kernel/printf_spec.rb
@@ -36,7 +36,7 @@ describe "Kernel.printf" do
describe "formatting" do
context "io is specified" do
- it_behaves_like :kernel_sprintf, -> (format, *args) {
+ it_behaves_like :kernel_sprintf, -> format, *args {
io = StringIO.new
printf(io, format, *args)
io.string
@@ -44,7 +44,7 @@ describe "Kernel.printf" do
end
context "io is not specified" do
- it_behaves_like :kernel_sprintf, -> (format, *args) {
+ it_behaves_like :kernel_sprintf, -> format, *args {
stdout = $stdout
begin
diff --git a/spec/ruby/core/kernel/proc_spec.rb b/spec/ruby/core/kernel/proc_spec.rb
index e3acfa8dfd..ded2cec3fd 100644
--- a/spec/ruby/core/kernel/proc_spec.rb
+++ b/spec/ruby/core/kernel/proc_spec.rb
@@ -15,7 +15,7 @@ describe "Kernel.proc" do
end
it "returned the passed Proc if given an existing Proc" do
- some_lambda = lambda {}
+ some_lambda = -> {}
some_lambda.lambda?.should be_true
l = proc(&some_lambda)
l.should equal(some_lambda)
diff --git a/spec/ruby/core/kernel/public_method_spec.rb b/spec/ruby/core/kernel/public_method_spec.rb
index 72d0c62720..c5d54c777e 100644
--- a/spec/ruby/core/kernel/public_method_spec.rb
+++ b/spec/ruby/core/kernel/public_method_spec.rb
@@ -11,21 +11,21 @@ describe "Kernel#public_method" do
it "raises a NameError when called on a private method" do
@obj.send(:private_method).should == :private_method
- lambda do
+ -> do
@obj.public_method(:private_method)
end.should raise_error(NameError)
end
it "raises a NameError when called on a protected method" do
@obj.send(:protected_method).should == :protected_method
- lambda {
+ -> {
@obj.public_method(:protected_method)
}.should raise_error(NameError)
end
it "raises a NameError if we only repond_to_missing? method, true" do
obj = KernelSpecs::RespondViaMissing.new
- lambda do
+ -> do
obj.public_method(:handled_privately)
end.should raise_error(NameError)
end
diff --git a/spec/ruby/core/kernel/public_send_spec.rb b/spec/ruby/core/kernel/public_send_spec.rb
index 984ab41802..6b942a2e4b 100644
--- a/spec/ruby/core/kernel/public_send_spec.rb
+++ b/spec/ruby/core/kernel/public_send_spec.rb
@@ -29,7 +29,7 @@ describe "Kernel#public_send" do
'done'
end
end
- lambda { KernelSpecs::Foo.new.public_send(:bar)}.should raise_error(NoMethodError)
+ -> { KernelSpecs::Foo.new.public_send(:bar)}.should raise_error(NoMethodError)
end
it "raises a NoMethodError if the named method is private" do
@@ -39,7 +39,7 @@ describe "Kernel#public_send" do
'done2'
end
end
- lambda {
+ -> {
KernelSpecs::Foo.new.public_send(:bar)
}.should raise_error(NoMethodError)
end
@@ -70,11 +70,11 @@ describe "Kernel#public_send" do
end
it "raises a NoMethodError if the method is protected" do
- lambda { @receiver.call_protected_method }.should raise_error(NoMethodError)
+ -> { @receiver.call_protected_method }.should raise_error(NoMethodError)
end
it "raises a NoMethodError if the method is private" do
- lambda { @receiver.call_private_method }.should raise_error(NoMethodError)
+ -> { @receiver.call_private_method }.should raise_error(NoMethodError)
end
end
@@ -86,7 +86,7 @@ describe "Kernel#public_send" do
end
alias :aka :bar
end
- lambda {
+ -> {
KernelSpecs::Foo.new.public_send(:aka)
}.should raise_error(NoMethodError)
end
@@ -99,7 +99,7 @@ describe "Kernel#public_send" do
end
alias :aka :bar
end
- lambda {
+ -> {
KernelSpecs::Foo.new.public_send(:aka)
}.should raise_error(NoMethodError)
end
diff --git a/spec/ruby/core/kernel/rand_spec.rb b/spec/ruby/core/kernel/rand_spec.rb
index bdf5842f1a..843b5d10a2 100644
--- a/spec/ruby/core/kernel/rand_spec.rb
+++ b/spec/ruby/core/kernel/rand_spec.rb
@@ -132,6 +132,12 @@ describe "Kernel.rand" do
it "returns the range start/end when Integer range is 0" do
rand(42..42).should eql(42)
end
+
+ it "supports custom object types" do
+ rand(KernelSpecs::CustomRangeInteger.new(1)..KernelSpecs::CustomRangeInteger.new(42)).should be_an_instance_of(KernelSpecs::CustomRangeInteger)
+ rand(KernelSpecs::CustomRangeFloat.new(1.0)..KernelSpecs::CustomRangeFloat.new(42.0)).should be_an_instance_of(KernelSpecs::CustomRangeFloat)
+ rand(Time.now..Time.now).should be_an_instance_of(Time)
+ end
end
describe "Kernel#rand" do
diff --git a/spec/ruby/core/kernel/remove_instance_variable_spec.rb b/spec/ruby/core/kernel/remove_instance_variable_spec.rb
index 5022a70c1d..e90efc8aed 100644
--- a/spec/ruby/core/kernel/remove_instance_variable_spec.rb
+++ b/spec/ruby/core/kernel/remove_instance_variable_spec.rb
@@ -23,19 +23,19 @@ describe "Kernel#remove_instance_variable" do
end
it "raises a NameError if the instance variable is not defined" do
- lambda do
+ -> do
@instance.send :remove_instance_variable, :@unknown
end.should raise_error(NameError)
end
it "raises a NameError if the argument is not a valid instance variable name" do
- lambda do
+ -> do
@instance.send :remove_instance_variable, :"@0"
end.should raise_error(NameError)
end
it "raises a TypeError if passed an Object not defining #to_str" do
- lambda do
+ -> do
obj = mock("kernel remove_instance_variable")
@instance.send :remove_instance_variable, obj
end.should raise_error(TypeError)
diff --git a/spec/ruby/core/kernel/require_relative_spec.rb b/spec/ruby/core/kernel/require_relative_spec.rb
index 6604d30ab1..b292a46c63 100644
--- a/spec/ruby/core/kernel/require_relative_spec.rb
+++ b/spec/ruby/core/kernel/require_relative_spec.rb
@@ -86,18 +86,18 @@ describe "Kernel#require_relative with a relative path" do
end
it "raises a LoadError if the file does not exist" do
- lambda { require_relative("#{@dir}/nonexistent.rb") }.should raise_error(LoadError)
+ -> { require_relative("#{@dir}/nonexistent.rb") }.should raise_error(LoadError)
ScratchPad.recorded.should == []
end
it "raises a LoadError if basepath does not exist" do
- lambda { eval("require_relative('#{@dir}/nonexistent.rb')") }.should raise_error(LoadError)
+ -> { eval("require_relative('#{@dir}/nonexistent.rb')") }.should raise_error(LoadError)
end
it "stores the missing path in a LoadError object" do
path = "#{@dir}/nonexistent.rb"
- lambda {
+ -> {
require_relative(path)
}.should(raise_error(LoadError) { |e|
e.path.should == File.expand_path(path, @abs_dir)
@@ -112,9 +112,9 @@ describe "Kernel#require_relative with a relative path" do
end
it "raises a TypeError if argument does not respond to #to_str" do
- lambda { require_relative(nil) }.should raise_error(TypeError)
- lambda { require_relative(42) }.should raise_error(TypeError)
- lambda {
+ -> { require_relative(nil) }.should raise_error(TypeError)
+ -> { require_relative(42) }.should raise_error(TypeError)
+ -> {
require_relative([@path,@path])
}.should raise_error(TypeError)
end
@@ -122,13 +122,13 @@ describe "Kernel#require_relative with a relative path" do
it "raises a TypeError if passed an object that has #to_s but not #to_str" do
name = mock("load_fixture.rb mock")
name.stub!(:to_s).and_return(@path)
- lambda { require_relative(name) }.should raise_error(TypeError)
+ -> { require_relative(name) }.should raise_error(TypeError)
end
it "raises a TypeError if #to_str does not return a String" do
name = mock("#to_str returns nil")
name.should_receive(:to_str).at_least(1).times.and_return(nil)
- lambda { require_relative(name) }.should raise_error(TypeError)
+ -> { require_relative(name) }.should raise_error(TypeError)
end
it "calls #to_path on non-String objects" do
@@ -239,7 +239,7 @@ describe "Kernel#require_relative with a relative path" do
it "does not store the path if the load fails" do
saved_loaded_features = $LOADED_FEATURES.dup
- lambda { require_relative("#{@dir}/raise_fixture.rb") }.should raise_error(RuntimeError)
+ -> { require_relative("#{@dir}/raise_fixture.rb") }.should raise_error(RuntimeError)
$LOADED_FEATURES.should == saved_loaded_features
end
@@ -288,18 +288,18 @@ describe "Kernel#require_relative with an absolute path" do
end
it "raises a LoadError if the file does not exist" do
- lambda { require_relative("#{@dir}/nonexistent.rb") }.should raise_error(LoadError)
+ -> { require_relative("#{@dir}/nonexistent.rb") }.should raise_error(LoadError)
ScratchPad.recorded.should == []
end
it "raises a LoadError if basepath does not exist" do
- lambda { eval("require_relative('#{@dir}/nonexistent.rb')") }.should raise_error(LoadError)
+ -> { eval("require_relative('#{@dir}/nonexistent.rb')") }.should raise_error(LoadError)
end
it "stores the missing path in a LoadError object" do
path = "#{@dir}/nonexistent.rb"
- lambda {
+ -> {
require_relative(path)
}.should(raise_error(LoadError) { |e|
e.path.should == File.expand_path(path, @abs_dir)
@@ -314,9 +314,9 @@ describe "Kernel#require_relative with an absolute path" do
end
it "raises a TypeError if argument does not respond to #to_str" do
- lambda { require_relative(nil) }.should raise_error(TypeError)
- lambda { require_relative(42) }.should raise_error(TypeError)
- lambda {
+ -> { require_relative(nil) }.should raise_error(TypeError)
+ -> { require_relative(42) }.should raise_error(TypeError)
+ -> {
require_relative([@path,@path])
}.should raise_error(TypeError)
end
@@ -324,13 +324,13 @@ describe "Kernel#require_relative with an absolute path" do
it "raises a TypeError if passed an object that has #to_s but not #to_str" do
name = mock("load_fixture.rb mock")
name.stub!(:to_s).and_return(@path)
- lambda { require_relative(name) }.should raise_error(TypeError)
+ -> { require_relative(name) }.should raise_error(TypeError)
end
it "raises a TypeError if #to_str does not return a String" do
name = mock("#to_str returns nil")
name.should_receive(:to_str).at_least(1).times.and_return(nil)
- lambda { require_relative(name) }.should raise_error(TypeError)
+ -> { require_relative(name) }.should raise_error(TypeError)
end
it "calls #to_path on non-String objects" do
@@ -401,7 +401,7 @@ describe "Kernel#require_relative with an absolute path" do
it "does not store the path if the load fails" do
saved_loaded_features = $LOADED_FEATURES.dup
- lambda { require_relative("#{@dir}/raise_fixture.rb") }.should raise_error(RuntimeError)
+ -> { require_relative("#{@dir}/raise_fixture.rb") }.should raise_error(RuntimeError)
$LOADED_FEATURES.should == saved_loaded_features
end
diff --git a/spec/ruby/core/kernel/respond_to_spec.rb b/spec/ruby/core/kernel/respond_to_spec.rb
index 80487421d7..e7efc9f275 100644
--- a/spec/ruby/core/kernel/respond_to_spec.rb
+++ b/spec/ruby/core/kernel/respond_to_spec.rb
@@ -25,7 +25,7 @@ describe "Kernel#respond_to?" do
end
it "throws a type error if argument can't be coerced into a Symbol" do
- lambda { @a.respond_to?(Object.new) }.should raise_error(TypeError)
+ -> { @a.respond_to?(Object.new) }.should raise_error(TypeError)
end
it "returns false if obj responds to the given protected method" do
@@ -61,7 +61,7 @@ describe "Kernel#respond_to?" do
it "does not change method visibility when finding private method" do
KernelSpecs::VisibilityChange.respond_to?(:new, false).should == false
KernelSpecs::VisibilityChange.respond_to?(:new, true).should == true
- lambda { KernelSpecs::VisibilityChange.new }.should raise_error(NoMethodError)
+ -> { KernelSpecs::VisibilityChange.new }.should raise_error(NoMethodError)
end
it "indicates if an object responds to a particular message" do
diff --git a/spec/ruby/core/kernel/shared/dup_clone.rb b/spec/ruby/core/kernel/shared/dup_clone.rb
index 37890f2981..d1ee64bd09 100644
--- a/spec/ruby/core/kernel/shared/dup_clone.rb
+++ b/spec/ruby/core/kernel/shared/dup_clone.rb
@@ -102,12 +102,12 @@ describe :kernel_dup_clone, shared: true do
ruby_version_is ''...'2.5' do
it "raises a TypeError for Complex" do
c = Complex(1.3, 3.1)
- lambda { c.send(@method) }.should raise_error(TypeError)
+ -> { c.send(@method) }.should raise_error(TypeError)
end
it "raises a TypeError for Rational" do
r = Rational(1, 3)
- lambda { r.send(@method) }.should raise_error(TypeError)
+ -> { r.send(@method) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/kernel/shared/kind_of.rb b/spec/ruby/core/kernel/shared/kind_of.rb
index 0614c02214..aef6f1c1d8 100644
--- a/spec/ruby/core/kernel/shared/kind_of.rb
+++ b/spec/ruby/core/kernel/shared/kind_of.rb
@@ -40,10 +40,10 @@ describe :kernel_kind_of, shared: true do
end
it "raises a TypeError if given an object that is not a Class nor a Module" do
- lambda { @o.send(@method, 1) }.should raise_error(TypeError)
- lambda { @o.send(@method, 'KindaClass') }.should raise_error(TypeError)
- lambda { @o.send(@method, :KindaClass) }.should raise_error(TypeError)
- lambda { @o.send(@method, Object.new) }.should raise_error(TypeError)
+ -> { @o.send(@method, 1) }.should raise_error(TypeError)
+ -> { @o.send(@method, 'KindaClass') }.should raise_error(TypeError)
+ -> { @o.send(@method, :KindaClass) }.should raise_error(TypeError)
+ -> { @o.send(@method, Object.new) }.should raise_error(TypeError)
end
it "does not take into account `class` method overriding" do
diff --git a/spec/ruby/core/kernel/shared/lambda.rb b/spec/ruby/core/kernel/shared/lambda.rb
index bebb111c43..c7180e1442 100644
--- a/spec/ruby/core/kernel/shared/lambda.rb
+++ b/spec/ruby/core/kernel/shared/lambda.rb
@@ -4,6 +4,6 @@ describe :kernel_lambda, shared: true do
end
it "raises an ArgumentError when no block is given" do
- lambda { send(@method) }.should raise_error(ArgumentError)
+ -> { send(@method) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/kernel/shared/load.rb b/spec/ruby/core/kernel/shared/load.rb
index b479b29399..14bf5f27da 100644
--- a/spec/ruby/core/kernel/shared/load.rb
+++ b/spec/ruby/core/kernel/shared/load.rb
@@ -81,7 +81,7 @@ describe :kernel_load, shared: true do
it "raises a LoadError if passed a non-extensioned path that does not exist but a .rb extensioned path does exist" do
path = File.expand_path "load_ext_fixture", CODE_LOADING_DIR
- lambda { @object.load(path) }.should raise_error(LoadError)
+ -> { @object.load(path) }.should raise_error(LoadError)
end
describe "when passed true for 'wrap'" do
@@ -115,7 +115,7 @@ describe :kernel_load, shared: true do
end
it "does not pollute the receiver" do
- lambda { @object.send(:top_level_method) }.should raise_error(NameError)
+ -> { @object.send(:top_level_method) }.should raise_error(NameError)
end
end
end
diff --git a/spec/ruby/core/kernel/shared/method.rb b/spec/ruby/core/kernel/shared/method.rb
index 006ebbffb8..3418966b1b 100644
--- a/spec/ruby/core/kernel/shared/method.rb
+++ b/spec/ruby/core/kernel/shared/method.rb
@@ -23,14 +23,14 @@ describe :kernel_method, shared: true do
it "raises a NameError for an invalid method name" do
class KernelSpecs::Foo; def bar; 'done'; end; end
- lambda {
+ -> {
KernelSpecs::Foo.new.send(@method, :invalid_and_silly_method_name)
}.should raise_error(NameError)
end
it "raises a NameError for an invalid singleton method name" do
class KernelSpecs::Foo; def self.bar; 'done'; end; end
- lambda { KernelSpecs::Foo.send(@method, :baz) }.should raise_error(NameError)
+ -> { KernelSpecs::Foo.send(@method, :baz) }.should raise_error(NameError)
end
it "changes the method called for super on a target aliased method" do
diff --git a/spec/ruby/core/kernel/shared/require.rb b/spec/ruby/core/kernel/shared/require.rb
index 56377684fb..af0d50db4f 100644
--- a/spec/ruby/core/kernel/shared/require.rb
+++ b/spec/ruby/core/kernel/shared/require.rb
@@ -21,7 +21,7 @@ describe :kernel_require_basic, shared: true do
it "raises a LoadError if the file does not exist" do
path = File.expand_path "nonexistent.rb", CODE_LOADING_DIR
File.exist?(path).should be_false
- lambda { @object.send(@method, path) }.should raise_error(LoadError)
+ -> { @object.send(@method, path) }.should raise_error(LoadError)
ScratchPad.recorded.should == []
end
@@ -42,7 +42,7 @@ describe :kernel_require_basic, shared: true do
it "raises a LoadError" do
File.exist?(@path).should be_true
- lambda { @object.send(@method, @path) }.should raise_error(LoadError)
+ -> { @object.send(@method, @path) }.should raise_error(LoadError)
end
end
end
@@ -57,19 +57,19 @@ describe :kernel_require_basic, shared: true do
end
it "raises a TypeError if passed nil" do
- lambda { @object.send(@method, nil) }.should raise_error(TypeError)
+ -> { @object.send(@method, nil) }.should raise_error(TypeError)
end
it "raises a TypeError if passed a Fixnum" do
- lambda { @object.send(@method, 42) }.should raise_error(TypeError)
+ -> { @object.send(@method, 42) }.should raise_error(TypeError)
end
it "raises a TypeError if passed an Array" do
- lambda { @object.send(@method, []) }.should raise_error(TypeError)
+ -> { @object.send(@method, []) }.should raise_error(TypeError)
end
it "raises a TypeError if passed an object that does not provide #to_str" do
- lambda { @object.send(@method, mock("not a filename")) }.should raise_error(TypeError)
+ -> { @object.send(@method, mock("not a filename")) }.should raise_error(TypeError)
end
it "raises a TypeError if passed an object that has #to_s but not #to_str" do
@@ -77,14 +77,14 @@ describe :kernel_require_basic, shared: true do
name.stub!(:to_s).and_return("load_fixture.rb")
$LOAD_PATH << "."
Dir.chdir CODE_LOADING_DIR do
- lambda { @object.send(@method, name) }.should raise_error(TypeError)
+ -> { @object.send(@method, name) }.should raise_error(TypeError)
end
end
it "raises a TypeError if #to_str does not return a String" do
name = mock("#to_str returns nil")
name.should_receive(:to_str).at_least(1).times.and_return(nil)
- lambda { @object.send(@method, name) }.should raise_error(TypeError)
+ -> { @object.send(@method, name) }.should raise_error(TypeError)
end
it "calls #to_path on non-String objects" do
@@ -170,7 +170,7 @@ describe :kernel_require_basic, shared: true do
it "does not resolve a ./ relative path against $LOAD_PATH entries" do
$LOAD_PATH << CODE_LOADING_DIR
- lambda do
+ -> do
@object.send(@method, "./load_fixture.rb")
end.should raise_error(LoadError)
ScratchPad.recorded.should == []
@@ -178,7 +178,7 @@ describe :kernel_require_basic, shared: true do
it "does not resolve a ../ relative path against $LOAD_PATH entries" do
$LOAD_PATH << CODE_LOADING_DIR
- lambda do
+ -> do
@object.send(@method, "../code/load_fixture.rb")
end.should raise_error(LoadError)
ScratchPad.recorded.should == []
@@ -208,14 +208,14 @@ describe :kernel_require, shared: true do
# intentional for security reasons.
it "does not load a bare filename unless the current working directory is in $LOAD_PATH" do
Dir.chdir CODE_LOADING_DIR do
- lambda { @object.require("load_fixture.rb") }.should raise_error(LoadError)
+ -> { @object.require("load_fixture.rb") }.should raise_error(LoadError)
ScratchPad.recorded.should == []
end
end
it "does not load a relative path unless the current working directory is in $LOAD_PATH" do
Dir.chdir File.dirname(CODE_LOADING_DIR) do
- lambda do
+ -> do
@object.require("code/load_fixture.rb")
end.should raise_error(LoadError)
ScratchPad.recorded.should == []
@@ -381,7 +381,7 @@ describe :kernel_require, shared: true do
it "does not store the path if the load fails" do
$LOAD_PATH << CODE_LOADING_DIR
saved_loaded_features = $LOADED_FEATURES.dup
- lambda { @object.require("raise_fixture.rb") }.should raise_error(RuntimeError)
+ -> { @object.require("raise_fixture.rb") }.should raise_error(RuntimeError)
$LOADED_FEATURES.should == saved_loaded_features
end
@@ -683,7 +683,7 @@ describe :kernel_require, shared: true do
Thread.current[:wait_for] = t2
Thread.current[:con_raise] = true
- lambda {
+ -> {
@object.require(@path)
}.should raise_error(RuntimeError)
@@ -724,7 +724,7 @@ describe :kernel_require, shared: true do
t1 = Thread.new do
Thread.current[:con_raise] = true
- lambda {
+ -> {
@object.require(@path)
}.should raise_error(RuntimeError)
@@ -764,7 +764,7 @@ describe :kernel_require, shared: true do
it "stores the missing path in a LoadError object" do
path = "abcd1234"
- lambda {
+ -> {
@object.send(@method, path)
}.should raise_error(LoadError) { |e|
e.path.should == path
diff --git a/spec/ruby/core/kernel/shared/sprintf.rb b/spec/ruby/core/kernel/shared/sprintf.rb
index 925c79e82b..9899684284 100644
--- a/spec/ruby/core/kernel/shared/sprintf.rb
+++ b/spec/ruby/core/kernel/shared/sprintf.rb
@@ -31,7 +31,7 @@ describe :kernel_sprintf, shared: true do
end
it "raises TypeError exception if cannot convert to Integer" do
- -> () {
+ -> {
format("%b", Object.new)
}.should raise_error(TypeError)
end
@@ -120,7 +120,7 @@ describe :kernel_sprintf, shared: true do
end
it "raises TypeError exception if cannot convert to Float" do
- -> () {
+ -> {
format("%f", Object.new)
}.should raise_error(TypeError)
end
@@ -296,13 +296,13 @@ describe :kernel_sprintf, shared: true do
end
it "raises ArgumentError if argument is a string of several characters" do
- -> () {
+ -> {
format("%c", "abc")
}.should raise_error(ArgumentError)
end
it "raises ArgumentError if argument is an empty string" do
- -> () {
+ -> {
format("%c", "")
}.should raise_error(ArgumentError)
end
@@ -338,7 +338,7 @@ describe :kernel_sprintf, shared: true do
"abc"
end
- -> () {
+ -> {
format("%s", obj)
}.should raise_error(NoMethodError)
end
@@ -461,7 +461,7 @@ describe :kernel_sprintf, shared: true do
end
it "raises exception if argument number is bigger than actual arguments list" do
- -> () {
+ -> {
format("%4$d", 1, 2, 3)
}.should raise_error(ArgumentError)
end
@@ -472,7 +472,7 @@ describe :kernel_sprintf, shared: true do
end
it "raises ArgumentError exception when absolute and relative argument numbers are mixed" do
- -> () {
+ -> {
format("%1$d %d", 1, 2)
}.should raise_error(ArgumentError)
end
@@ -722,7 +722,7 @@ describe :kernel_sprintf, shared: true do
end
it "raises ArgumentError when is mixed with width" do
- -> () {
+ -> {
format("%*10d", 10, 112)
}.should raise_error(ArgumentError)
end
@@ -821,7 +821,7 @@ describe :kernel_sprintf, shared: true do
end
it "cannot be mixed with unnamed style" do
- -> () {
+ -> {
format("%d %<foo>d", 1, foo: "123")
}.should raise_error(ArgumentError)
end
@@ -841,13 +841,13 @@ describe :kernel_sprintf, shared: true do
end
it "cannot be mixed with unnamed style" do
- -> () {
+ -> {
format("%d %{foo}", 1, foo: "123")
}.should raise_error(ArgumentError)
end
it "raises KeyError when there is no matching key" do
- -> () {
+ -> {
format("%{foo}", {})
}.should raise_error(KeyError)
end
@@ -870,7 +870,7 @@ describe :kernel_sprintf, shared: true do
@base_method = @method
end
- it_behaves_like :key_error, -> (obj, key) {
+ it_behaves_like :key_error, -> obj, key {
@base_method.call("%<#{key}>s", obj)
}, { foooo: 1 }
end
diff --git a/spec/ruby/core/kernel/shared/sprintf_encoding.rb b/spec/ruby/core/kernel/shared/sprintf_encoding.rb
index a92f3c10cd..c3d62bf3bb 100644
--- a/spec/ruby/core/kernel/shared/sprintf_encoding.rb
+++ b/spec/ruby/core/kernel/shared/sprintf_encoding.rb
@@ -21,7 +21,7 @@ describe :kernel_sprintf_encoding, shared: true do
string = "Ä %s".encode('windows-1252')
argument = "Ђ".encode('windows-1251')
- -> () {
+ -> {
format(string, argument)
}.should raise_error(Encoding::CompatibilityError)
end
diff --git a/spec/ruby/core/kernel/singleton_class_spec.rb b/spec/ruby/core/kernel/singleton_class_spec.rb
index b5e0703905..5dbb4f8c05 100644
--- a/spec/ruby/core/kernel/singleton_class_spec.rb
+++ b/spec/ruby/core/kernel/singleton_class_spec.rb
@@ -18,10 +18,10 @@ describe "Kernel#singleton_class" do
end
it "raises TypeError for Fixnum" do
- lambda { 123.singleton_class }.should raise_error(TypeError)
+ -> { 123.singleton_class }.should raise_error(TypeError)
end
it "raises TypeError for Symbol" do
- lambda { :foo.singleton_class }.should raise_error(TypeError)
+ -> { :foo.singleton_class }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/kernel/sleep_spec.rb b/spec/ruby/core/kernel/sleep_spec.rb
index a510ae3dc1..387dc4787b 100644
--- a/spec/ruby/core/kernel/sleep_spec.rb
+++ b/spec/ruby/core/kernel/sleep_spec.rb
@@ -23,16 +23,16 @@ describe "Kernel#sleep" do
end
it "raises an ArgumentError when passed a negative duration" do
- lambda { sleep(-0.1) }.should raise_error(ArgumentError)
- lambda { sleep(-1) }.should raise_error(ArgumentError)
+ -> { sleep(-0.1) }.should raise_error(ArgumentError)
+ -> { sleep(-1) }.should raise_error(ArgumentError)
end
it "raises a TypeError when passed nil" do
- lambda { sleep(nil) }.should raise_error(TypeError)
+ -> { sleep(nil) }.should raise_error(TypeError)
end
it "raises a TypeError when passed a String" do
- lambda { sleep('2') }.should raise_error(TypeError)
+ -> { sleep('2') }.should raise_error(TypeError)
end
it "pauses execution indefinitely if not given a duration" do
diff --git a/spec/ruby/core/kernel/spawn_spec.rb b/spec/ruby/core/kernel/spawn_spec.rb
index da3cf39021..ba05b629d5 100644
--- a/spec/ruby/core/kernel/spawn_spec.rb
+++ b/spec/ruby/core/kernel/spawn_spec.rb
@@ -10,7 +10,7 @@ describe "Kernel#spawn" do
end
it "executes the given command" do
- lambda {
+ -> {
Process.wait spawn("echo spawn")
}.should output_to_fd("spawn\n")
end
@@ -18,7 +18,7 @@ end
describe "Kernel.spawn" do
it "executes the given command" do
- lambda {
+ -> {
Process.wait Kernel.spawn("echo spawn")
}.should output_to_fd("spawn\n")
end
diff --git a/spec/ruby/core/kernel/sprintf_spec.rb b/spec/ruby/core/kernel/sprintf_spec.rb
index 4aa8c2351f..7adf71be76 100644
--- a/spec/ruby/core/kernel/sprintf_spec.rb
+++ b/spec/ruby/core/kernel/sprintf_spec.rb
@@ -4,21 +4,21 @@ require_relative 'shared/sprintf'
require_relative 'shared/sprintf_encoding'
describe "Kernel#sprintf" do
- it_behaves_like :kernel_sprintf, -> (format, *args) {
+ it_behaves_like :kernel_sprintf, -> format, *args {
sprintf(format, *args)
}
- it_behaves_like :kernel_sprintf_encoding, -> (format, *args) {
+ it_behaves_like :kernel_sprintf_encoding, -> format, *args {
sprintf(format, *args)
}
end
describe "Kernel.sprintf" do
- it_behaves_like :kernel_sprintf, -> (format, *args) {
+ it_behaves_like :kernel_sprintf, -> format, *args {
Kernel.sprintf(format, *args)
}
- it_behaves_like :kernel_sprintf_encoding, -> (format, *args) {
+ it_behaves_like :kernel_sprintf_encoding, -> format, *args {
Kernel.sprintf(format, *args)
}
end
diff --git a/spec/ruby/core/kernel/srand_spec.rb b/spec/ruby/core/kernel/srand_spec.rb
index 053fb521ef..5454aae8cf 100644
--- a/spec/ruby/core/kernel/srand_spec.rb
+++ b/spec/ruby/core/kernel/srand_spec.rb
@@ -19,7 +19,7 @@ describe "Kernel.srand" do
end
it "defaults number to a random value" do
- lambda { srand }.should_not raise_error
+ -> { srand }.should_not raise_error
srand.should_not == 0
end
@@ -48,11 +48,11 @@ describe "Kernel.srand" do
end
it "raises a TypeError when passed nil" do
- lambda { srand(nil) }.should raise_error(TypeError)
+ -> { srand(nil) }.should raise_error(TypeError)
end
it "raises a TypeError when passed a String" do
- lambda { srand("7") }.should raise_error(TypeError)
+ -> { srand("7") }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/kernel/system_spec.rb b/spec/ruby/core/kernel/system_spec.rb
index 6a4ba6283d..96c0496dd6 100644
--- a/spec/ruby/core/kernel/system_spec.rb
+++ b/spec/ruby/core/kernel/system_spec.rb
@@ -3,7 +3,7 @@ require_relative 'fixtures/classes'
describe :kernel_system, shared: true do
it "executes the specified command in a subprocess" do
- lambda { @object.system("echo a") }.should output_to_fd("a\n")
+ -> { @object.system("echo a") }.should output_to_fd("a\n")
$?.should be_an_instance_of Process::Status
$?.success?.should == true
@@ -27,11 +27,11 @@ describe :kernel_system, shared: true do
ruby_version_is "2.6" do
it "raises RuntimeError when `exception: true` is given and the command exits with a non-zero exit status" do
- lambda { @object.system(ruby_cmd('exit 1'), exception: true) }.should raise_error(RuntimeError)
+ -> { @object.system(ruby_cmd('exit 1'), exception: true) }.should raise_error(RuntimeError)
end
it "raises Errno::ENOENT when `exception: true` is given and the specified command does not exist" do
- lambda { @object.system('feature_14386', exception: true) }.should raise_error(Errno::ENOENT)
+ -> { @object.system('feature_14386', exception: true) }.should raise_error(Errno::ENOENT)
end
end
@@ -44,7 +44,7 @@ describe :kernel_system, shared: true do
end
it "does not write to stderr when command execution fails" do
- lambda { @object.system("sad") }.should output_to_fd("", STDERR)
+ -> { @object.system("sad") }.should output_to_fd("", STDERR)
end
platform_is_not :windows do
@@ -57,12 +57,12 @@ describe :kernel_system, shared: true do
end
it "executes with `sh` if the command contains shell characters" do
- lambda { @object.system("echo $0") }.should output_to_fd("sh\n")
+ -> { @object.system("echo $0") }.should output_to_fd("sh\n")
end
it "ignores SHELL env var and always uses `sh`" do
ENV['SHELL'] = "/bin/fakeshell"
- lambda { @object.system("echo $0") }.should output_to_fd("sh\n")
+ -> { @object.system("echo $0") }.should output_to_fd("sh\n")
end
end
@@ -79,19 +79,19 @@ describe :kernel_system, shared: true do
end
it "expands shell variables when given a single string argument" do
- lambda { @object.system("echo #{@shell_var}") }.should output_to_fd("foo\n")
+ -> { @object.system("echo #{@shell_var}") }.should output_to_fd("foo\n")
end
platform_is_not :windows do
it "does not expand shell variables when given multiples arguments" do
- lambda { @object.system("echo", @shell_var) }.should output_to_fd("#{@shell_var}\n")
+ -> { @object.system("echo", @shell_var) }.should output_to_fd("#{@shell_var}\n")
end
end
platform_is :windows do
it "does expand shell variables when given multiples arguments" do
# See https://bugs.ruby-lang.org/issues/12231
- lambda { @object.system("echo", @shell_var) }.should output_to_fd("foo\n")
+ -> { @object.system("echo", @shell_var) }.should output_to_fd("foo\n")
end
end
diff --git a/spec/ruby/core/kernel/taint_spec.rb b/spec/ruby/core/kernel/taint_spec.rb
index ff1b20f9ca..000295f6d2 100644
--- a/spec/ruby/core/kernel/taint_spec.rb
+++ b/spec/ruby/core/kernel/taint_spec.rb
@@ -15,7 +15,7 @@ describe "Kernel#taint" do
it "raises #{frozen_error_class} on an untainted, frozen object" do
o = Object.new.freeze
- lambda { o.taint }.should raise_error(frozen_error_class)
+ -> { o.taint }.should raise_error(frozen_error_class)
end
it "does not raise an error on a tainted, frozen object" do
@@ -32,13 +32,13 @@ describe "Kernel#taint" do
it "no raises a RuntimeError on symbols" do
v = :sym
- lambda { v.taint }.should_not raise_error(RuntimeError)
+ -> { v.taint }.should_not raise_error(RuntimeError)
v.tainted?.should == false
end
it "no raises error on fixnum values" do
[1].each do |v|
- lambda { v.taint }.should_not raise_error(RuntimeError)
+ -> { v.taint }.should_not raise_error(RuntimeError)
v.tainted?.should == false
end
end
diff --git a/spec/ruby/core/kernel/tap_spec.rb b/spec/ruby/core/kernel/tap_spec.rb
index a7d548847c..f7720a6dc7 100644
--- a/spec/ruby/core/kernel/tap_spec.rb
+++ b/spec/ruby/core/kernel/tap_spec.rb
@@ -8,6 +8,6 @@ describe "Kernel#tap" do
end
it "raises a LocalJumpError when no block given" do
- lambda { 3.tap }.should raise_error(LocalJumpError)
+ -> { 3.tap }.should raise_error(LocalJumpError)
end
end
diff --git a/spec/ruby/core/kernel/throw_spec.rb b/spec/ruby/core/kernel/throw_spec.rb
index 1e56376529..64bfccb413 100644
--- a/spec/ruby/core/kernel/throw_spec.rb
+++ b/spec/ruby/core/kernel/throw_spec.rb
@@ -42,21 +42,21 @@ describe "Kernel.throw" do
end
it "raises an ArgumentError if there is no catch block for the symbol" do
- lambda { throw :blah }.should raise_error(ArgumentError)
+ -> { throw :blah }.should raise_error(ArgumentError)
end
it "raises an UncaughtThrowError if there is no catch block for the symbol" do
- lambda { throw :blah }.should raise_error(UncaughtThrowError)
+ -> { throw :blah }.should raise_error(UncaughtThrowError)
end
it "raises ArgumentError if 3 or more arguments provided" do
- lambda {
+ -> {
catch :blah do
throw :blah, :return_value, 2
end
}.should raise_error(ArgumentError)
- lambda {
+ -> {
catch :blah do
throw :blah, :return_value, 2, 3, 4, 5
end
@@ -64,7 +64,7 @@ describe "Kernel.throw" do
end
it "can throw an object" do
- lambda {
+ -> {
obj = Object.new
catch obj do
throw obj
diff --git a/spec/ruby/core/kernel/trace_var_spec.rb b/spec/ruby/core/kernel/trace_var_spec.rb
index 019902a230..3c84aa5e60 100644
--- a/spec/ruby/core/kernel/trace_var_spec.rb
+++ b/spec/ruby/core/kernel/trace_var_spec.rb
@@ -47,7 +47,7 @@ describe "Kernel#trace_var" do
end
it "raises ArgumentError if no block or proc is provided" do
- lambda do
+ -> do
trace_var :$Kernel_trace_var_global
end.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/core/kernel/trust_spec.rb b/spec/ruby/core/kernel/trust_spec.rb
index c258c4fce7..d34aa293ec 100644
--- a/spec/ruby/core/kernel/trust_spec.rb
+++ b/spec/ruby/core/kernel/trust_spec.rb
@@ -15,7 +15,7 @@ describe "Kernel#trust" do
it "raises #{frozen_error_class} on an untrusted, frozen object" do
o = Object.new.untrust.freeze
- lambda { o.trust }.should raise_error(frozen_error_class)
+ -> { o.trust }.should raise_error(frozen_error_class)
end
it "does not raise an error on a trusted, frozen object" do
diff --git a/spec/ruby/core/kernel/untaint_spec.rb b/spec/ruby/core/kernel/untaint_spec.rb
index 73f7942124..94e4a8fd44 100644
--- a/spec/ruby/core/kernel/untaint_spec.rb
+++ b/spec/ruby/core/kernel/untaint_spec.rb
@@ -15,7 +15,7 @@ describe "Kernel#untaint" do
it "raises #{frozen_error_class} on a tainted, frozen object" do
o = Object.new.taint.freeze
- lambda { o.untaint }.should raise_error(frozen_error_class)
+ -> { o.untaint }.should raise_error(frozen_error_class)
end
it "does not raise an error on an untainted, frozen object" do
diff --git a/spec/ruby/core/kernel/untrust_spec.rb b/spec/ruby/core/kernel/untrust_spec.rb
index f70e4356ff..2ee3dbb170 100644
--- a/spec/ruby/core/kernel/untrust_spec.rb
+++ b/spec/ruby/core/kernel/untrust_spec.rb
@@ -15,7 +15,7 @@ describe "Kernel#untrust" do
it "raises #{frozen_error_class} on a trusted, frozen object" do
o = Object.new.freeze
- lambda { o.untrust }.should raise_error(frozen_error_class)
+ -> { o.untrust }.should raise_error(frozen_error_class)
end
it "does not raise an error on an untrusted, frozen object" do
diff --git a/spec/ruby/core/kernel/untrusted_spec.rb b/spec/ruby/core/kernel/untrusted_spec.rb
index 55638a5dd3..3f894b0bab 100644
--- a/spec/ruby/core/kernel/untrusted_spec.rb
+++ b/spec/ruby/core/kernel/untrusted_spec.rb
@@ -23,6 +23,6 @@ describe "Kernel#untrusted?" do
it "has effect on immediate values" do
d = 1
- lambda { d.untrust }.should_not raise_error(RuntimeError)
+ -> { d.untrust }.should_not raise_error(RuntimeError)
end
end
diff --git a/spec/ruby/core/kernel/warn_spec.rb b/spec/ruby/core/kernel/warn_spec.rb
index 7e0a57fa9a..d05a37958d 100644
--- a/spec/ruby/core/kernel/warn_spec.rb
+++ b/spec/ruby/core/kernel/warn_spec.rb
@@ -21,56 +21,56 @@ describe "Kernel#warn" do
end
it "does not append line-end if last character is line-end" do
- lambda {
+ -> {
$VERBOSE = true
warn("this is some simple text with line-end\n")
}.should output(nil, "this is some simple text with line-end\n")
end
it "calls #write on $stderr if $VERBOSE is true" do
- lambda {
+ -> {
$VERBOSE = true
warn("this is some simple text")
}.should output(nil, "this is some simple text\n")
end
it "calls #write on $stderr if $VERBOSE is false" do
- lambda {
+ -> {
$VERBOSE = false
warn("this is some simple text")
}.should output(nil, "this is some simple text\n")
end
it "does not call #write on $stderr if $VERBOSE is nil" do
- lambda {
+ -> {
$VERBOSE = nil
warn("this is some simple text")
}.should output(nil, "")
end
it "writes each argument on a line when passed multiple arguments" do
- lambda {
+ -> {
$VERBOSE = true
warn("line 1", "line 2")
}.should output(nil, "line 1\nline 2\n")
end
it "writes each array element on a line when passes an array" do
- lambda {
+ -> {
$VERBOSE = true
warn(["line 1", "line 2"])
}.should output(nil, "line 1\nline 2\n")
end
it "does not write strings when passed no arguments" do
- lambda {
+ -> {
$VERBOSE = true
warn
}.should output("", "")
end
it "writes the default record separator and NOT $/ to $stderr after the warning message" do
- lambda {
+ -> {
$VERBOSE = true
$/ = 'rs'
warn("")
@@ -80,7 +80,7 @@ describe "Kernel#warn" do
it "writes to_s representation if passed a non-string" do
obj = mock("obj")
obj.should_receive(:to_s).and_return("to_s called")
- lambda {
+ -> {
$VERBOSE = true
warn(obj)
}.should output(nil, "to_s called\n")
diff --git a/spec/ruby/core/main/private_spec.rb b/spec/ruby/core/main/private_spec.rb
index eef826ad81..e34e0c7b7b 100644
--- a/spec/ruby/core/main/private_spec.rb
+++ b/spec/ruby/core/main/private_spec.rb
@@ -16,7 +16,7 @@ describe "main#private" do
end
it "raises a NameError when given an undefined name" do
- lambda do
+ -> do
eval "private :main_undefined_method", TOPLEVEL_BINDING
end.should raise_error(NameError)
end
diff --git a/spec/ruby/core/main/public_spec.rb b/spec/ruby/core/main/public_spec.rb
index 259a8f9418..afe25c705a 100644
--- a/spec/ruby/core/main/public_spec.rb
+++ b/spec/ruby/core/main/public_spec.rb
@@ -16,7 +16,7 @@ describe "main#public" do
end
it "raises a NameError when given an undefined name" do
- lambda do
+ -> do
eval "public :main_undefined_method", TOPLEVEL_BINDING
end.should raise_error(NameError)
end
diff --git a/spec/ruby/core/main/using_spec.rb b/spec/ruby/core/main/using_spec.rb
index 1fb812f5cc..f9f709f7dc 100644
--- a/spec/ruby/core/main/using_spec.rb
+++ b/spec/ruby/core/main/using_spec.rb
@@ -3,11 +3,11 @@ require_relative 'fixtures/classes'
describe "main.using" do
it "requires one Module argument" do
- lambda do
+ -> do
eval('using', TOPLEVEL_BINDING)
end.should raise_error(ArgumentError)
- lambda do
+ -> do
eval('using "foo"', TOPLEVEL_BINDING)
end.should raise_error(TypeError)
end
@@ -17,7 +17,7 @@ describe "main.using" do
load File.expand_path('../fixtures/string_refinement_user.rb', __FILE__)
MainSpecs::DATA[:in_module].should == 'foo'
MainSpecs::DATA[:toplevel].should == 'foo'
- lambda do
+ -> do
'hello'.foo
end.should raise_error(NoMethodError)
end
@@ -25,7 +25,7 @@ describe "main.using" do
it "uses refinements from the given module for method calls in the target file" do
require_relative 'fixtures/string_refinement'
load File.expand_path('../fixtures/string_refinement_user.rb', __FILE__)
- lambda do
+ -> do
'hello'.foo
end.should raise_error(NoMethodError)
MainSpecs.call_foo('hello').should == 'foo'
diff --git a/spec/ruby/core/marshal/dump_spec.rb b/spec/ruby/core/marshal/dump_spec.rb
index 53a0b3197d..700f090a2f 100644
--- a/spec/ruby/core/marshal/dump_spec.rb
+++ b/spec/ruby/core/marshal/dump_spec.rb
@@ -99,7 +99,7 @@ describe "Marshal.dump" do
it "raises a TypeError if _dump returns a non-string" do
m = mock("marshaled")
m.should_receive(:_dump).and_return(0)
- lambda { Marshal.dump(m) }.should raise_error(TypeError)
+ -> { Marshal.dump(m) }.should raise_error(TypeError)
end
it "favors marshal_dump over _dump" do
@@ -124,11 +124,11 @@ describe "Marshal.dump" do
end
it "raises TypeError with an anonymous Class" do
- lambda { Marshal.dump(Class.new) }.should raise_error(TypeError)
+ -> { Marshal.dump(Class.new) }.should raise_error(TypeError)
end
it "raises TypeError with a singleton Class" do
- lambda { Marshal.dump(class << self; self end) }.should raise_error(TypeError)
+ -> { Marshal.dump(class << self; self end) }.should raise_error(TypeError)
end
end
@@ -138,7 +138,7 @@ describe "Marshal.dump" do
end
it "raises TypeError with an anonymous Module" do
- lambda { Marshal.dump(Module.new) }.should raise_error(TypeError)
+ -> { Marshal.dump(Module.new) }.should raise_error(TypeError)
end
end
@@ -308,7 +308,7 @@ describe "Marshal.dump" do
end
it "raises a TypeError with hash having default proc" do
- lambda { Marshal.dump(Hash.new {}) }.should raise_error(TypeError)
+ -> { Marshal.dump(Hash.new {}) }.should raise_error(TypeError)
end
it "dumps a Hash with instance variables" do
@@ -387,7 +387,7 @@ describe "Marshal.dump" do
it "raises if an Object has a singleton class and singleton methods" do
obj = Object.new
def obj.foo; end
- lambda {
+ -> {
Marshal.dump(obj)
}.should raise_error(TypeError, "singleton can't be dumped")
end
@@ -509,10 +509,10 @@ describe "Marshal.dump" do
it "raises an ArgumentError when the recursion limit is exceeded" do
h = {'one' => {'two' => {'three' => 0}}}
- lambda { Marshal.dump(h, 3) }.should raise_error(ArgumentError)
- lambda { Marshal.dump([h], 4) }.should raise_error(ArgumentError)
- lambda { Marshal.dump([], 0) }.should raise_error(ArgumentError)
- lambda { Marshal.dump([[[]]], 1) }.should raise_error(ArgumentError)
+ -> { Marshal.dump(h, 3) }.should raise_error(ArgumentError)
+ -> { Marshal.dump([h], 4) }.should raise_error(ArgumentError)
+ -> { Marshal.dump([], 0) }.should raise_error(ArgumentError)
+ -> { Marshal.dump([[[]]], 1) }.should raise_error(ArgumentError)
end
it "ignores the recursion limit if the limit is negative" do
@@ -535,7 +535,7 @@ describe "Marshal.dump" do
it "raises an Error when the IO-Object does not respond to #write" do
obj = mock('test')
- lambda { Marshal.dump("test", obj) }.should raise_error(TypeError)
+ -> { Marshal.dump("test", obj) }.should raise_error(TypeError)
end
@@ -554,31 +554,31 @@ describe "Marshal.dump" do
it "should raise an error" do
require "stringio"
- lambda { Marshal.dump(StringIO.new) }.should raise_error(TypeError)
+ -> { Marshal.dump(StringIO.new) }.should raise_error(TypeError)
end
end
it "raises a TypeError if marshalling a Method instance" do
- lambda { Marshal.dump(Marshal.method(:dump)) }.should raise_error(TypeError)
+ -> { Marshal.dump(Marshal.method(:dump)) }.should raise_error(TypeError)
end
it "raises a TypeError if marshalling a Proc" do
- lambda { Marshal.dump(proc {}) }.should raise_error(TypeError)
+ -> { Marshal.dump(proc {}) }.should raise_error(TypeError)
end
it "raises a TypeError if dumping a IO/File instance" do
- lambda { Marshal.dump(STDIN) }.should raise_error(TypeError)
- lambda { File.open(__FILE__) { |f| Marshal.dump(f) } }.should raise_error(TypeError)
+ -> { Marshal.dump(STDIN) }.should raise_error(TypeError)
+ -> { File.open(__FILE__) { |f| Marshal.dump(f) } }.should raise_error(TypeError)
end
it "raises a TypeError if dumping a MatchData instance" do
- lambda { Marshal.dump(/(.)/.match("foo")) }.should raise_error(TypeError)
+ -> { Marshal.dump(/(.)/.match("foo")) }.should raise_error(TypeError)
end
it "raises a TypeError if dumping a Mutex instance" do
m = Mutex.new
- lambda { Marshal.dump(m) }.should raise_error(TypeError)
+ -> { Marshal.dump(m) }.should raise_error(TypeError)
end
it "returns an untainted string if object is untainted" do
diff --git a/spec/ruby/core/marshal/shared/load.rb b/spec/ruby/core/marshal/shared/load.rb
index cb041ec25c..f92d49c68c 100644
--- a/spec/ruby/core/marshal/shared/load.rb
+++ b/spec/ruby/core/marshal/shared/load.rb
@@ -9,7 +9,7 @@ describe :marshal_load, shared: true do
it "raises an ArgumentError when the dumped data is truncated" do
obj = {first: 1, second: 2, third: 3}
- lambda { Marshal.send(@method, Marshal.dump(obj)[0, 5]) }.should raise_error(ArgumentError)
+ -> { Marshal.send(@method, Marshal.dump(obj)[0, 5]) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the dumped class is missing" do
@@ -17,7 +17,7 @@ describe :marshal_load, shared: true do
kaboom = Marshal.dump(KaBoom.new)
Object.send(:remove_const, :KaBoom)
- lambda { Marshal.send(@method, kaboom) }.should raise_error(ArgumentError)
+ -> { Marshal.send(@method, kaboom) }.should raise_error(ArgumentError)
end
describe "when called with a proc" do
@@ -162,20 +162,20 @@ describe :marshal_load, shared: true do
marshal_data[0] = (Marshal::MAJOR_VERSION).chr
marshal_data[1] = (Marshal::MINOR_VERSION + 1).chr
- lambda { Marshal.send(@method, marshal_data) }.should raise_error(TypeError)
+ -> { Marshal.send(@method, marshal_data) }.should raise_error(TypeError)
marshal_data = '\xff\xff'
marshal_data[0] = (Marshal::MAJOR_VERSION - 1).chr
marshal_data[1] = (Marshal::MINOR_VERSION).chr
- lambda { Marshal.send(@method, marshal_data) }.should raise_error(TypeError)
+ -> { Marshal.send(@method, marshal_data) }.should raise_error(TypeError)
end
it "raises EOFError on loading an empty file" do
temp_file = tmp("marshal.rubyspec.tmp.#{Process.pid}")
file = File.new(temp_file, "w+")
begin
- lambda { Marshal.send(@method, file) }.should raise_error(EOFError)
+ -> { Marshal.send(@method, file) }.should raise_error(EOFError)
ensure
file.close
rm_r temp_file
@@ -567,7 +567,7 @@ describe :marshal_load, shared: true do
end
it "raises ArgumentError if the object from an 'o' stream is not dumpable as 'o' type user class" do
- lambda do
+ -> do
Marshal.send(@method, "\x04\bo:\tFile\001\001:\001\005@path\"\x10/etc/passwd")
end.should raise_error(ArgumentError)
end
@@ -598,10 +598,10 @@ describe :marshal_load, shared: true do
data = Marshal.dump(MarshalSpec::SwappedClass.new)
MarshalSpec.set_swapped_class(Class.new(Array))
- lambda { Marshal.send(@method, data) }.should raise_error(ArgumentError)
+ -> { Marshal.send(@method, data) }.should raise_error(ArgumentError)
MarshalSpec.set_swapped_class(Class.new)
- lambda { Marshal.send(@method, data) }.should raise_error(ArgumentError)
+ -> { Marshal.send(@method, data) }.should raise_error(ArgumentError)
end
end
end
@@ -702,7 +702,7 @@ describe :marshal_load, shared: true do
"\004\bi\004\0",
"\004\bi\004\0\0",
"\004\bi\004\0\0\0"].each do |invalid|
- lambda { Marshal.send(@method, invalid) }.should raise_error(ArgumentError)
+ -> { Marshal.send(@method, invalid) }.should raise_error(ArgumentError)
end
end
@@ -799,11 +799,11 @@ describe :marshal_load, shared: true do
end
it "raises ArgumentError if given the name of a non-Module" do
- lambda { Marshal.send(@method, "\x04\bc\vKernel") }.should raise_error(ArgumentError)
+ -> { Marshal.send(@method, "\x04\bc\vKernel") }.should raise_error(ArgumentError)
end
it "raises ArgumentError if given a nonexistent class" do
- lambda { Marshal.send(@method, "\x04\bc\vStrung") }.should raise_error(ArgumentError)
+ -> { Marshal.send(@method, "\x04\bc\vStrung") }.should raise_error(ArgumentError)
end
end
@@ -813,7 +813,7 @@ describe :marshal_load, shared: true do
end
it "raises ArgumentError if given the name of a non-Class" do
- lambda { Marshal.send(@method, "\x04\bm\vString") }.should raise_error(ArgumentError)
+ -> { Marshal.send(@method, "\x04\bm\vString") }.should raise_error(ArgumentError)
end
it "loads an old module" do
@@ -852,13 +852,13 @@ describe :marshal_load, shared: true do
data = "\x04\bd:\x1AUnloadableDumpableDirI\"\x06.\x06:\x06ET"
- lambda { Marshal.send(@method, data) }.should raise_error(TypeError)
+ -> { Marshal.send(@method, data) }.should raise_error(TypeError)
end
it "raises ArgumentError when the local class is a regular object" do
data = "\004\bd:\020UserDefined\0"
- lambda { Marshal.send(@method, data) }.should raise_error(ArgumentError)
+ -> { Marshal.send(@method, data) }.should raise_error(ArgumentError)
end
end
@@ -871,7 +871,7 @@ describe :marshal_load, shared: true do
it "raises an ArgumentError" do
message = "undefined class/module NamespaceTest::SameName"
- lambda { Marshal.send(@method, @data) }.should raise_error(ArgumentError, message)
+ -> { Marshal.send(@method, @data) }.should raise_error(ArgumentError, message)
end
end
@@ -880,6 +880,6 @@ describe :marshal_load, shared: true do
@data = Marshal.dump(NamespaceTest::KaBoom.new)
NamespaceTest.send(:remove_const, :KaBoom)
- lambda { Marshal.send(@method, @data) }.should raise_error(ArgumentError, /NamespaceTest::KaBoom/)
+ -> { Marshal.send(@method, @data) }.should raise_error(ArgumentError, /NamespaceTest::KaBoom/)
end
end
diff --git a/spec/ruby/core/matchdata/element_reference_spec.rb b/spec/ruby/core/matchdata/element_reference_spec.rb
index 1f02ef235b..26550ac94d 100644
--- a/spec/ruby/core/matchdata/element_reference_spec.rb
+++ b/spec/ruby/core/matchdata/element_reference_spec.rb
@@ -71,12 +71,12 @@ describe "MatchData#[Symbol]" do
it "raises an IndexError if there is no named match corresponding to the Symbol" do
md = 'haystack'.match(/(?<t>t(?<a>ack))/)
- lambda { md[:baz] }.should raise_error(IndexError, /baz/)
+ -> { md[:baz] }.should raise_error(IndexError, /baz/)
end
it "raises an IndexError if there is no named match corresponding to the String" do
md = 'haystack'.match(/(?<t>t(?<a>ack))/)
- lambda { md['baz'] }.should raise_error(IndexError, /baz/)
+ -> { md['baz'] }.should raise_error(IndexError, /baz/)
end
it "returns matches in the String's encoding" do
diff --git a/spec/ruby/core/math/acos_spec.rb b/spec/ruby/core/math/acos_spec.rb
index 0f104b8efc..8b321ab29b 100644
--- a/spec/ruby/core/math/acos_spec.rb
+++ b/spec/ruby/core/math/acos_spec.rb
@@ -21,15 +21,15 @@ describe "Math.acos" do
end
it "raises an Math::DomainError if the argument is greater than 1.0" do
- lambda { Math.acos(1.0001) }.should raise_error(Math::DomainError)
+ -> { Math.acos(1.0001) }.should raise_error(Math::DomainError)
end
it "raises an Math::DomainError if the argument is less than -1.0" do
- lambda { Math.acos(-1.0001) }.should raise_error(Math::DomainError)
+ -> { Math.acos(-1.0001) }.should raise_error(Math::DomainError)
end
it "raises a TypeError if the string argument cannot be coerced with Float()" do
- lambda { Math.acos("test") }.should raise_error(TypeError)
+ -> { Math.acos("test") }.should raise_error(TypeError)
end
it "returns NaN given NaN" do
@@ -37,11 +37,11 @@ describe "Math.acos" do
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { Math.acos(MathSpecs::UserClass.new) }.should raise_error(TypeError)
+ -> { Math.acos(MathSpecs::UserClass.new) }.should raise_error(TypeError)
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.acos(nil) }.should raise_error(TypeError)
+ -> { Math.acos(nil) }.should raise_error(TypeError)
end
it "accepts any argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/math/acosh_spec.rb b/spec/ruby/core/math/acosh_spec.rb
index 26c18a530f..6707de95d3 100644
--- a/spec/ruby/core/math/acosh_spec.rb
+++ b/spec/ruby/core/math/acosh_spec.rb
@@ -12,13 +12,13 @@ describe "Math.acosh" do
end
it "raises Math::DomainError if the passed argument is less than -1.0 or greater than 1.0" do
- lambda { Math.acosh(1.0 - TOLERANCE) }.should raise_error(Math::DomainError)
- lambda { Math.acosh(0) }.should raise_error(Math::DomainError)
- lambda { Math.acosh(-1.0) }.should raise_error(Math::DomainError)
+ -> { Math.acosh(1.0 - TOLERANCE) }.should raise_error(Math::DomainError)
+ -> { Math.acosh(0) }.should raise_error(Math::DomainError)
+ -> { Math.acosh(-1.0) }.should raise_error(Math::DomainError)
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { Math.acosh("test") }.should raise_error(TypeError)
+ -> { Math.acosh("test") }.should raise_error(TypeError)
end
it "returns NaN given NaN" do
@@ -26,7 +26,7 @@ describe "Math.acosh" do
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.acosh(nil) }.should raise_error(TypeError)
+ -> { Math.acosh(nil) }.should raise_error(TypeError)
end
it "accepts any argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/math/asin_spec.rb b/spec/ruby/core/math/asin_spec.rb
index 8591ea80ea..3a674a1147 100644
--- a/spec/ruby/core/math/asin_spec.rb
+++ b/spec/ruby/core/math/asin_spec.rb
@@ -17,15 +17,15 @@ describe "Math.asin" do
end
it "raises an Math::DomainError if the argument is greater than 1.0" do
- lambda { Math.asin(1.0001) }.should raise_error( Math::DomainError)
+ -> { Math.asin(1.0001) }.should raise_error( Math::DomainError)
end
it "raises an Math::DomainError if the argument is less than -1.0" do
- lambda { Math.asin(-1.0001) }.should raise_error( Math::DomainError)
+ -> { Math.asin(-1.0001) }.should raise_error( Math::DomainError)
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { Math.asin("test") }.should raise_error(TypeError)
+ -> { Math.asin("test") }.should raise_error(TypeError)
end
it "returns NaN given NaN" do
@@ -33,7 +33,7 @@ describe "Math.asin" do
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.asin(nil) }.should raise_error(TypeError)
+ -> { Math.asin(nil) }.should raise_error(TypeError)
end
it "accepts any argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/math/asinh_spec.rb b/spec/ruby/core/math/asinh_spec.rb
index 66a2beaa36..ff8210df0a 100644
--- a/spec/ruby/core/math/asinh_spec.rb
+++ b/spec/ruby/core/math/asinh_spec.rb
@@ -19,7 +19,7 @@ describe "Math.asinh" do
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { Math.asinh("test") }.should raise_error(TypeError)
+ -> { Math.asinh("test") }.should raise_error(TypeError)
end
it "returns NaN given NaN" do
@@ -27,7 +27,7 @@ describe "Math.asinh" do
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.asinh(nil) }.should raise_error(TypeError)
+ -> { Math.asinh(nil) }.should raise_error(TypeError)
end
it "accepts any argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/math/atan2_spec.rb b/spec/ruby/core/math/atan2_spec.rb
index da1b3476cc..d4ef369d2a 100644
--- a/spec/ruby/core/math/atan2_spec.rb
+++ b/spec/ruby/core/math/atan2_spec.rb
@@ -14,15 +14,15 @@ describe "Math.atan2" do
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { Math.atan2(1.0, "test") }.should raise_error(TypeError)
- lambda { Math.atan2("test", 0.0) }.should raise_error(TypeError)
- lambda { Math.atan2("test", "this") }.should raise_error(TypeError)
+ -> { Math.atan2(1.0, "test") }.should raise_error(TypeError)
+ -> { Math.atan2("test", 0.0) }.should raise_error(TypeError)
+ -> { Math.atan2("test", "this") }.should raise_error(TypeError)
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.atan2(nil, 1.0) }.should raise_error(TypeError)
- lambda { Math.atan2(-1.0, nil) }.should raise_error(TypeError)
- lambda { Math.atan2(nil, nil) }.should raise_error(TypeError)
+ -> { Math.atan2(nil, 1.0) }.should raise_error(TypeError)
+ -> { Math.atan2(-1.0, nil) }.should raise_error(TypeError)
+ -> { Math.atan2(nil, nil) }.should raise_error(TypeError)
end
it "accepts any argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/math/atan_spec.rb b/spec/ruby/core/math/atan_spec.rb
index 9a9791266b..15edf68c05 100644
--- a/spec/ruby/core/math/atan_spec.rb
+++ b/spec/ruby/core/math/atan_spec.rb
@@ -17,7 +17,7 @@ describe "Math.atan" do
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { Math.atan("test") }.should raise_error(TypeError)
+ -> { Math.atan("test") }.should raise_error(TypeError)
end
it "returns NaN given NaN" do
@@ -25,7 +25,7 @@ describe "Math.atan" do
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.atan(nil) }.should raise_error(TypeError)
+ -> { Math.atan(nil) }.should raise_error(TypeError)
end
it "accepts any argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/math/cbrt_spec.rb b/spec/ruby/core/math/cbrt_spec.rb
index 8c96243658..01cf923c71 100644
--- a/spec/ruby/core/math/cbrt_spec.rb
+++ b/spec/ruby/core/math/cbrt_spec.rb
@@ -14,11 +14,11 @@ describe "Math.cbrt" do
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { Math.cbrt("foobar") }.should raise_error(TypeError)
+ -> { Math.cbrt("foobar") }.should raise_error(TypeError)
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.cbrt(nil) }.should raise_error(TypeError)
+ -> { Math.cbrt(nil) }.should raise_error(TypeError)
end
it "accepts any argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/math/cos_spec.rb b/spec/ruby/core/math/cos_spec.rb
index cd27b99794..3ba7a54c38 100644
--- a/spec/ruby/core/math/cos_spec.rb
+++ b/spec/ruby/core/math/cos_spec.rb
@@ -17,7 +17,7 @@ describe "Math.cos" do
it "raises a TypeError unless the argument is Numeric and has #to_f" do
- lambda { Math.cos("test") }.should raise_error(TypeError)
+ -> { Math.cos("test") }.should raise_error(TypeError)
end
it "returns NaN given NaN" do
@@ -25,7 +25,7 @@ describe "Math.cos" do
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.cos(nil) }.should raise_error(TypeError)
+ -> { Math.cos(nil) }.should raise_error(TypeError)
end
it "coerces its argument with #to_f" do
diff --git a/spec/ruby/core/math/cosh_spec.rb b/spec/ruby/core/math/cosh_spec.rb
index 14d4c2fe0f..049e117e56 100644
--- a/spec/ruby/core/math/cosh_spec.rb
+++ b/spec/ruby/core/math/cosh_spec.rb
@@ -14,7 +14,7 @@ describe "Math.cosh" do
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { Math.cosh("test") }.should raise_error(TypeError)
+ -> { Math.cosh("test") }.should raise_error(TypeError)
end
it "returns NaN given NaN" do
@@ -22,7 +22,7 @@ describe "Math.cosh" do
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.cosh(nil) }.should raise_error(TypeError)
+ -> { Math.cosh(nil) }.should raise_error(TypeError)
end
it "accepts any argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/math/erf_spec.rb b/spec/ruby/core/math/erf_spec.rb
index 96757e412d..b4e6248e43 100644
--- a/spec/ruby/core/math/erf_spec.rb
+++ b/spec/ruby/core/math/erf_spec.rb
@@ -21,7 +21,7 @@ describe "Math.erf" do
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { Math.erf("test") }.should raise_error(TypeError)
+ -> { Math.erf("test") }.should raise_error(TypeError)
end
it "returns NaN given NaN" do
@@ -29,7 +29,7 @@ describe "Math.erf" do
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.erf(nil) }.should raise_error(TypeError)
+ -> { Math.erf(nil) }.should raise_error(TypeError)
end
it "accepts any argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/math/erfc_spec.rb b/spec/ruby/core/math/erfc_spec.rb
index eca23eaf7c..e465f5cf58 100644
--- a/spec/ruby/core/math/erfc_spec.rb
+++ b/spec/ruby/core/math/erfc_spec.rb
@@ -20,7 +20,7 @@ describe "Math.erfc" do
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { Math.erfc("test") }.should raise_error(TypeError)
+ -> { Math.erfc("test") }.should raise_error(TypeError)
end
it "returns NaN given NaN" do
@@ -28,7 +28,7 @@ describe "Math.erfc" do
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.erfc(nil) }.should raise_error(TypeError)
+ -> { Math.erfc(nil) }.should raise_error(TypeError)
end
it "accepts any argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/math/exp_spec.rb b/spec/ruby/core/math/exp_spec.rb
index d97550dc4e..36eb49a8c7 100644
--- a/spec/ruby/core/math/exp_spec.rb
+++ b/spec/ruby/core/math/exp_spec.rb
@@ -14,7 +14,7 @@ describe "Math.exp" do
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { Math.exp("test") }.should raise_error(TypeError)
+ -> { Math.exp("test") }.should raise_error(TypeError)
end
it "returns NaN given NaN" do
@@ -22,7 +22,7 @@ describe "Math.exp" do
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.exp(nil) }.should raise_error(TypeError)
+ -> { Math.exp(nil) }.should raise_error(TypeError)
end
it "accepts any argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/math/frexp_spec.rb b/spec/ruby/core/math/frexp_spec.rb
index 31b5b4079f..7dfb493d20 100644
--- a/spec/ruby/core/math/frexp_spec.rb
+++ b/spec/ruby/core/math/frexp_spec.rb
@@ -9,7 +9,7 @@ describe "Math.frexp" do
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { Math.frexp("test") }.should raise_error(TypeError)
+ -> { Math.frexp("test") }.should raise_error(TypeError)
end
it "returns NaN given NaN" do
@@ -18,7 +18,7 @@ describe "Math.frexp" do
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.frexp(nil) }.should raise_error(TypeError)
+ -> { Math.frexp(nil) }.should raise_error(TypeError)
end
it "accepts any argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/math/gamma_spec.rb b/spec/ruby/core/math/gamma_spec.rb
index ce7f82421f..386162a087 100644
--- a/spec/ruby/core/math/gamma_spec.rb
+++ b/spec/ruby/core/math/gamma_spec.rb
@@ -51,7 +51,7 @@ describe "Math.gamma" do
end
it "raises Math::DomainError given -1" do
- lambda { Math.gamma(-1) }.should raise_error(Math::DomainError)
+ -> { Math.gamma(-1) }.should raise_error(Math::DomainError)
end
# See https://bugs.ruby-lang.org/issues/10642
@@ -60,7 +60,7 @@ describe "Math.gamma" do
end
it "raises Math::DomainError given negative infinity" do
- lambda { Math.gamma(-Float::INFINITY) }.should raise_error(Math::DomainError)
+ -> { Math.gamma(-Float::INFINITY) }.should raise_error(Math::DomainError)
end
it "returns NaN given NaN" do
diff --git a/spec/ruby/core/math/hypot_spec.rb b/spec/ruby/core/math/hypot_spec.rb
index 20badb2840..3e0ce74597 100644
--- a/spec/ruby/core/math/hypot_spec.rb
+++ b/spec/ruby/core/math/hypot_spec.rb
@@ -16,7 +16,7 @@ describe "Math.hypot" do
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { Math.hypot("test", "this") }.should raise_error(TypeError)
+ -> { Math.hypot("test", "this") }.should raise_error(TypeError)
end
it "returns NaN given NaN" do
@@ -26,7 +26,7 @@ describe "Math.hypot" do
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.hypot(nil, nil) }.should raise_error(TypeError)
+ -> { Math.hypot(nil, nil) }.should raise_error(TypeError)
end
it "accepts any argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/math/ldexp_spec.rb b/spec/ruby/core/math/ldexp_spec.rb
index 8602b33d43..fb7799cf26 100644
--- a/spec/ruby/core/math/ldexp_spec.rb
+++ b/spec/ruby/core/math/ldexp_spec.rb
@@ -15,7 +15,7 @@ describe "Math.ldexp" do
end
it "raises a TypeError if the first argument cannot be coerced with Float()" do
- lambda { Math.ldexp("test", 2) }.should raise_error(TypeError)
+ -> { Math.ldexp("test", 2) }.should raise_error(TypeError)
end
it "returns NaN given NaN" do
@@ -23,19 +23,19 @@ describe "Math.ldexp" do
end
it "raises RangeError if NaN is given as the second arg" do
- lambda { Math.ldexp(0, nan_value) }.should raise_error(RangeError)
+ -> { Math.ldexp(0, nan_value) }.should raise_error(RangeError)
end
it "raises a TypeError if the second argument cannot be coerced with Integer()" do
- lambda { Math.ldexp(3.2, "this") }.should raise_error(TypeError)
+ -> { Math.ldexp(3.2, "this") }.should raise_error(TypeError)
end
it "raises a TypeError if the first argument is nil" do
- lambda { Math.ldexp(nil, 2) }.should raise_error(TypeError)
+ -> { Math.ldexp(nil, 2) }.should raise_error(TypeError)
end
it "raises a TypeError if the second argument is nil" do
- lambda { Math.ldexp(3.1, nil) }.should raise_error(TypeError)
+ -> { Math.ldexp(3.1, nil) }.should raise_error(TypeError)
end
it "accepts any first argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/math/lgamma_spec.rb b/spec/ruby/core/math/lgamma_spec.rb
index a20d0a4f2f..33e7836448 100644
--- a/spec/ruby/core/math/lgamma_spec.rb
+++ b/spec/ruby/core/math/lgamma_spec.rb
@@ -40,7 +40,7 @@ describe "Math.lgamma" do
end
it "raises Math::DomainError when passed -Infinity" do
- lambda { Math.lgamma(-infinity_value) }.should raise_error(Math::DomainError)
+ -> { Math.lgamma(-infinity_value) }.should raise_error(Math::DomainError)
end
it "returns [Infinity, 1] when passed Infinity" do
diff --git a/spec/ruby/core/math/log10_spec.rb b/spec/ruby/core/math/log10_spec.rb
index 2c594999b7..c4daedcd5c 100644
--- a/spec/ruby/core/math/log10_spec.rb
+++ b/spec/ruby/core/math/log10_spec.rb
@@ -16,11 +16,11 @@ describe "Math.log10" do
end
it "raises an Math::DomainError if the argument is less than 0" do
- lambda { Math.log10(-1e-15) }.should raise_error(Math::DomainError)
+ -> { Math.log10(-1e-15) }.should raise_error(Math::DomainError)
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { Math.log10("test") }.should raise_error(TypeError)
+ -> { Math.log10("test") }.should raise_error(TypeError)
end
it "returns NaN given NaN" do
@@ -28,7 +28,7 @@ describe "Math.log10" do
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.log10(nil) }.should raise_error(TypeError)
+ -> { Math.log10(nil) }.should raise_error(TypeError)
end
it "accepts any argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/math/log2_spec.rb b/spec/ruby/core/math/log2_spec.rb
index 8a7c582f92..1594f2d7af 100644
--- a/spec/ruby/core/math/log2_spec.rb
+++ b/spec/ruby/core/math/log2_spec.rb
@@ -16,15 +16,15 @@ describe "Math.log2" do
end
it "raises an Errno::EDOM if the argument is less than 0" do
- lambda { Math.log2(-1e-15) }.should raise_error( Math::DomainError)
+ -> { Math.log2(-1e-15) }.should raise_error( Math::DomainError)
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { Math.log2("test") }.should raise_error(TypeError)
+ -> { Math.log2("test") }.should raise_error(TypeError)
end
it "raises a TypeError if passed a numerical argument as a string" do
- lambda { Math.log2("1.0") }.should raise_error(TypeError)
+ -> { Math.log2("1.0") }.should raise_error(TypeError)
end
it "returns NaN given NaN" do
@@ -32,7 +32,7 @@ describe "Math.log2" do
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.log2(nil) }.should raise_error(TypeError)
+ -> { Math.log2(nil) }.should raise_error(TypeError)
end
it "accepts any argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/math/log_spec.rb b/spec/ruby/core/math/log_spec.rb
index c09e270c06..6c5036ba81 100644
--- a/spec/ruby/core/math/log_spec.rb
+++ b/spec/ruby/core/math/log_spec.rb
@@ -16,15 +16,15 @@ describe "Math.log" do
end
it "raises an Math::DomainError if the argument is less than 0" do
- lambda { Math.log(-1e-15) }.should raise_error(Math::DomainError)
+ -> { Math.log(-1e-15) }.should raise_error(Math::DomainError)
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { Math.log("test") }.should raise_error(TypeError)
+ -> { Math.log("test") }.should raise_error(TypeError)
end
it "raises a TypeError for numerical values passed as string" do
- lambda { Math.log("10") }.should raise_error(TypeError)
+ -> { Math.log("10") }.should raise_error(TypeError)
end
it "accepts a second argument for the base" do
@@ -33,8 +33,8 @@ describe "Math.log" do
end
it "raises a TypeError when the numerical base cannot be coerced to a float" do
- lambda { Math.log(10, "2") }.should raise_error(TypeError)
- lambda { Math.log(10, nil) }.should raise_error(TypeError)
+ -> { Math.log(10, "2") }.should raise_error(TypeError)
+ -> { Math.log(10, nil) }.should raise_error(TypeError)
end
it "returns NaN given NaN" do
@@ -42,7 +42,7 @@ describe "Math.log" do
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.log(nil) }.should raise_error(TypeError)
+ -> { Math.log(nil) }.should raise_error(TypeError)
end
it "accepts any argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/math/sin_spec.rb b/spec/ruby/core/math/sin_spec.rb
index 96bef5fed1..8e944bc95f 100644
--- a/spec/ruby/core/math/sin_spec.rb
+++ b/spec/ruby/core/math/sin_spec.rb
@@ -16,7 +16,7 @@ describe "Math.sin" do
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { Math.sin("test") }.should raise_error(TypeError)
+ -> { Math.sin("test") }.should raise_error(TypeError)
end
it "returns NaN given NaN" do
@@ -24,7 +24,7 @@ describe "Math.sin" do
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.sin(nil) }.should raise_error(TypeError)
+ -> { Math.sin(nil) }.should raise_error(TypeError)
end
it "accepts any argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/math/sinh_spec.rb b/spec/ruby/core/math/sinh_spec.rb
index e0fa0c99e9..027c2395a7 100644
--- a/spec/ruby/core/math/sinh_spec.rb
+++ b/spec/ruby/core/math/sinh_spec.rb
@@ -14,7 +14,7 @@ describe "Math.sinh" do
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { Math.sinh("test") }.should raise_error(TypeError)
+ -> { Math.sinh("test") }.should raise_error(TypeError)
end
it "returns NaN given NaN" do
@@ -22,7 +22,7 @@ describe "Math.sinh" do
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.sinh(nil) }.should raise_error(TypeError)
+ -> { Math.sinh(nil) }.should raise_error(TypeError)
end
it "accepts any argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/math/sqrt_spec.rb b/spec/ruby/core/math/sqrt_spec.rb
index 50fd132b2a..779aea2a0a 100644
--- a/spec/ruby/core/math/sqrt_spec.rb
+++ b/spec/ruby/core/math/sqrt_spec.rb
@@ -13,7 +13,7 @@ describe "Math.sqrt" do
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { Math.sqrt("test") }.should raise_error(TypeError)
+ -> { Math.sqrt("test") }.should raise_error(TypeError)
end
it "returns NaN given NaN" do
@@ -21,7 +21,7 @@ describe "Math.sqrt" do
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.sqrt(nil) }.should raise_error(TypeError)
+ -> { Math.sqrt(nil) }.should raise_error(TypeError)
end
it "accepts any argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/math/tan_spec.rb b/spec/ruby/core/math/tan_spec.rb
index 031fe75085..c7b188cd81 100644
--- a/spec/ruby/core/math/tan_spec.rb
+++ b/spec/ruby/core/math/tan_spec.rb
@@ -19,7 +19,7 @@ describe "Math.tan" do
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { Math.tan("test") }.should raise_error(TypeError)
+ -> { Math.tan("test") }.should raise_error(TypeError)
end
it "returns NaN given NaN" do
@@ -27,7 +27,7 @@ describe "Math.tan" do
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.tan(nil) }.should raise_error(TypeError)
+ -> { Math.tan(nil) }.should raise_error(TypeError)
end
it "accepts any argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/math/tanh_spec.rb b/spec/ruby/core/math/tanh_spec.rb
index 699d882ee8..568f8dfa77 100644
--- a/spec/ruby/core/math/tanh_spec.rb
+++ b/spec/ruby/core/math/tanh_spec.rb
@@ -16,7 +16,7 @@ describe "Math.tanh" do
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { Math.tanh("test") }.should raise_error(TypeError)
+ -> { Math.tanh("test") }.should raise_error(TypeError)
end
it "returns NaN given NaN" do
@@ -24,7 +24,7 @@ describe "Math.tanh" do
end
it "raises a TypeError if the argument is nil" do
- lambda { Math.tanh(nil) }.should raise_error(TypeError)
+ -> { Math.tanh(nil) }.should raise_error(TypeError)
end
it "accepts any argument that can be coerced with Float()" do
diff --git a/spec/ruby/core/method/curry_spec.rb b/spec/ruby/core/method/curry_spec.rb
index 36449f7512..219de0f6b5 100644
--- a/spec/ruby/core/method/curry_spec.rb
+++ b/spec/ruby/core/method/curry_spec.rb
@@ -23,14 +23,14 @@ describe "Method#curry" do
end
it "raises ArgumentError when the method requires less arguments than the given arity" do
- lambda { @obj.method(:zero).curry(1) }.should raise_error(ArgumentError)
- lambda { @obj.method(:one_req_one_opt).curry(3) }.should raise_error(ArgumentError)
- lambda { @obj.method(:two_req_one_opt_with_block).curry(4) }.should raise_error(ArgumentError)
+ -> { @obj.method(:zero).curry(1) }.should raise_error(ArgumentError)
+ -> { @obj.method(:one_req_one_opt).curry(3) }.should raise_error(ArgumentError)
+ -> { @obj.method(:two_req_one_opt_with_block).curry(4) }.should raise_error(ArgumentError)
end
it "raises ArgumentError when the method requires more arguments than the given arity" do
- lambda { @obj.method(:two_req_with_splat).curry(1) }.should raise_error(ArgumentError)
- lambda { @obj.method(:one_req).curry(0) }.should raise_error(ArgumentError)
+ -> { @obj.method(:two_req_with_splat).curry(1) }.should raise_error(ArgumentError)
+ -> { @obj.method(:one_req).curry(0) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/core/method/parameters_spec.rb b/spec/ruby/core/method/parameters_spec.rb
index 1de3901040..3fdaf9ce6f 100644
--- a/spec/ruby/core/method/parameters_spec.rb
+++ b/spec/ruby/core/method/parameters_spec.rb
@@ -12,7 +12,7 @@ describe "Method#parameters" do
def one_splat_two_req(*a,b,c); end
def one_splat_one_req_with_block(*a,b,&blk); end
- def one_opt_with_stabby(a=->(b){true}); end
+ def one_opt_with_stabby(a=-> b { true }); end
def one_unnamed_splat(*); end
diff --git a/spec/ruby/core/method/shared/call.rb b/spec/ruby/core/method/shared/call.rb
index f178b9da7d..f26e373695 100644
--- a/spec/ruby/core/method/shared/call.rb
+++ b/spec/ruby/core/method/shared/call.rb
@@ -9,10 +9,10 @@ describe :method_call, shared: true do
end
it "raises an ArgumentError when given incorrect number of arguments" do
- lambda {
+ -> {
MethodSpecs::Methods.new.method(:two_req).send(@method, 1, 2, 3)
}.should raise_error(ArgumentError)
- lambda {
+ -> {
MethodSpecs::Methods.new.method(:two_req).send(@method, 1)
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/core/module/alias_method_spec.rb b/spec/ruby/core/module/alias_method_spec.rb
index 8a2ddafda1..b14f5430a8 100644
--- a/spec/ruby/core/module/alias_method_spec.rb
+++ b/spec/ruby/core/module/alias_method_spec.rb
@@ -28,12 +28,12 @@ describe "Module#alias_method" do
it "retains method visibility" do
@class.make_alias :private_ichi, :private_one
- lambda { @object.private_one }.should raise_error(NameError)
- lambda { @object.private_ichi }.should raise_error(NameError)
+ -> { @object.private_one }.should raise_error(NameError)
+ -> { @object.private_ichi }.should raise_error(NameError)
@class.make_alias :public_ichi, :public_one
@object.public_ichi.should == @object.public_one
@class.make_alias :protected_ichi, :protected_one
- lambda { @object.protected_ichi }.should raise_error(NameError)
+ -> { @object.protected_ichi }.should raise_error(NameError)
end
it "handles aliasing a stub that changes visibility" do
@@ -43,7 +43,7 @@ describe "Module#alias_method" do
end
it "fails if origin method not found" do
- lambda { @class.make_alias :ni, :san }.should raise_error(NameError) { |e|
+ -> { @class.make_alias :ni, :san }.should raise_error(NameError) { |e|
# a NameError and not a NoMethodError
e.class.should == NameError
}
@@ -51,7 +51,7 @@ describe "Module#alias_method" do
it "raises #{frozen_error_class} if frozen" do
@class.freeze
- lambda { @class.make_alias :uno, :public_one }.should raise_error(frozen_error_class)
+ -> { @class.make_alias :uno, :public_one }.should raise_error(frozen_error_class)
end
it "converts the names using #to_str" do
@@ -66,12 +66,12 @@ describe "Module#alias_method" do
end
it "raises a TypeError when the given name can't be converted using to_str" do
- lambda { @class.make_alias mock('x'), :public_one }.should raise_error(TypeError)
+ -> { @class.make_alias mock('x'), :public_one }.should raise_error(TypeError)
end
ruby_version_is ''...'2.5' do
it "is a private method" do
- lambda { @class.alias_method :ichi, :public_one }.should raise_error(NoMethodError)
+ -> { @class.alias_method :ichi, :public_one }.should raise_error(NoMethodError)
end
end
ruby_version_is '2.5' do
@@ -90,7 +90,7 @@ describe "Module#alias_method" do
it "works on private module methods in a module that has been reopened" do
ModuleSpecs::ReopeningModule.foo.should == true
- lambda { ModuleSpecs::ReopeningModule.foo2 }.should_not raise_error(NoMethodError)
+ -> { ModuleSpecs::ReopeningModule.foo2 }.should_not raise_error(NoMethodError)
end
it "accesses a method defined on Object from Kernel" do
diff --git a/spec/ruby/core/module/append_features_spec.rb b/spec/ruby/core/module/append_features_spec.rb
index c5dd64aa6f..584aa11dfa 100644
--- a/spec/ruby/core/module/append_features_spec.rb
+++ b/spec/ruby/core/module/append_features_spec.rb
@@ -12,7 +12,7 @@ describe "Module#append_features" do
end
it "raises a TypeError if calling after rebinded to Class" do
- lambda {
+ -> {
Module.instance_method(:append_features).bind(Class.new).call Module.new
}.should raise_error(TypeError)
end
@@ -37,11 +37,11 @@ describe "Module#append_features" do
end
it "raises an ArgumentError on a cyclic include" do
- lambda {
+ -> {
ModuleSpecs::CyclicAppendA.send(:append_features, ModuleSpecs::CyclicAppendA)
}.should raise_error(ArgumentError)
- lambda {
+ -> {
ModuleSpecs::CyclicAppendB.send(:append_features, ModuleSpecs::CyclicAppendA)
}.should raise_error(ArgumentError)
@@ -66,7 +66,7 @@ describe "Module#append_features" do
end
it "raises a #{frozen_error_class} before appending self" do
- lambda { @receiver.send(:append_features, @other) }.should raise_error(frozen_error_class)
+ -> { @receiver.send(:append_features, @other) }.should raise_error(frozen_error_class)
@other.ancestors.should_not include(@receiver)
end
end
diff --git a/spec/ruby/core/module/attr_accessor_spec.rb b/spec/ruby/core/module/attr_accessor_spec.rb
index b5e3d72524..ce95ccd487 100644
--- a/spec/ruby/core/module/attr_accessor_spec.rb
+++ b/spec/ruby/core/module/attr_accessor_spec.rb
@@ -33,7 +33,7 @@ describe "Module#attr_accessor" do
attr_accessor :spec_attr_accessor
end
- lambda { true.spec_attr_accessor = "a" }.should raise_error(RuntimeError)
+ -> { true.spec_attr_accessor = "a" }.should raise_error(RuntimeError)
end
it "converts non string/symbol/fixnum names to strings using to_str" do
@@ -48,9 +48,9 @@ describe "Module#attr_accessor" do
it "raises a TypeError when the given names can't be converted to strings using to_str" do
o = mock('o')
- lambda { Class.new { attr_accessor o } }.should raise_error(TypeError)
+ -> { Class.new { attr_accessor o } }.should raise_error(TypeError)
(o = mock('123')).should_receive(:to_str).and_return(123)
- lambda { Class.new { attr_accessor o } }.should raise_error(TypeError)
+ -> { Class.new { attr_accessor o } }.should raise_error(TypeError)
end
it "applies current visibility to methods created" do
@@ -59,8 +59,8 @@ describe "Module#attr_accessor" do
attr_accessor :foo
end
- lambda { c.new.foo }.should raise_error(NoMethodError)
- lambda { c.new.foo=1 }.should raise_error(NoMethodError)
+ -> { c.new.foo }.should raise_error(NoMethodError)
+ -> { c.new.foo=1 }.should raise_error(NoMethodError)
end
ruby_version_is ''...'2.5' do
diff --git a/spec/ruby/core/module/attr_reader_spec.rb b/spec/ruby/core/module/attr_reader_spec.rb
index f537b5f1c6..082bc03b60 100644
--- a/spec/ruby/core/module/attr_reader_spec.rb
+++ b/spec/ruby/core/module/attr_reader_spec.rb
@@ -29,7 +29,7 @@ describe "Module#attr_reader" do
attr_reader :spec_attr_reader
end
- lambda { true.instance_variable_set("@spec_attr_reader", "a") }.should raise_error(RuntimeError)
+ -> { true.instance_variable_set("@spec_attr_reader", "a") }.should raise_error(RuntimeError)
end
it "converts non string/symbol/fixnum names to strings using to_str" do
@@ -44,9 +44,9 @@ describe "Module#attr_reader" do
it "raises a TypeError when the given names can't be converted to strings using to_str" do
o = mock('o')
- lambda { Class.new { attr_reader o } }.should raise_error(TypeError)
+ -> { Class.new { attr_reader o } }.should raise_error(TypeError)
(o = mock('123')).should_receive(:to_str).and_return(123)
- lambda { Class.new { attr_reader o } }.should raise_error(TypeError)
+ -> { Class.new { attr_reader o } }.should raise_error(TypeError)
end
it "applies current visibility to methods created" do
@@ -55,7 +55,7 @@ describe "Module#attr_reader" do
attr_reader :foo
end
- lambda { c.new.foo }.should raise_error(NoMethodError)
+ -> { c.new.foo }.should raise_error(NoMethodError)
end
ruby_version_is ''...'2.5' do
diff --git a/spec/ruby/core/module/attr_spec.rb b/spec/ruby/core/module/attr_spec.rb
index 16680730d5..20316a3d39 100644
--- a/spec/ruby/core/module/attr_spec.rb
+++ b/spec/ruby/core/module/attr_spec.rb
@@ -89,8 +89,8 @@ describe "Module#attr" do
attr :foo, true
end
- lambda { c.new.foo }.should raise_error(NoMethodError)
- lambda { c.new.foo=1 }.should raise_error(NoMethodError)
+ -> { c.new.foo }.should raise_error(NoMethodError)
+ -> { c.new.foo=1 }.should raise_error(NoMethodError)
end
it "creates a getter but no setter for all given attribute names" do
@@ -120,8 +120,8 @@ describe "Module#attr" do
attr :foo, :bar
end
- lambda { c.new.foo }.should raise_error(NoMethodError)
- lambda { c.new.bar }.should raise_error(NoMethodError)
+ -> { c.new.foo }.should raise_error(NoMethodError)
+ -> { c.new.bar }.should raise_error(NoMethodError)
end
it "converts non string/symbol/fixnum names to strings using to_str" do
@@ -131,13 +131,13 @@ describe "Module#attr" do
it "raises a TypeError when the given names can't be converted to strings using to_str" do
o = mock('o')
- lambda { Class.new { attr o } }.should raise_error(TypeError)
+ -> { Class.new { attr o } }.should raise_error(TypeError)
(o = mock('123')).should_receive(:to_str).and_return(123)
- lambda { Class.new { attr o } }.should raise_error(TypeError)
+ -> { Class.new { attr o } }.should raise_error(TypeError)
end
it "with a boolean argument emits a warning when $VERBOSE is true" do
- lambda {
+ -> {
Class.new { attr :foo, true }
}.should complain(/boolean argument is obsoleted/, verbose: true)
end
diff --git a/spec/ruby/core/module/attr_writer_spec.rb b/spec/ruby/core/module/attr_writer_spec.rb
index ea77f81f28..3b110cecf7 100644
--- a/spec/ruby/core/module/attr_writer_spec.rb
+++ b/spec/ruby/core/module/attr_writer_spec.rb
@@ -29,7 +29,7 @@ describe "Module#attr_writer" do
attr_writer :spec_attr_writer
end
- lambda { true.spec_attr_writer = "a" }.should raise_error(RuntimeError)
+ -> { true.spec_attr_writer = "a" }.should raise_error(RuntimeError)
end
it "converts non string/symbol/fixnum names to strings using to_str" do
@@ -44,9 +44,9 @@ describe "Module#attr_writer" do
it "raises a TypeError when the given names can't be converted to strings using to_str" do
o = mock('test1')
- lambda { Class.new { attr_writer o } }.should raise_error(TypeError)
+ -> { Class.new { attr_writer o } }.should raise_error(TypeError)
(o = mock('123')).should_receive(:to_str).and_return(123)
- lambda { Class.new { attr_writer o } }.should raise_error(TypeError)
+ -> { Class.new { attr_writer o } }.should raise_error(TypeError)
end
it "applies current visibility to methods created" do
@@ -55,7 +55,7 @@ describe "Module#attr_writer" do
attr_writer :foo
end
- lambda { c.new.foo=1 }.should raise_error(NoMethodError)
+ -> { c.new.foo=1 }.should raise_error(NoMethodError)
end
ruby_version_is ''...'2.5' do
diff --git a/spec/ruby/core/module/autoload_spec.rb b/spec/ruby/core/module/autoload_spec.rb
index ca4c63838c..6a1efa1ec2 100644
--- a/spec/ruby/core/module/autoload_spec.rb
+++ b/spec/ruby/core/module/autoload_spec.rb
@@ -189,7 +189,7 @@ describe "Module#autoload" do
ModuleSpecs::Autoload.autoload :NotThere, filename
ModuleSpecs::Autoload.autoload?(:NotThere).should == filename
- lambda {
+ -> {
require filename
}.should raise_error(LoadError)
@@ -385,13 +385,13 @@ describe "Module#autoload" do
ModuleSpecs::Autoload.should have_constant(:Fail)
ModuleSpecs::Autoload.autoload?(:Fail).should == @non_existent
- lambda { ModuleSpecs::Autoload::Fail }.should raise_error(LoadError)
+ -> { ModuleSpecs::Autoload::Fail }.should raise_error(LoadError)
ModuleSpecs::Autoload.should have_constant(:Fail)
ModuleSpecs::Autoload.const_defined?(:Fail).should == true
ModuleSpecs::Autoload.autoload?(:Fail).should == @non_existent
- lambda { ModuleSpecs::Autoload::Fail }.should raise_error(LoadError)
+ -> { ModuleSpecs::Autoload::Fail }.should raise_error(LoadError)
end
it "does not remove the constant from Module#constants if load raises a RuntimeError and keeps it as an autoload" do
@@ -403,14 +403,14 @@ describe "Module#autoload" do
ModuleSpecs::Autoload.should have_constant(:Raise)
ModuleSpecs::Autoload.autoload?(:Raise).should == path
- lambda { ModuleSpecs::Autoload::Raise }.should raise_error(RuntimeError)
+ -> { ModuleSpecs::Autoload::Raise }.should raise_error(RuntimeError)
ScratchPad.recorded.should == [:raise]
ModuleSpecs::Autoload.should have_constant(:Raise)
ModuleSpecs::Autoload.const_defined?(:Raise).should == true
ModuleSpecs::Autoload.autoload?(:Raise).should == path
- lambda { ModuleSpecs::Autoload::Raise }.should raise_error(RuntimeError)
+ -> { ModuleSpecs::Autoload::Raise }.should raise_error(RuntimeError)
ScratchPad.recorded.should == [:raise, :raise]
end
@@ -423,7 +423,7 @@ describe "Module#autoload" do
ModuleSpecs::Autoload.should have_constant(:O)
ModuleSpecs::Autoload.autoload?(:O).should == path
- lambda { ModuleSpecs::Autoload::O }.should raise_error(NameError)
+ -> { ModuleSpecs::Autoload::O }.should raise_error(NameError)
ModuleSpecs::Autoload.should have_constant(:O)
ModuleSpecs::Autoload.const_defined?(:O).should == false
@@ -659,19 +659,19 @@ describe "Module#autoload" do
end
it "raises an ArgumentError when an empty filename is given" do
- lambda { ModuleSpecs.autoload :A, "" }.should raise_error(ArgumentError)
+ -> { ModuleSpecs.autoload :A, "" }.should raise_error(ArgumentError)
end
it "raises a NameError when the constant name starts with a lower case letter" do
- lambda { ModuleSpecs.autoload "a", @non_existent }.should raise_error(NameError)
+ -> { ModuleSpecs.autoload "a", @non_existent }.should raise_error(NameError)
end
it "raises a NameError when the constant name starts with a number" do
- lambda { ModuleSpecs.autoload "1two", @non_existent }.should raise_error(NameError)
+ -> { ModuleSpecs.autoload "1two", @non_existent }.should raise_error(NameError)
end
it "raises a NameError when the constant name has a space in it" do
- lambda { ModuleSpecs.autoload "a name", @non_existent }.should raise_error(NameError)
+ -> { ModuleSpecs.autoload "a name", @non_existent }.should raise_error(NameError)
end
it "shares the autoload request across dup'ed copies of modules" do
@@ -679,7 +679,7 @@ describe "Module#autoload" do
@remove << :S
filename = fixture(__FILE__, "autoload_t.rb")
mod1 = Module.new { autoload :T, filename }
- lambda {
+ -> {
ModuleSpecs::Autoload::S = mod1
}.should complain(/already initialized constant/)
mod2 = mod1.dup
@@ -688,7 +688,7 @@ describe "Module#autoload" do
mod2.autoload?(:T).should == filename
mod1::T.should == :autoload_t
- lambda { mod2::T }.should raise_error(NameError)
+ -> { mod2::T }.should raise_error(NameError)
end
it "raises a TypeError if opening a class with a different superclass than the class defined in the autoload file" do
@@ -696,7 +696,7 @@ describe "Module#autoload" do
class ModuleSpecs::Autoload::ZZ
end
- lambda do
+ -> do
class ModuleSpecs::Autoload::Z < ModuleSpecs::Autoload::ZZ
end
end.should raise_error(TypeError)
@@ -705,20 +705,20 @@ describe "Module#autoload" do
it "raises a TypeError if not passed a String or object responding to #to_path for the filename" do
name = mock("autoload_name.rb")
- lambda { ModuleSpecs::Autoload.autoload :Str, name }.should raise_error(TypeError)
+ -> { ModuleSpecs::Autoload.autoload :Str, name }.should raise_error(TypeError)
end
it "calls #to_path on non-String filename arguments" do
name = mock("autoload_name.rb")
name.should_receive(:to_path).and_return("autoload_name.rb")
- lambda { ModuleSpecs::Autoload.autoload :Str, name }.should_not raise_error
+ -> { ModuleSpecs::Autoload.autoload :Str, name }.should_not raise_error
end
describe "on a frozen module" do
it "raises a #{frozen_error_class} before setting the name" do
frozen_module = Module.new.freeze
- lambda { frozen_module.autoload :Foo, @non_existent }.should raise_error(frozen_error_class)
+ -> { frozen_module.autoload :Foo, @non_existent }.should raise_error(frozen_error_class)
frozen_module.should_not have_constant(:Foo)
end
end
diff --git a/spec/ruby/core/module/class_variable_defined_spec.rb b/spec/ruby/core/module/class_variable_defined_spec.rb
index 25fd73a136..f867d383c3 100644
--- a/spec/ruby/core/module/class_variable_defined_spec.rb
+++ b/spec/ruby/core/module/class_variable_defined_spec.rb
@@ -42,11 +42,11 @@ describe "Module#class_variable_defined?" do
it "raises a NameError when the given name is not allowed" do
c = Class.new
- lambda {
+ -> {
c.class_variable_defined?(:invalid_name)
}.should raise_error(NameError)
- lambda {
+ -> {
c.class_variable_defined?("@invalid_name")
}.should raise_error(NameError)
end
@@ -60,12 +60,12 @@ describe "Module#class_variable_defined?" do
it "raises a TypeError when the given names can't be converted to strings using to_str" do
c = Class.new { class_variable_set :@@class_var, "test" }
o = mock('123')
- lambda {
+ -> {
c.class_variable_defined?(o)
}.should raise_error(TypeError)
o.should_receive(:to_str).and_return(123)
- lambda {
+ -> {
c.class_variable_defined?(o)
}.should raise_error(TypeError)
end
diff --git a/spec/ruby/core/module/class_variable_get_spec.rb b/spec/ruby/core/module/class_variable_get_spec.rb
index 7619c135ab..79d22a506b 100644
--- a/spec/ruby/core/module/class_variable_get_spec.rb
+++ b/spec/ruby/core/module/class_variable_get_spec.rb
@@ -15,14 +15,14 @@ describe "Module#class_variable_get" do
it "raises a NameError for a class variable named '@@'" do
c = Class.new
- lambda { c.send(:class_variable_get, "@@") }.should raise_error(NameError)
- lambda { c.send(:class_variable_get, :"@@") }.should raise_error(NameError)
+ -> { c.send(:class_variable_get, "@@") }.should raise_error(NameError)
+ -> { c.send(:class_variable_get, :"@@") }.should raise_error(NameError)
end
it "raises a NameError for a class variables with the given name defined in an extended module" do
c = Class.new
c.extend ModuleSpecs::MVars
- lambda {
+ -> {
c.send(:class_variable_get, "@@mvar")
}.should raise_error(NameError)
end
@@ -49,15 +49,15 @@ describe "Module#class_variable_get" do
it "raises a NameError when an uninitialized class variable is accessed" do
c = Class.new
[:@@no_class_var, "@@no_class_var"].each do |cvar|
- lambda { c.send(:class_variable_get, cvar) }.should raise_error(NameError)
+ -> { c.send(:class_variable_get, cvar) }.should raise_error(NameError)
end
end
it "raises a NameError when the given name is not allowed" do
c = Class.new
- lambda { c.send(:class_variable_get, :invalid_name) }.should raise_error(NameError)
- lambda { c.send(:class_variable_get, "@invalid_name") }.should raise_error(NameError)
+ -> { c.send(:class_variable_get, :invalid_name) }.should raise_error(NameError)
+ -> { c.send(:class_variable_get, "@invalid_name") }.should raise_error(NameError)
end
it "converts a non string/symbol/fixnum name to string using to_str" do
@@ -69,8 +69,8 @@ describe "Module#class_variable_get" do
it "raises a TypeError when the given names can't be converted to strings using to_str" do
c = Class.new { class_variable_set :@@class_var, "test" }
o = mock('123')
- lambda { c.send(:class_variable_get, o) }.should raise_error(TypeError)
+ -> { c.send(:class_variable_get, o) }.should raise_error(TypeError)
o.should_receive(:to_str).and_return(123)
- lambda { c.send(:class_variable_get, o) }.should raise_error(TypeError)
+ -> { c.send(:class_variable_get, o) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/module/class_variable_set_spec.rb b/spec/ruby/core/module/class_variable_set_spec.rb
index dcb5da87b6..204bbaf75e 100644
--- a/spec/ruby/core/module/class_variable_set_spec.rb
+++ b/spec/ruby/core/module/class_variable_set_spec.rb
@@ -26,10 +26,10 @@ describe "Module#class_variable_set" do
end
it "raises a #{frozen_error_class} when self is frozen" do
- lambda {
+ -> {
Class.new.freeze.send(:class_variable_set, :@@test, "test")
}.should raise_error(frozen_error_class)
- lambda {
+ -> {
Module.new.freeze.send(:class_variable_set, :@@test, "test")
}.should raise_error(frozen_error_class)
end
@@ -37,10 +37,10 @@ describe "Module#class_variable_set" do
it "raises a NameError when the given name is not allowed" do
c = Class.new
- lambda {
+ -> {
c.send(:class_variable_set, :invalid_name, "test")
}.should raise_error(NameError)
- lambda {
+ -> {
c.send(:class_variable_set, "@invalid_name", "test")
}.should raise_error(NameError)
end
@@ -55,8 +55,8 @@ describe "Module#class_variable_set" do
it "raises a TypeError when the given names can't be converted to strings using to_str" do
c = Class.new { class_variable_set :@@class_var, "test" }
o = mock('123')
- lambda { c.send(:class_variable_set, o, "test") }.should raise_error(TypeError)
+ -> { c.send(:class_variable_set, o, "test") }.should raise_error(TypeError)
o.should_receive(:to_str).and_return(123)
- lambda { c.send(:class_variable_set, o, "test") }.should raise_error(TypeError)
+ -> { c.send(:class_variable_set, o, "test") }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/module/const_defined_spec.rb b/spec/ruby/core/module/const_defined_spec.rb
index cb1674c7e7..0673adca3d 100644
--- a/spec/ruby/core/module/const_defined_spec.rb
+++ b/spec/ruby/core/module/const_defined_spec.rb
@@ -105,19 +105,19 @@ describe "Module#const_defined?" do
end
it "raises a NameError if the name does not start with a capital letter" do
- lambda { ConstantSpecs.const_defined? "name" }.should raise_error(NameError)
+ -> { ConstantSpecs.const_defined? "name" }.should raise_error(NameError)
end
it "raises a NameError if the name starts with '_'" do
- lambda { ConstantSpecs.const_defined? "__CONSTX__" }.should raise_error(NameError)
+ -> { ConstantSpecs.const_defined? "__CONSTX__" }.should raise_error(NameError)
end
it "raises a NameError if the name starts with '@'" do
- lambda { ConstantSpecs.const_defined? "@Name" }.should raise_error(NameError)
+ -> { ConstantSpecs.const_defined? "@Name" }.should raise_error(NameError)
end
it "raises a NameError if the name starts with '!'" do
- lambda { ConstantSpecs.const_defined? "!Name" }.should raise_error(NameError)
+ -> { ConstantSpecs.const_defined? "!Name" }.should raise_error(NameError)
end
it "returns true or false for the nested name" do
@@ -130,15 +130,15 @@ describe "Module#const_defined?" do
it "raises a NameError if the name contains non-alphabetic characters except '_'" do
ConstantSpecs.const_defined?("CS_CONSTX").should == false
- lambda { ConstantSpecs.const_defined? "Name=" }.should raise_error(NameError)
- lambda { ConstantSpecs.const_defined? "Name?" }.should raise_error(NameError)
+ -> { ConstantSpecs.const_defined? "Name=" }.should raise_error(NameError)
+ -> { ConstantSpecs.const_defined? "Name?" }.should raise_error(NameError)
end
it "raises a TypeError if conversion to a String by calling #to_str fails" do
name = mock('123')
- lambda { ConstantSpecs.const_defined? name }.should raise_error(TypeError)
+ -> { ConstantSpecs.const_defined? name }.should raise_error(TypeError)
name.should_receive(:to_str).and_return(123)
- lambda { ConstantSpecs.const_defined? name }.should raise_error(TypeError)
+ -> { ConstantSpecs.const_defined? name }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/module/const_get_spec.rb b/spec/ruby/core/module/const_get_spec.rb
index d125c35762..0a6702903f 100644
--- a/spec/ruby/core/module/const_get_spec.rb
+++ b/spec/ruby/core/module/const_get_spec.rb
@@ -9,28 +9,28 @@ describe "Module#const_get" do
end
it "raises a NameError if no constant is defined in the search path" do
- lambda { ConstantSpecs.const_get :CS_CONSTX }.should raise_error(NameError)
+ -> { ConstantSpecs.const_get :CS_CONSTX }.should raise_error(NameError)
end
it "raises a NameError with the not found constant symbol" do
- error_inspection = lambda { |e| e.name.should == :CS_CONSTX }
- lambda { ConstantSpecs.const_get :CS_CONSTX }.should raise_error(NameError, &error_inspection)
+ error_inspection = -> e { e.name.should == :CS_CONSTX }
+ -> { ConstantSpecs.const_get :CS_CONSTX }.should raise_error(NameError, &error_inspection)
end
it "raises a NameError if the name does not start with a capital letter" do
- lambda { ConstantSpecs.const_get "name" }.should raise_error(NameError)
+ -> { ConstantSpecs.const_get "name" }.should raise_error(NameError)
end
it "raises a NameError if the name starts with a non-alphabetic character" do
- lambda { ConstantSpecs.const_get "__CONSTX__" }.should raise_error(NameError)
- lambda { ConstantSpecs.const_get "@CS_CONST1" }.should raise_error(NameError)
- lambda { ConstantSpecs.const_get "!CS_CONST1" }.should raise_error(NameError)
+ -> { ConstantSpecs.const_get "__CONSTX__" }.should raise_error(NameError)
+ -> { ConstantSpecs.const_get "@CS_CONST1" }.should raise_error(NameError)
+ -> { ConstantSpecs.const_get "!CS_CONST1" }.should raise_error(NameError)
end
it "raises a NameError if the name contains non-alphabetic characters except '_'" do
Object.const_get("CS_CONST1").should == :const1
- lambda { ConstantSpecs.const_get "CS_CONST1=" }.should raise_error(NameError)
- lambda { ConstantSpecs.const_get "CS_CONST1?" }.should raise_error(NameError)
+ -> { ConstantSpecs.const_get "CS_CONST1=" }.should raise_error(NameError)
+ -> { ConstantSpecs.const_get "CS_CONST1?" }.should raise_error(NameError)
end
it "calls #to_str to convert the given name to a String" do
@@ -41,10 +41,10 @@ describe "Module#const_get" do
it "raises a TypeError if conversion to a String by calling #to_str fails" do
name = mock('123')
- lambda { ConstantSpecs.const_get(name) }.should raise_error(TypeError)
+ -> { ConstantSpecs.const_get(name) }.should raise_error(TypeError)
name.should_receive(:to_str).and_return(123)
- lambda { ConstantSpecs.const_get(name) }.should raise_error(TypeError)
+ -> { ConstantSpecs.const_get(name) }.should raise_error(TypeError)
end
it "calls #const_missing on the receiver if unable to locate the constant" do
@@ -53,21 +53,21 @@ describe "Module#const_get" do
end
it "does not search the singleton class of a Class or Module" do
- lambda do
+ -> do
ConstantSpecs::ContainerA::ChildA.const_get(:CS_CONST14)
end.should raise_error(NameError)
- lambda { ConstantSpecs.const_get(:CS_CONST14) }.should raise_error(NameError)
+ -> { ConstantSpecs.const_get(:CS_CONST14) }.should raise_error(NameError)
end
it "does not search the containing scope" do
ConstantSpecs::ContainerA::ChildA.const_get(:CS_CONST20).should == :const20_2
- lambda do
+ -> do
ConstantSpecs::ContainerA::ChildA.const_get(:CS_CONST5)
end.should raise_error(NameError)
end
it "raises a NameError if the constant is defined in the receiver's superclass and the inherit flag is false" do
- lambda do
+ -> do
ConstantSpecs::ContainerA::ChildA.const_get(:CS_CONST4, false)
end.should raise_error(NameError)
end
@@ -77,13 +77,13 @@ describe "Module#const_get" do
end
it "raises a NameError when the receiver is a Module, the constant is defined at toplevel and the inherit flag is false" do
- lambda do
+ -> do
ConstantSpecs::ModuleA.const_get(:CS_CONST1, false)
end.should raise_error(NameError)
end
it "raises a NameError when the receiver is a Class, the constant is defined at toplevel and the inherit flag is false" do
- lambda do
+ -> do
ConstantSpecs::ContainerA::ChildA.const_get(:CS_CONST1, false)
end.should raise_error(NameError)
end
@@ -97,19 +97,19 @@ describe "Module#const_get" do
end
it "raises a NameError if the name includes two successive scope separators" do
- lambda { ConstantSpecs.const_get("ClassA::::CS_CONST10") }.should raise_error(NameError)
+ -> { ConstantSpecs.const_get("ClassA::::CS_CONST10") }.should raise_error(NameError)
end
it "raises a NameError if only '::' is passed" do
- lambda { ConstantSpecs.const_get("::") }.should raise_error(NameError)
+ -> { ConstantSpecs.const_get("::") }.should raise_error(NameError)
end
it "raises a NameError if a Symbol has a toplevel scope qualifier" do
- lambda { ConstantSpecs.const_get(:'::CS_CONST1') }.should raise_error(NameError)
+ -> { ConstantSpecs.const_get(:'::CS_CONST1') }.should raise_error(NameError)
end
it "raises a NameError if a Symbol is a scoped constant name" do
- lambda { ConstantSpecs.const_get(:'ClassA::CS_CONST10') }.should raise_error(NameError)
+ -> { ConstantSpecs.const_get(:'ClassA::CS_CONST10') }.should raise_error(NameError)
end
it "does read private constants" do
@@ -220,7 +220,7 @@ describe "Module#const_get" do
ConstantSpecs::ClassB::CS_CONST309 = :const309_1
ConstantSpecs::ClassB.const_get(:CS_CONST309).should == :const309_1
- lambda {
+ -> {
ConstantSpecs::ClassB::CS_CONST309 = :const309_2
}.should complain(/already initialized constant/)
ConstantSpecs::ClassB.const_get(:CS_CONST309).should == :const309_2
diff --git a/spec/ruby/core/module/const_missing_spec.rb b/spec/ruby/core/module/const_missing_spec.rb
index 930fe63f8b..742218281c 100644
--- a/spec/ruby/core/module/const_missing_spec.rb
+++ b/spec/ruby/core/module/const_missing_spec.rb
@@ -11,7 +11,7 @@ describe "Module#const_missing" do
end
it "raises NameError and includes the name of the value that wasn't found" do
- lambda {
+ -> {
ConstantSpecs.const_missing("HelloMissing")
}.should raise_error(NameError, /ConstantSpecs::HelloMissing/)
end
diff --git a/spec/ruby/core/module/const_set_spec.rb b/spec/ruby/core/module/const_set_spec.rb
index 25d22ffaba..1b8b86dd04 100644
--- a/spec/ruby/core/module/const_set_spec.rb
+++ b/spec/ruby/core/module/const_set_spec.rb
@@ -41,20 +41,20 @@ describe "Module#const_set" do
end
it "raises a NameError if the name does not start with a capital letter" do
- lambda { ConstantSpecs.const_set "name", 1 }.should raise_error(NameError)
+ -> { ConstantSpecs.const_set "name", 1 }.should raise_error(NameError)
end
it "raises a NameError if the name starts with a non-alphabetic character" do
- lambda { ConstantSpecs.const_set "__CONSTX__", 1 }.should raise_error(NameError)
- lambda { ConstantSpecs.const_set "@Name", 1 }.should raise_error(NameError)
- lambda { ConstantSpecs.const_set "!Name", 1 }.should raise_error(NameError)
- lambda { ConstantSpecs.const_set "::Name", 1 }.should raise_error(NameError)
+ -> { ConstantSpecs.const_set "__CONSTX__", 1 }.should raise_error(NameError)
+ -> { ConstantSpecs.const_set "@Name", 1 }.should raise_error(NameError)
+ -> { ConstantSpecs.const_set "!Name", 1 }.should raise_error(NameError)
+ -> { ConstantSpecs.const_set "::Name", 1 }.should raise_error(NameError)
end
it "raises a NameError if the name contains non-alphabetic characters except '_'" do
ConstantSpecs.const_set("CS_CONST404", :const404).should == :const404
- lambda { ConstantSpecs.const_set "Name=", 1 }.should raise_error(NameError)
- lambda { ConstantSpecs.const_set "Name?", 1 }.should raise_error(NameError)
+ -> { ConstantSpecs.const_set "Name=", 1 }.should raise_error(NameError)
+ -> { ConstantSpecs.const_set "Name?", 1 }.should raise_error(NameError)
end
it "calls #to_str to convert the given name to a String" do
@@ -66,10 +66,10 @@ describe "Module#const_set" do
it "raises a TypeError if conversion to a String by calling #to_str fails" do
name = mock('123')
- lambda { ConstantSpecs.const_set name, 1 }.should raise_error(TypeError)
+ -> { ConstantSpecs.const_set name, 1 }.should raise_error(TypeError)
name.should_receive(:to_str).and_return(123)
- lambda { ConstantSpecs.const_set name, 1 }.should raise_error(TypeError)
+ -> { ConstantSpecs.const_set name, 1 }.should raise_error(TypeError)
end
describe "when overwriting an existing constant" do
@@ -126,7 +126,7 @@ describe "Module#const_set" do
end
it "raises a #{frozen_error_class} before setting the name" do
- lambda { @frozen.const_set @name, nil }.should raise_error(frozen_error_class)
+ -> { @frozen.const_set @name, nil }.should raise_error(frozen_error_class)
@frozen.should_not have_constant(@name)
end
end
diff --git a/spec/ruby/core/module/define_method_spec.rb b/spec/ruby/core/module/define_method_spec.rb
index 3f35c051a1..29394e5b92 100644
--- a/spec/ruby/core/module/define_method_spec.rb
+++ b/spec/ruby/core/module/define_method_spec.rb
@@ -12,7 +12,7 @@ describe "passed { |a, b = 1| } creates a method that" do
end
it "raises an ArgumentError when passed zero arguments" do
- lambda { @klass.new.m }.should raise_error(ArgumentError)
+ -> { @klass.new.m }.should raise_error(ArgumentError)
end
it "has a default value for b when passed one argument" do
@@ -24,7 +24,7 @@ describe "passed { |a, b = 1| } creates a method that" do
end
it "raises an ArgumentError when passed three arguments" do
- lambda { @klass.new.m(1, 2, 3) }.should raise_error(ArgumentError)
+ -> { @klass.new.m(1, 2, 3) }.should raise_error(ArgumentError)
end
end
@@ -83,7 +83,7 @@ describe "Module#define_method when given an UnboundMethod" do
define_method :piggy, instance_method(:ziggy)
end
- lambda { foo.new.ziggy }.should raise_error(NoMethodError)
+ -> { foo.new.ziggy }.should raise_error(NoMethodError)
foo.new.piggy.should == 'piggy'
end
end
@@ -194,7 +194,7 @@ describe "Module#define_method" do
it "defines a new method with the given name and the given block as body in self" do
class DefineMethodSpecClass
define_method(:block_test1) { self }
- define_method(:block_test2, &lambda { self })
+ define_method(:block_test2, &-> { self })
end
o = DefineMethodSpecClass.new
@@ -203,21 +203,21 @@ describe "Module#define_method" do
end
it "raises a TypeError when the given method is no Method/Proc" do
- lambda {
+ -> {
Class.new { define_method(:test, "self") }
}.should raise_error(TypeError)
- lambda {
+ -> {
Class.new { define_method(:test, 1234) }
}.should raise_error(TypeError)
- lambda {
+ -> {
Class.new { define_method(:test, nil) }
}.should raise_error(TypeError)
end
it "raises an ArgumentError when no block is given" do
- lambda {
+ -> {
Class.new { define_method(:test) }
}.should raise_error(ArgumentError)
end
@@ -230,7 +230,7 @@ describe "Module#define_method" do
end
end
- lambda {
+ -> {
o.define(:foo) { raise "not used" }
}.should raise_error(ArgumentError)
end
@@ -242,11 +242,11 @@ describe "Module#define_method" do
end
obj = DefineMethodSpecClass.new
- lambda { obj.proc_style_test :arg }.should raise_error(ArgumentError)
+ -> { obj.proc_style_test :arg }.should raise_error(ArgumentError)
end
it "raises a #{frozen_error_class} if frozen" do
- lambda {
+ -> {
Class.new { freeze; define_method(:foo) {} }
}.should raise_error(frozen_error_class)
end
@@ -267,7 +267,7 @@ describe "Module#define_method" do
c = klass.new
c.data = :bar
c.other_inspect.should == "data is bar"
- lambda{o.other_inspect}.should raise_error(NoMethodError)
+ ->{o.other_inspect}.should raise_error(NoMethodError)
end
it "raises a TypeError when a Method from a singleton class is defined on another class" do
@@ -279,9 +279,9 @@ describe "Module#define_method" do
end
m = c.method(:foo)
- lambda {
+ -> {
Class.new { define_method :bar, m }
- }.should raise_error(TypeError)
+ }.should raise_error(TypeError, /can't bind singleton method to a different class/)
end
it "raises a TypeError when a Method from one class is defined on an unrelated class" do
@@ -291,7 +291,7 @@ describe "Module#define_method" do
end
m = c.new.method(:foo)
- lambda {
+ -> {
Class.new { define_method :bar, m }
}.should raise_error(TypeError)
end
@@ -305,7 +305,7 @@ describe "Module#define_method" do
o = DefineMethodSpecClass.new
DefineMethodSpecClass.send(:undef_method, :accessor_method)
- lambda { o.accessor_method }.should raise_error(NoMethodError)
+ -> { o.accessor_method }.should raise_error(NoMethodError)
DefineMethodSpecClass.send(:define_method, :accessor_method, m)
@@ -396,20 +396,42 @@ describe "Module#define_method" do
klass.new.should respond_to(:bar)
end
+
+ it "allows an UnboundMethod of a Kernel method retrieved from Object to defined on a BasicObject subclass" do
+ klass = Class.new(BasicObject) do
+ define_method :instance_of?, ::Object.instance_method(:instance_of?)
+ end
+ klass.new.instance_of?(klass).should == true
+ end
+
it "raises a TypeError when an UnboundMethod from a child class is defined on a parent class" do
- lambda {
+ -> {
ParentClass = Class.new { define_method(:foo) { :bar } }
ChildClass = Class.new(ParentClass) { define_method(:foo) { :baz } }
ParentClass.send :define_method, :foo, ChildClass.instance_method(:foo)
- }.should raise_error(TypeError)
+ }.should raise_error(TypeError, /bind argument must be a subclass of ChildClass/)
end
it "raises a TypeError when an UnboundMethod from one class is defined on an unrelated class" do
- lambda {
+ -> {
DestinationClass = Class.new {
define_method :bar, ModuleSpecs::InstanceMeth.instance_method(:foo)
}
- }.should raise_error(TypeError)
+ }.should raise_error(TypeError, /bind argument must be a subclass of ModuleSpecs::InstanceMeth/)
+ end
+
+ it "raises a TypeError when an UnboundMethod from a singleton class is defined on another class" do
+ c = Class.new do
+ class << self
+ def foo
+ end
+ end
+ end
+ m = c.method(:foo).unbind
+
+ -> {
+ Class.new { define_method :bar, m }
+ }.should raise_error(TypeError, /can't bind singleton method to a different class/)
end
end
@@ -426,11 +448,11 @@ describe "Module#define_method" do
end
it "raises an ArgumentError when passed one argument" do
- lambda { @klass.new.m 1 }.should raise_error(ArgumentError)
+ -> { @klass.new.m 1 }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when passed two arguments" do
- lambda { @klass.new.m 1, 2 }.should raise_error(ArgumentError)
+ -> { @klass.new.m 1, 2 }.should raise_error(ArgumentError)
end
end
@@ -446,11 +468,11 @@ describe "Module#define_method" do
end
it "raises an ArgumentError when passed one argument" do
- lambda { @klass.new.m 1 }.should raise_error(ArgumentError)
+ -> { @klass.new.m 1 }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when passed two arguments" do
- lambda { @klass.new.m 1, 2 }.should raise_error(ArgumentError)
+ -> { @klass.new.m 1, 2 }.should raise_error(ArgumentError)
end
end
@@ -462,15 +484,15 @@ describe "Module#define_method" do
end
it "raises an ArgumentError when passed zero arguments" do
- lambda { @klass.new.m }.should raise_error(ArgumentError)
+ -> { @klass.new.m }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when passed zero arguments and a block" do
- lambda { @klass.new.m { :computed } }.should raise_error(ArgumentError)
+ -> { @klass.new.m { :computed } }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when passed two arguments" do
- lambda { @klass.new.m 1, 2 }.should raise_error(ArgumentError)
+ -> { @klass.new.m 1, 2 }.should raise_error(ArgumentError)
end
it "receives the value passed as the argument when passed one argument" do
@@ -507,7 +529,7 @@ describe "Module#define_method" do
end
it "raises an ArgumentError when passed zero arguments" do
- lambda { @klass.new.m }.should raise_error(ArgumentError)
+ -> { @klass.new.m }.should raise_error(ArgumentError)
end
it "returns the value computed by the block when passed one argument" do
@@ -535,19 +557,19 @@ describe "Module#define_method" do
end
it "raises an ArgumentError when passed zero arguments" do
- lambda { @klass.new.m }.should raise_error(ArgumentError)
+ -> { @klass.new.m }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when passed one argument" do
- lambda { @klass.new.m 1 }.should raise_error(ArgumentError)
+ -> { @klass.new.m 1 }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when passed one argument and a block" do
- lambda { @klass.new.m(1) { } }.should raise_error(ArgumentError)
+ -> { @klass.new.m(1) { } }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when passed three arguments" do
- lambda { @klass.new.m 1, 2, 3 }.should raise_error(ArgumentError)
+ -> { @klass.new.m 1, 2, 3 }.should raise_error(ArgumentError)
end
end
@@ -559,15 +581,15 @@ describe "Module#define_method" do
end
it "raises an ArgumentError when passed zero arguments" do
- lambda { @klass.new.m }.should raise_error(ArgumentError)
+ -> { @klass.new.m }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when passed one argument" do
- lambda { @klass.new.m 1 }.should raise_error(ArgumentError)
+ -> { @klass.new.m 1 }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when passed one argument and a block" do
- lambda { @klass.new.m(1) { } }.should raise_error(ArgumentError)
+ -> { @klass.new.m(1) { } }.should raise_error(ArgumentError)
end
it "receives an empty array as the third argument when passed two arguments" do
diff --git a/spec/ruby/core/module/define_singleton_method_spec.rb b/spec/ruby/core/module/define_singleton_method_spec.rb
index f2b8a5ada4..eb5cb89ed1 100644
--- a/spec/ruby/core/module/define_singleton_method_spec.rb
+++ b/spec/ruby/core/module/define_singleton_method_spec.rb
@@ -6,7 +6,7 @@ describe "Module#define_singleton_method" do
define_singleton_method :a do
42
end
- define_singleton_method(:b, lambda {|x| 2*x })
+ define_singleton_method(:b, -> x { 2*x })
end
klass.a.should == 42
diff --git a/spec/ruby/core/module/deprecate_constant_spec.rb b/spec/ruby/core/module/deprecate_constant_spec.rb
index 0954a6d8a5..7bcced981b 100644
--- a/spec/ruby/core/module/deprecate_constant_spec.rb
+++ b/spec/ruby/core/module/deprecate_constant_spec.rb
@@ -17,27 +17,27 @@ describe "Module#deprecate_constant" do
@module.deprecate_constant :PUBLIC1
value = nil
- lambda {
+ -> {
value = @module::PUBLIC1
}.should complain(@pattern)
value.should equal(@value)
- lambda { @module::PRIVATE }.should raise_error(NameError)
+ -> { @module::PRIVATE }.should raise_error(NameError)
end
it "warns with a message" do
@module.deprecate_constant :PUBLIC1
- lambda { @module::PUBLIC1 }.should complain(@pattern)
- lambda { @module.const_get :PRIVATE }.should complain(@pattern)
+ -> { @module::PUBLIC1 }.should complain(@pattern)
+ -> { @module.const_get :PRIVATE }.should complain(@pattern)
end
end
it "accepts multiple symbols and strings as constant names" do
@module.deprecate_constant "PUBLIC1", :PUBLIC2
- lambda { @module::PUBLIC1 }.should complain(@pattern)
- lambda { @module::PUBLIC2 }.should complain(@pattern)
+ -> { @module::PUBLIC1 }.should complain(@pattern)
+ -> { @module::PUBLIC2 }.should complain(@pattern)
end
it "returns self" do
@@ -45,6 +45,6 @@ describe "Module#deprecate_constant" do
end
it "raises a NameError when given an undefined name" do
- lambda { @module.deprecate_constant :UNDEFINED }.should raise_error(NameError)
+ -> { @module.deprecate_constant :UNDEFINED }.should raise_error(NameError)
end
end
diff --git a/spec/ruby/core/module/extend_object_spec.rb b/spec/ruby/core/module/extend_object_spec.rb
index df16f03ea0..bc97a55e7c 100644
--- a/spec/ruby/core/module/extend_object_spec.rb
+++ b/spec/ruby/core/module/extend_object_spec.rb
@@ -16,7 +16,7 @@ describe "Module#extend_object" do
end
it "raises a TypeError if calling after rebinded to Class" do
- lambda {
+ -> {
Module.instance_method(:extend_object).bind(Class.new).call Object.new
}.should raise_error(TypeError)
end
@@ -61,7 +61,7 @@ describe "Module#extend_object" do
end
it "raises a RuntimeError before extending the object" do
- lambda { @receiver.send(:extend_object, @object) }.should raise_error(RuntimeError)
+ -> { @receiver.send(:extend_object, @object) }.should raise_error(RuntimeError)
@object.should_not be_kind_of(@receiver)
end
end
diff --git a/spec/ruby/core/module/gt_spec.rb b/spec/ruby/core/module/gt_spec.rb
index adab89a78b..b8a73c9ff9 100644
--- a/spec/ruby/core/module/gt_spec.rb
+++ b/spec/ruby/core/module/gt_spec.rb
@@ -31,6 +31,6 @@ describe "Module#>" do
end
it "raises a TypeError if the argument is not a class/module" do
- lambda { ModuleSpecs::Parent > mock('x') }.should raise_error(TypeError)
+ -> { ModuleSpecs::Parent > mock('x') }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/module/gte_spec.rb b/spec/ruby/core/module/gte_spec.rb
index 945721fe6b..18c60ba586 100644
--- a/spec/ruby/core/module/gte_spec.rb
+++ b/spec/ruby/core/module/gte_spec.rb
@@ -28,6 +28,6 @@ describe "Module#>=" do
end
it "raises a TypeError if the argument is not a class/module" do
- lambda { ModuleSpecs::Parent >= mock('x') }.should raise_error(TypeError)
+ -> { ModuleSpecs::Parent >= mock('x') }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/module/include_spec.rb b/spec/ruby/core/module/include_spec.rb
index ece86bfe00..e7f99a5981 100644
--- a/spec/ruby/core/module/include_spec.rb
+++ b/spec/ruby/core/module/include_spec.rb
@@ -40,11 +40,11 @@ describe "Module#include" do
end
it "raises a TypeError when the argument is not a Module" do
- lambda { ModuleSpecs::Basic.include(Class.new) }.should raise_error(TypeError)
+ -> { ModuleSpecs::Basic.include(Class.new) }.should raise_error(TypeError)
end
it "does not raise a TypeError when the argument is an instance of a subclass of Module" do
- lambda { ModuleSpecs::SubclassSpec.include(ModuleSpecs::Subclass.new) }.should_not raise_error(TypeError)
+ -> { ModuleSpecs::SubclassSpec.include(ModuleSpecs::Subclass.new) }.should_not raise_error(TypeError)
end
it "imports constants to modules and classes" do
@@ -158,7 +158,7 @@ describe "Module#include" do
end
it "detects cyclic includes" do
- lambda {
+ -> {
module ModuleSpecs::M
include ModuleSpecs::M
end
@@ -166,7 +166,7 @@ describe "Module#include" do
end
it "doesn't accept no-arguments" do
- lambda {
+ -> {
Module.new do
include
end
@@ -252,7 +252,7 @@ describe "Module#include?" do
end
it "raises a TypeError when no module was given" do
- lambda { ModuleSpecs::Child.include?("Test") }.should raise_error(TypeError)
- lambda { ModuleSpecs::Child.include?(ModuleSpecs::Parent) }.should raise_error(TypeError)
+ -> { ModuleSpecs::Child.include?("Test") }.should raise_error(TypeError)
+ -> { ModuleSpecs::Child.include?(ModuleSpecs::Parent) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/module/instance_method_spec.rb b/spec/ruby/core/module/instance_method_spec.rb
index 9328df9179..b4d6a0d8c8 100644
--- a/spec/ruby/core/module/instance_method_spec.rb
+++ b/spec/ruby/core/module/instance_method_spec.rb
@@ -52,13 +52,13 @@ describe "Module#instance_method" do
end
it "raises a TypeError if not passed a symbol" do
- lambda { Object.instance_method([]) }.should raise_error(TypeError)
- lambda { Object.instance_method(0) }.should raise_error(TypeError)
+ -> { Object.instance_method([]) }.should raise_error(TypeError)
+ -> { Object.instance_method(0) }.should raise_error(TypeError)
end
it "raises a TypeError if the given name is not a string/symbol" do
- lambda { Object.instance_method(nil) }.should raise_error(TypeError)
- lambda { Object.instance_method(mock('x')) }.should raise_error(TypeError)
+ -> { Object.instance_method(nil) }.should raise_error(TypeError)
+ -> { Object.instance_method(mock('x')) }.should raise_error(TypeError)
end
it "raises a NameError if the method has been undefined" do
@@ -66,13 +66,13 @@ describe "Module#instance_method" do
child.send :undef_method, :foo
um = ModuleSpecs::InstanceMeth.instance_method(:foo)
um.should == @parent_um
- lambda do
+ -> do
child.instance_method(:foo)
end.should raise_error(NameError)
end
it "raises a NameError if the method does not exist" do
- lambda { Object.instance_method(:missing) }.should raise_error(NameError)
+ -> { Object.instance_method(:missing) }.should raise_error(NameError)
end
it "sets the NameError#name attribute to the name of the missing method" do
diff --git a/spec/ruby/core/module/lt_spec.rb b/spec/ruby/core/module/lt_spec.rb
index 1fd528a54e..d7771e07a8 100644
--- a/spec/ruby/core/module/lt_spec.rb
+++ b/spec/ruby/core/module/lt_spec.rb
@@ -31,6 +31,6 @@ describe "Module#<" do
end
it "raises a TypeError if the argument is not a class/module" do
- lambda { ModuleSpecs::Parent < mock('x') }.should raise_error(TypeError)
+ -> { ModuleSpecs::Parent < mock('x') }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/module/lte_spec.rb b/spec/ruby/core/module/lte_spec.rb
index b8252cfe55..7a0e8496b8 100644
--- a/spec/ruby/core/module/lte_spec.rb
+++ b/spec/ruby/core/module/lte_spec.rb
@@ -28,6 +28,6 @@ describe "Module#<=" do
end
it "raises a TypeError if the argument is not a class/module" do
- lambda { ModuleSpecs::Parent <= mock('x') }.should raise_error(TypeError)
+ -> { ModuleSpecs::Parent <= mock('x') }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/module/method_defined_spec.rb b/spec/ruby/core/module/method_defined_spec.rb
index f5203917b4..c2a8702d97 100644
--- a/spec/ruby/core/module/method_defined_spec.rb
+++ b/spec/ruby/core/module/method_defined_spec.rb
@@ -34,10 +34,10 @@ describe "Module#method_defined?" do
c = Class.new
o = mock('123')
- lambda { c.method_defined?(o) }.should raise_error(TypeError)
+ -> { c.method_defined?(o) }.should raise_error(TypeError)
o.should_receive(:to_str).and_return(123)
- lambda { c.method_defined?(o) }.should raise_error(TypeError)
+ -> { c.method_defined?(o) }.should raise_error(TypeError)
end
it "converts the given name to a string using to_str" do
diff --git a/spec/ruby/core/module/module_function_spec.rb b/spec/ruby/core/module/module_function_spec.rb
index 41d52849fd..407237d48f 100644
--- a/spec/ruby/core/module/module_function_spec.rb
+++ b/spec/ruby/core/module/module_function_spec.rb
@@ -12,11 +12,11 @@ describe "Module#module_function" do
end
it "raises a TypeError if calling after rebinded to Class" do
- lambda {
+ -> {
Module.instance_method(:module_function).bind(Class.new).call
}.should raise_error(TypeError)
- lambda {
+ -> {
Module.instance_method(:module_function).bind(Class.new).call :foo
}.should raise_error(TypeError)
end
@@ -87,7 +87,7 @@ describe "Module#module_function with specific method names" do
o.respond_to?(:test).should == false
m.should have_private_instance_method(:test)
o.send(:test).should == "hello"
- lambda { o.test }.should raise_error(NoMethodError)
+ -> { o.test }.should raise_error(NoMethodError)
end
it "makes the new Module methods public" do
@@ -116,10 +116,10 @@ describe "Module#module_function with specific method names" do
it "raises a TypeError when the given names can't be converted to string using to_str" do
o = mock('123')
- lambda { Module.new { module_function(o) } }.should raise_error(TypeError)
+ -> { Module.new { module_function(o) } }.should raise_error(TypeError)
o.should_receive(:to_str).and_return(123)
- lambda { Module.new { module_function(o) } }.should raise_error(TypeError)
+ -> { Module.new { module_function(o) } }.should raise_error(TypeError)
end
it "can make accessible private methods" do # JRUBY-4214
diff --git a/spec/ruby/core/module/prepend_features_spec.rb b/spec/ruby/core/module/prepend_features_spec.rb
index 2779073e9c..b6fce9aba0 100644
--- a/spec/ruby/core/module/prepend_features_spec.rb
+++ b/spec/ruby/core/module/prepend_features_spec.rb
@@ -23,7 +23,7 @@ describe "Module#prepend_features" do
end
it "raises an ArgumentError on a cyclic prepend" do
- lambda {
+ -> {
ModuleSpecs::CyclicPrepend.send(:prepend_features, ModuleSpecs::CyclicPrepend)
}.should raise_error(ArgumentError)
end
@@ -68,7 +68,7 @@ describe "Module#prepend_features" do
end
it "raises a TypeError if calling after rebinded to Class" do
- lambda {
+ -> {
Module.instance_method(:prepend_features).bind(Class.new).call Module.new
}.should raise_error(TypeError)
end
diff --git a/spec/ruby/core/module/prepend_spec.rb b/spec/ruby/core/module/prepend_spec.rb
index b186381640..e143f51673 100644
--- a/spec/ruby/core/module/prepend_spec.rb
+++ b/spec/ruby/core/module/prepend_spec.rb
@@ -37,11 +37,11 @@ describe "Module#prepend" do
end
it "raises a TypeError when the argument is not a Module" do
- lambda { ModuleSpecs::Basic.prepend(Class.new) }.should raise_error(TypeError)
+ -> { ModuleSpecs::Basic.prepend(Class.new) }.should raise_error(TypeError)
end
it "does not raise a TypeError when the argument is an instance of a subclass of Module" do
- lambda { ModuleSpecs::SubclassSpec.prepend(ModuleSpecs::Subclass.new) }.should_not raise_error(TypeError)
+ -> { ModuleSpecs::SubclassSpec.prepend(ModuleSpecs::Subclass.new) }.should_not raise_error(TypeError)
end
it "imports constants" do
@@ -204,7 +204,7 @@ describe "Module#prepend" do
super << :class
end
end
- lambda { c.new.chain }.should raise_error(NoMethodError)
+ -> { c.new.chain }.should raise_error(NoMethodError)
end
it "calls prepended after prepend_features" do
@@ -224,7 +224,7 @@ describe "Module#prepend" do
end
it "detects cyclic prepends" do
- lambda {
+ -> {
module ModuleSpecs::P
prepend ModuleSpecs::P
end
@@ -232,7 +232,7 @@ describe "Module#prepend" do
end
it "doesn't accept no-arguments" do
- lambda {
+ -> {
Module.new do
prepend
end
diff --git a/spec/ruby/core/module/private_class_method_spec.rb b/spec/ruby/core/module/private_class_method_spec.rb
index 73275b0e6b..e35b50d986 100644
--- a/spec/ruby/core/module/private_class_method_spec.rb
+++ b/spec/ruby/core/module/private_class_method_spec.rb
@@ -22,11 +22,11 @@ describe "Module#private_class_method" do
it "makes an existing class method private" do
ModuleSpecs::Parent.private_method_1.should == nil
ModuleSpecs::Parent.private_class_method :private_method_1
- lambda { ModuleSpecs::Parent.private_method_1 }.should raise_error(NoMethodError)
+ -> { ModuleSpecs::Parent.private_method_1 }.should raise_error(NoMethodError)
# Technically above we're testing the Singleton classes, class method(right?).
# Try a "real" class method set private.
- lambda { ModuleSpecs::Parent.private_method }.should raise_error(NoMethodError)
+ -> { ModuleSpecs::Parent.private_method }.should raise_error(NoMethodError)
end
it "makes an existing class method private up the inheritance tree" do
@@ -34,8 +34,8 @@ describe "Module#private_class_method" do
ModuleSpecs::Child.private_method_1.should == nil
ModuleSpecs::Child.private_class_method :private_method_1
- lambda { ModuleSpecs::Child.private_method_1 }.should raise_error(NoMethodError)
- lambda { ModuleSpecs::Child.private_method }.should raise_error(NoMethodError)
+ -> { ModuleSpecs::Child.private_method_1 }.should raise_error(NoMethodError)
+ -> { ModuleSpecs::Child.private_method }.should raise_error(NoMethodError)
end
it "accepts more than one method at a time" do
@@ -44,12 +44,12 @@ describe "Module#private_class_method" do
ModuleSpecs::Child.private_class_method :private_method_1, :private_method_2
- lambda { ModuleSpecs::Child.private_method_1 }.should raise_error(NoMethodError)
- lambda { ModuleSpecs::Child.private_method_2 }.should raise_error(NoMethodError)
+ -> { ModuleSpecs::Child.private_method_1 }.should raise_error(NoMethodError)
+ -> { ModuleSpecs::Child.private_method_2 }.should raise_error(NoMethodError)
end
it "raises a NameError if class method doesn't exist" do
- lambda do
+ -> do
ModuleSpecs.private_class_method :no_method_here
end.should raise_error(NameError)
end
@@ -59,11 +59,11 @@ describe "Module#private_class_method" do
def self.foo() "foo" end
private_class_method :foo
end
- lambda { c.foo }.should raise_error(NoMethodError)
+ -> { c.foo }.should raise_error(NoMethodError)
end
it "raises a NameError when the given name is not a method" do
- lambda do
+ -> do
Class.new do
private_class_method :foo
end
@@ -71,7 +71,7 @@ describe "Module#private_class_method" do
end
it "raises a NameError when the given name is an instance method" do
- lambda do
+ -> do
Class.new do
def foo() "foo" end
private_class_method :foo
diff --git a/spec/ruby/core/module/private_constant_spec.rb b/spec/ruby/core/module/private_constant_spec.rb
index 45aaec6c26..3a91b3c3cd 100644
--- a/spec/ruby/core/module/private_constant_spec.rb
+++ b/spec/ruby/core/module/private_constant_spec.rb
@@ -6,7 +6,7 @@ describe "Module#private_constant" do
cls1.const_set :Foo, true
cls2 = Class.new(cls1)
- lambda do
+ -> do
cls2.send :private_constant, :Foo
end.should raise_error(NameError)
end
@@ -16,7 +16,7 @@ describe "Module#private_constant" do
cls.const_set :Foo, true
cls.send :private_constant, "Foo"
- lambda { cls::Foo }.should raise_error(NameError)
+ -> { cls::Foo }.should raise_error(NameError)
end
it "accepts multiple names" do
@@ -26,7 +26,7 @@ describe "Module#private_constant" do
mod.send :private_constant, :Foo, :Bar
- lambda {mod::Foo}.should raise_error(NameError)
- lambda {mod::Bar}.should raise_error(NameError)
+ -> {mod::Foo}.should raise_error(NameError)
+ -> {mod::Bar}.should raise_error(NameError)
end
end
diff --git a/spec/ruby/core/module/private_method_defined_spec.rb b/spec/ruby/core/module/private_method_defined_spec.rb
index a3cf55852e..515542d9df 100644
--- a/spec/ruby/core/module/private_method_defined_spec.rb
+++ b/spec/ruby/core/module/private_method_defined_spec.rb
@@ -32,25 +32,25 @@ describe "Module#private_method_defined?" do
end
it "raises a TypeError if passed a Fixnum" do
- lambda do
+ -> do
ModuleSpecs::CountsMixin.private_method_defined?(1)
end.should raise_error(TypeError)
end
it "raises a TypeError if passed nil" do
- lambda do
+ -> do
ModuleSpecs::CountsMixin.private_method_defined?(nil)
end.should raise_error(TypeError)
end
it "raises a TypeError if passed false" do
- lambda do
+ -> do
ModuleSpecs::CountsMixin.private_method_defined?(false)
end.should raise_error(TypeError)
end
it "raises a TypeError if passed an object that does not defined #to_str" do
- lambda do
+ -> do
ModuleSpecs::CountsMixin.private_method_defined?(mock('x'))
end.should raise_error(TypeError)
end
@@ -59,7 +59,7 @@ describe "Module#private_method_defined?" do
sym = mock('symbol')
def sym.to_sym() :private_3 end
- lambda do
+ -> do
ModuleSpecs::CountsMixin.private_method_defined?(sym)
end.should raise_error(TypeError)
end
diff --git a/spec/ruby/core/module/private_spec.rb b/spec/ruby/core/module/private_spec.rb
index 5d85c34855..e893c24f38 100644
--- a/spec/ruby/core/module/private_spec.rb
+++ b/spec/ruby/core/module/private_spec.rb
@@ -17,7 +17,7 @@ describe "Module#private" do
private :foo
end
- lambda { obj.foo }.should raise_error(NoMethodError)
+ -> { obj.foo }.should raise_error(NoMethodError)
end
it "makes a public Object instance method private in a new module" do
@@ -47,7 +47,7 @@ describe "Module#private" do
end
it "raises a NameError when given an undefined name" do
- lambda do
+ -> do
Module.new.send(:private, :undefined)
end.should raise_error(NameError)
end
@@ -67,7 +67,7 @@ describe "Module#private" do
end
base.new.wrapped.should == 1
- lambda do
+ -> do
klass.new.wrapped
end.should raise_error(NameError)
end
diff --git a/spec/ruby/core/module/protected_method_defined_spec.rb b/spec/ruby/core/module/protected_method_defined_spec.rb
index 75e02e0433..7be7bdd3c9 100644
--- a/spec/ruby/core/module/protected_method_defined_spec.rb
+++ b/spec/ruby/core/module/protected_method_defined_spec.rb
@@ -32,25 +32,25 @@ describe "Module#protected_method_defined?" do
end
it "raises a TypeError if passed a Fixnum" do
- lambda do
+ -> do
ModuleSpecs::CountsMixin.protected_method_defined?(1)
end.should raise_error(TypeError)
end
it "raises a TypeError if passed nil" do
- lambda do
+ -> do
ModuleSpecs::CountsMixin.protected_method_defined?(nil)
end.should raise_error(TypeError)
end
it "raises a TypeError if passed false" do
- lambda do
+ -> do
ModuleSpecs::CountsMixin.protected_method_defined?(false)
end.should raise_error(TypeError)
end
it "raises a TypeError if passed an object that does not defined #to_str" do
- lambda do
+ -> do
ModuleSpecs::CountsMixin.protected_method_defined?(mock('x'))
end.should raise_error(TypeError)
end
@@ -59,7 +59,7 @@ describe "Module#protected_method_defined?" do
sym = mock('symbol')
def sym.to_sym() :protected_3 end
- lambda do
+ -> do
ModuleSpecs::CountsMixin.protected_method_defined?(sym)
end.should raise_error(TypeError)
end
diff --git a/spec/ruby/core/module/protected_spec.rb b/spec/ruby/core/module/protected_spec.rb
index 985e4621c5..aa04a42fb8 100644
--- a/spec/ruby/core/module/protected_spec.rb
+++ b/spec/ruby/core/module/protected_spec.rb
@@ -18,7 +18,7 @@ describe "Module#protected" do
protected :protected_method_1
end
- lambda { ModuleSpecs::Parent.protected_method_1 }.should raise_error(NoMethodError)
+ -> { ModuleSpecs::Parent.protected_method_1 }.should raise_error(NoMethodError)
end
it "makes a public Object instance method protected in a new module" do
@@ -48,7 +48,7 @@ describe "Module#protected" do
end
it "raises a NameError when given an undefined name" do
- lambda do
+ -> do
Module.new.send(:protected, :undefined)
end.should raise_error(NameError)
end
diff --git a/spec/ruby/core/module/public_class_method_spec.rb b/spec/ruby/core/module/public_class_method_spec.rb
index 7745ed1f86..c09cc64863 100644
--- a/spec/ruby/core/module/public_class_method_spec.rb
+++ b/spec/ruby/core/module/public_class_method_spec.rb
@@ -18,7 +18,7 @@ describe "Module#public_class_method" do
end
it "makes an existing class method public" do
- lambda { ModuleSpecs::Parent.public_method_1 }.should raise_error(NoMethodError)
+ -> { ModuleSpecs::Parent.public_method_1 }.should raise_error(NoMethodError)
ModuleSpecs::Parent.public_class_method :public_method_1
ModuleSpecs::Parent.public_method_1.should == nil
@@ -29,7 +29,7 @@ describe "Module#public_class_method" do
it "makes an existing class method public up the inheritance tree" do
ModuleSpecs::Child.private_class_method :public_method_1
- lambda { ModuleSpecs::Child.public_method_1 }.should raise_error(NoMethodError)
+ -> { ModuleSpecs::Child.public_method_1 }.should raise_error(NoMethodError)
ModuleSpecs::Child.public_class_method :public_method_1
ModuleSpecs::Child.public_method_1.should == nil
@@ -37,8 +37,8 @@ describe "Module#public_class_method" do
end
it "accepts more than one method at a time" do
- lambda { ModuleSpecs::Parent.public_method_1 }.should raise_error(NameError)
- lambda { ModuleSpecs::Parent.public_method_2 }.should raise_error(NameError)
+ -> { ModuleSpecs::Parent.public_method_1 }.should raise_error(NameError)
+ -> { ModuleSpecs::Parent.public_method_2 }.should raise_error(NameError)
ModuleSpecs::Child.public_class_method :public_method_1, :public_method_2
@@ -47,7 +47,7 @@ describe "Module#public_class_method" do
end
it "raises a NameError if class method doesn't exist" do
- lambda do
+ -> do
ModuleSpecs.public_class_method :no_method_here
end.should raise_error(NameError)
end
@@ -62,7 +62,7 @@ describe "Module#public_class_method" do
end
it "raises a NameError when the given name is not a method" do
- lambda do
+ -> do
Class.new do
public_class_method :foo
end
@@ -70,7 +70,7 @@ describe "Module#public_class_method" do
end
it "raises a NameError when the given name is an instance method" do
- lambda do
+ -> do
Class.new do
def foo() "foo" end
public_class_method :foo
diff --git a/spec/ruby/core/module/public_constant_spec.rb b/spec/ruby/core/module/public_constant_spec.rb
index b2e6a08a4e..e624d45fd2 100644
--- a/spec/ruby/core/module/public_constant_spec.rb
+++ b/spec/ruby/core/module/public_constant_spec.rb
@@ -6,7 +6,7 @@ describe "Module#public_constant" do
cls1.const_set :Foo, true
cls2 = Class.new(cls1)
- lambda do
+ -> do
cls2.send :public_constant, :Foo
end.should raise_error(NameError)
end
diff --git a/spec/ruby/core/module/public_instance_method_spec.rb b/spec/ruby/core/module/public_instance_method_spec.rb
index aee6c03cf2..ba19ad0404 100644
--- a/spec/ruby/core/module/public_instance_method_spec.rb
+++ b/spec/ruby/core/module/public_instance_method_spec.rb
@@ -28,29 +28,29 @@ describe "Module#public_instance_method" do
end
it "raises a TypeError when given a name is not Symbol or String" do
- lambda { Module.new.public_instance_method(nil) }.should raise_error(TypeError)
+ -> { Module.new.public_instance_method(nil) }.should raise_error(TypeError)
end
it "raises a NameError when given a protected method name" do
- lambda do
+ -> do
ModuleSpecs::Basic.public_instance_method(:protected_module)
end.should raise_error(NameError)
end
it "raises a NameError if the method is private" do
- lambda do
+ -> do
ModuleSpecs::Basic.public_instance_method(:private_module)
end.should raise_error(NameError)
end
it "raises a NameError if the method has been undefined" do
- lambda do
+ -> do
ModuleSpecs::Parent.public_instance_method(:undefed_method)
end.should raise_error(NameError)
end
it "raises a NameError if the method does not exist" do
- lambda do
+ -> do
Module.new.public_instance_method(:missing)
end.should raise_error(NameError)
end
diff --git a/spec/ruby/core/module/public_method_defined_spec.rb b/spec/ruby/core/module/public_method_defined_spec.rb
index 0d7d3e031c..d2fcfd1e72 100644
--- a/spec/ruby/core/module/public_method_defined_spec.rb
+++ b/spec/ruby/core/module/public_method_defined_spec.rb
@@ -32,25 +32,25 @@ describe "Module#public_method_defined?" do
end
it "raises a TypeError if passed a Fixnum" do
- lambda do
+ -> do
ModuleSpecs::CountsMixin.public_method_defined?(1)
end.should raise_error(TypeError)
end
it "raises a TypeError if passed nil" do
- lambda do
+ -> do
ModuleSpecs::CountsMixin.public_method_defined?(nil)
end.should raise_error(TypeError)
end
it "raises a TypeError if passed false" do
- lambda do
+ -> do
ModuleSpecs::CountsMixin.public_method_defined?(false)
end.should raise_error(TypeError)
end
it "raises a TypeError if passed an object that does not defined #to_str" do
- lambda do
+ -> do
ModuleSpecs::CountsMixin.public_method_defined?(mock('x'))
end.should raise_error(TypeError)
end
@@ -59,7 +59,7 @@ describe "Module#public_method_defined?" do
sym = mock('symbol')
def sym.to_sym() :public_3 end
- lambda do
+ -> do
ModuleSpecs::CountsMixin.public_method_defined?(sym)
end.should raise_error(TypeError)
end
diff --git a/spec/ruby/core/module/public_spec.rb b/spec/ruby/core/module/public_spec.rb
index a948a55e5e..e7059f6aa6 100644
--- a/spec/ruby/core/module/public_spec.rb
+++ b/spec/ruby/core/module/public_spec.rb
@@ -37,7 +37,7 @@ describe "Module#public" do
end
it "raises a NameError when given an undefined name" do
- lambda do
+ -> do
Module.new.send(:public, :undefined)
end.should raise_error(NameError)
end
diff --git a/spec/ruby/core/module/refine_spec.rb b/spec/ruby/core/module/refine_spec.rb
index 7a1b2fc5fc..66c19ddb66 100644
--- a/spec/ruby/core/module/refine_spec.rb
+++ b/spec/ruby/core/module/refine_spec.rb
@@ -59,7 +59,7 @@ describe "Module#refine" do
end
it "raises ArgumentError if not passed an argument" do
- lambda do
+ -> do
Module.new do
refine {}
end
@@ -67,7 +67,7 @@ describe "Module#refine" do
end
it "raises TypeError if not passed a class" do
- lambda do
+ -> do
Module.new do
refine("foo") {}
end
@@ -88,7 +88,7 @@ describe "Module#refine" do
end
it "raises ArgumentError if not given a block" do
- lambda do
+ -> do
Module.new do
refine String
end
@@ -109,7 +109,7 @@ describe "Module#refine" do
it "doesn't apply refinements outside the refine block" do
Module.new do
refine(String) {def foo; "foo"; end}
- -> () {
+ -> {
"hello".foo
}.should raise_error(NoMethodError)
end
@@ -120,7 +120,7 @@ describe "Module#refine" do
refine(String) {def foo; 'foo'; end}
end
- lambda {"hello".foo}.should raise_error(NoMethodError)
+ -> {"hello".foo}.should raise_error(NoMethodError)
end
# When defining multiple refinements in the same module,
@@ -177,7 +177,7 @@ describe "Module#refine" do
result = nil
- -> () {
+ -> {
Module.new do
using refinery_integer
using refinery_array
@@ -575,7 +575,7 @@ describe "Module#refine" do
refinement = Module.new do
refine String do
def to_proc(*args)
- -> (*) { 'foo' }
+ -> * { 'foo' }
end
end
end
@@ -594,7 +594,7 @@ describe "Module#refine" do
refinement = Module.new do
refine String do
def to_proc(*args)
- -> (*) { 'foo' }
+ -> * { 'foo' }
end
end
end
@@ -689,7 +689,7 @@ describe "Module#refine" do
}
[1,2].orig_count.should == 2
end
- lambda { [1,2].orig_count }.should raise_error(NoMethodError)
+ -> { [1,2].orig_count }.should raise_error(NoMethodError)
end
it 'and alias_method aliases a method within a refinement module, but not outside it' do
@@ -701,7 +701,7 @@ describe "Module#refine" do
}
[1,2].orig_count.should == 2
end
- lambda { [1,2].orig_count }.should raise_error(NoMethodError)
+ -> { [1,2].orig_count }.should raise_error(NoMethodError)
end
# Refinements are inherited by module inclusion.
diff --git a/spec/ruby/core/module/remove_class_variable_spec.rb b/spec/ruby/core/module/remove_class_variable_spec.rb
index e431243ab4..ab9514adf6 100644
--- a/spec/ruby/core/module/remove_class_variable_spec.rb
+++ b/spec/ruby/core/module/remove_class_variable_spec.rb
@@ -23,19 +23,19 @@ describe "Module#remove_class_variable" do
it "raises a NameError when removing class variable declared in included module" do
c = ModuleSpecs::RemoveClassVariable.new { include ModuleSpecs::MVars.dup }
- lambda { c.send(:remove_class_variable, :@@mvar) }.should raise_error(NameError)
+ -> { c.send(:remove_class_variable, :@@mvar) }.should raise_error(NameError)
end
it "raises a NameError when passed a symbol with one leading @" do
- lambda { ModuleSpecs::MVars.send(:remove_class_variable, :@mvar) }.should raise_error(NameError)
+ -> { ModuleSpecs::MVars.send(:remove_class_variable, :@mvar) }.should raise_error(NameError)
end
it "raises a NameError when passed a symbol with no leading @" do
- lambda { ModuleSpecs::MVars.send(:remove_class_variable, :mvar) }.should raise_error(NameError)
+ -> { ModuleSpecs::MVars.send(:remove_class_variable, :mvar) }.should raise_error(NameError)
end
it "raises a NameError when an uninitialized class variable is given" do
- lambda { ModuleSpecs::MVars.send(:remove_class_variable, :@@nonexisting_class_variable) }.should raise_error(NameError)
+ -> { ModuleSpecs::MVars.send(:remove_class_variable, :@@nonexisting_class_variable) }.should raise_error(NameError)
end
it "is public" do
diff --git a/spec/ruby/core/module/remove_const_spec.rb b/spec/ruby/core/module/remove_const_spec.rb
index 073e2c1501..20eb2dc3ed 100644
--- a/spec/ruby/core/module/remove_const_spec.rb
+++ b/spec/ruby/core/module/remove_const_spec.rb
@@ -7,13 +7,13 @@ describe "Module#remove_const" do
ConstantSpecs::ModuleM::CS_CONST252.should == :const252
ConstantSpecs::ModuleM.send :remove_const, :CS_CONST252
- lambda { ConstantSpecs::ModuleM::CS_CONST252 }.should raise_error(NameError)
+ -> { ConstantSpecs::ModuleM::CS_CONST252 }.should raise_error(NameError)
ConstantSpecs::ModuleM::CS_CONST253 = :const253
ConstantSpecs::ModuleM::CS_CONST253.should == :const253
ConstantSpecs::ModuleM.send :remove_const, "CS_CONST253"
- lambda { ConstantSpecs::ModuleM::CS_CONST253 }.should raise_error(NameError)
+ -> { ConstantSpecs::ModuleM::CS_CONST253 }.should raise_error(NameError)
end
it "returns the value of the removed constant" do
@@ -23,7 +23,7 @@ describe "Module#remove_const" do
it "raises a NameError and does not call #const_missing if the constant is not defined" do
ConstantSpecs.should_not_receive(:const_missing)
- lambda { ConstantSpecs.send(:remove_const, :Nonexistent) }.should raise_error(NameError)
+ -> { ConstantSpecs.send(:remove_const, :Nonexistent) }.should raise_error(NameError)
end
it "raises a NameError and does not call #const_missing if the constant is not defined directly in the module" do
@@ -32,7 +32,7 @@ describe "Module#remove_const" do
ConstantSpecs::ContainerA::CS_CONST255.should == :const255
ConstantSpecs::ContainerA.should_not_receive(:const_missing)
- lambda do
+ -> do
ConstantSpecs::ContainerA.send :remove_const, :CS_CONST255
end.should raise_error(NameError)
ensure
@@ -41,21 +41,21 @@ describe "Module#remove_const" do
end
it "raises a NameError if the name does not start with a capital letter" do
- lambda { ConstantSpecs.send :remove_const, "name" }.should raise_error(NameError)
+ -> { ConstantSpecs.send :remove_const, "name" }.should raise_error(NameError)
end
it "raises a NameError if the name starts with a non-alphabetic character" do
- lambda { ConstantSpecs.send :remove_const, "__CONSTX__" }.should raise_error(NameError)
- lambda { ConstantSpecs.send :remove_const, "@Name" }.should raise_error(NameError)
- lambda { ConstantSpecs.send :remove_const, "!Name" }.should raise_error(NameError)
- lambda { ConstantSpecs.send :remove_const, "::Name" }.should raise_error(NameError)
+ -> { ConstantSpecs.send :remove_const, "__CONSTX__" }.should raise_error(NameError)
+ -> { ConstantSpecs.send :remove_const, "@Name" }.should raise_error(NameError)
+ -> { ConstantSpecs.send :remove_const, "!Name" }.should raise_error(NameError)
+ -> { ConstantSpecs.send :remove_const, "::Name" }.should raise_error(NameError)
end
it "raises a NameError if the name contains non-alphabetic characters except '_'" do
ConstantSpecs::ModuleM::CS_CONST256 = :const256
ConstantSpecs::ModuleM.send :remove_const, "CS_CONST256"
- lambda { ConstantSpecs.send :remove_const, "Name=" }.should raise_error(NameError)
- lambda { ConstantSpecs.send :remove_const, "Name?" }.should raise_error(NameError)
+ -> { ConstantSpecs.send :remove_const, "Name=" }.should raise_error(NameError)
+ -> { ConstantSpecs.send :remove_const, "Name?" }.should raise_error(NameError)
end
it "calls #to_str to convert the given name to a String" do
@@ -67,10 +67,10 @@ describe "Module#remove_const" do
it "raises a TypeError if conversion to a String by calling #to_str fails" do
name = mock('123')
- lambda { ConstantSpecs.send :remove_const, name }.should raise_error(TypeError)
+ -> { ConstantSpecs.send :remove_const, name }.should raise_error(TypeError)
name.should_receive(:to_str).and_return(123)
- lambda { ConstantSpecs.send :remove_const, name }.should raise_error(TypeError)
+ -> { ConstantSpecs.send :remove_const, name }.should raise_error(TypeError)
end
it "is a private method" do
diff --git a/spec/ruby/core/module/remove_method_spec.rb b/spec/ruby/core/module/remove_method_spec.rb
index 70048a83fb..ba08cc9b44 100644
--- a/spec/ruby/core/module/remove_method_spec.rb
+++ b/spec/ruby/core/module/remove_method_spec.rb
@@ -98,15 +98,15 @@ describe "Module#remove_method" do
end
it "raises a #{frozen_error_class} when passed a name" do
- lambda { @frozen.send :remove_method, :method_to_remove }.should raise_error(frozen_error_class)
+ -> { @frozen.send :remove_method, :method_to_remove }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} when passed a missing name" do
- lambda { @frozen.send :remove_method, :not_exist }.should raise_error(frozen_error_class)
+ -> { @frozen.send :remove_method, :not_exist }.should raise_error(frozen_error_class)
end
it "raises a TypeError when passed a not name" do
- lambda { @frozen.send :remove_method, Object.new }.should raise_error(TypeError)
+ -> { @frozen.send :remove_method, Object.new }.should raise_error(TypeError)
end
it "does not raise exceptions when no arguments given" do
diff --git a/spec/ruby/core/module/shared/class_eval.rb b/spec/ruby/core/module/shared/class_eval.rb
index 6bb9668fee..08f8ff7597 100644
--- a/spec/ruby/core/module/shared/class_eval.rb
+++ b/spec/ruby/core/module/shared/class_eval.rb
@@ -14,7 +14,7 @@ describe :module_class_eval, shared: true do
'foo'
end
end
- lambda {42.foo}.should raise_error(NoMethodError)
+ -> {42.foo}.should raise_error(NoMethodError)
end
it "resolves constants in the caller scope" do
@@ -59,7 +59,7 @@ describe :module_class_eval, shared: true do
it "raises a TypeError when the given filename can't be converted to string using to_str" do
(file = mock('123')).should_receive(:to_str).and_return(123)
- lambda { ModuleSpecs.send(@method, "1+1", file) }.should raise_error(TypeError)
+ -> { ModuleSpecs.send(@method, "1+1", file) }.should raise_error(TypeError)
end
it "converts non string eval-string to string using to_str" do
@@ -69,24 +69,24 @@ describe :module_class_eval, shared: true do
it "raises a TypeError when the given eval-string can't be converted to string using to_str" do
o = mock('x')
- lambda { ModuleSpecs.send(@method, o) }.should raise_error(TypeError)
+ -> { ModuleSpecs.send(@method, o) }.should raise_error(TypeError)
(o = mock('123')).should_receive(:to_str).and_return(123)
- lambda { ModuleSpecs.send(@method, o) }.should raise_error(TypeError)
+ -> { ModuleSpecs.send(@method, o) }.should raise_error(TypeError)
end
it "raises an ArgumentError when no arguments and no block are given" do
- lambda { ModuleSpecs.send(@method) }.should raise_error(ArgumentError)
+ -> { ModuleSpecs.send(@method) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when more than 3 arguments are given" do
- lambda {
+ -> {
ModuleSpecs.send(@method, "1 + 1", "some file", 0, "bogus")
}.should raise_error(ArgumentError)
end
it "raises an ArgumentError when a block and normal arguments are given" do
- lambda {
+ -> {
ModuleSpecs.send(@method, "1 + 1") { 1 + 1 }
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/core/module/shared/class_exec.rb b/spec/ruby/core/module/shared/class_exec.rb
index c5c18b0a34..c7a9e5297f 100644
--- a/spec/ruby/core/module/shared/class_exec.rb
+++ b/spec/ruby/core/module/shared/class_exec.rb
@@ -5,7 +5,7 @@ describe :module_class_exec, shared: true do
'foo'
end
end
- lambda {42.foo}.should raise_error(NoMethodError)
+ -> {42.foo}.should raise_error(NoMethodError)
end
it "defines method in the receiver's scope" do
@@ -19,7 +19,7 @@ describe :module_class_exec, shared: true do
end
it "raises a LocalJumpError when no block is given" do
- lambda { ModuleSpecs::Subclass.send(@method) }.should raise_error(LocalJumpError)
+ -> { ModuleSpecs::Subclass.send(@method) }.should raise_error(LocalJumpError)
end
it "passes arguments to the block" do
diff --git a/spec/ruby/core/module/undef_method_spec.rb b/spec/ruby/core/module/undef_method_spec.rb
index 539de330e9..9b2c9240f4 100644
--- a/spec/ruby/core/module/undef_method_spec.rb
+++ b/spec/ruby/core/module/undef_method_spec.rb
@@ -41,8 +41,8 @@ describe "Module#undef_method" do
x = klass.new
klass.send(:undef_method, :method_to_undef, :another_method_to_undef)
- lambda { x.method_to_undef }.should raise_error(NoMethodError)
- lambda { x.another_method_to_undef }.should raise_error(NoMethodError)
+ -> { x.method_to_undef }.should raise_error(NoMethodError)
+ -> { x.another_method_to_undef }.should raise_error(NoMethodError)
end
it "does not undef any instance methods when argument not given" do
@@ -57,7 +57,7 @@ describe "Module#undef_method" do
end
it "raises a NameError when passed a missing name" do
- lambda { @module.send :undef_method, :not_exist }.should raise_error(NameError) { |e|
+ -> { @module.send :undef_method, :not_exist }.should raise_error(NameError) { |e|
# a NameError and not a NoMethodError
e.class.should == NameError
}
@@ -69,15 +69,15 @@ describe "Module#undef_method" do
end
it "raises a #{frozen_error_class} when passed a name" do
- lambda { @frozen.send :undef_method, :method_to_undef }.should raise_error(frozen_error_class)
+ -> { @frozen.send :undef_method, :method_to_undef }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} when passed a missing name" do
- lambda { @frozen.send :undef_method, :not_exist }.should raise_error(frozen_error_class)
+ -> { @frozen.send :undef_method, :not_exist }.should raise_error(frozen_error_class)
end
it "raises a TypeError when passed a not name" do
- lambda { @frozen.send :undef_method, Object.new }.should raise_error(TypeError)
+ -> { @frozen.send :undef_method, Object.new }.should raise_error(TypeError)
end
it "does not raise exceptions when no arguments given" do
@@ -98,7 +98,7 @@ describe "Module#undef_method with symbol" do
klass.send :undef_method, :method_to_undef
- lambda { x.method_to_undef }.should raise_error(NoMethodError)
+ -> { x.method_to_undef }.should raise_error(NoMethodError)
end
it "removes a method defined in a super class" do
@@ -108,7 +108,7 @@ describe "Module#undef_method with symbol" do
child_class.send :undef_method, :method_to_undef
- lambda { child.method_to_undef }.should raise_error(NoMethodError)
+ -> { child.method_to_undef }.should raise_error(NoMethodError)
end
it "does not remove a method defined in a super class when removed from a subclass" do
@@ -134,7 +134,7 @@ describe "Module#undef_method with string" do
klass.send :undef_method, 'another_method_to_undef'
- lambda { x.another_method_to_undef }.should raise_error(NoMethodError)
+ -> { x.another_method_to_undef }.should raise_error(NoMethodError)
end
it "removes a method defined in a super class" do
@@ -144,7 +144,7 @@ describe "Module#undef_method with string" do
child_class.send :undef_method, 'another_method_to_undef'
- lambda { child.another_method_to_undef }.should raise_error(NoMethodError)
+ -> { child.another_method_to_undef }.should raise_error(NoMethodError)
end
it "does not remove a method defined in a super class when removed from a subclass" do
diff --git a/spec/ruby/core/module/using_spec.rb b/spec/ruby/core/module/using_spec.rb
index 9b6b38f622..533d87d080 100644
--- a/spec/ruby/core/module/using_spec.rb
+++ b/spec/ruby/core/module/using_spec.rb
@@ -24,7 +24,7 @@ describe "Module#using" do
end
end
- -> () {
+ -> {
Module.new do
using refinement
end
@@ -34,7 +34,7 @@ describe "Module#using" do
it "accepts module without refinements" do
mod = Module.new
- -> () {
+ -> {
Module.new do
using mod
end
@@ -44,7 +44,7 @@ describe "Module#using" do
it "does not accept class" do
klass = Class.new
- -> () {
+ -> {
Module.new do
using klass
end
@@ -52,7 +52,7 @@ describe "Module#using" do
end
it "raises TypeError if passed something other than module" do
- -> () {
+ -> {
Module.new do
using "foo"
end
@@ -93,7 +93,7 @@ describe "Module#using" do
end
end
- -> () {
+ -> {
mod.foo
}.should raise_error(RuntimeError, /Module#using is not permitted in methods/)
end
diff --git a/spec/ruby/core/mutex/lock_spec.rb b/spec/ruby/core/mutex/lock_spec.rb
index a1a2972d8c..7a39817b11 100644
--- a/spec/ruby/core/mutex/lock_spec.rb
+++ b/spec/ruby/core/mutex/lock_spec.rb
@@ -14,12 +14,12 @@ describe "Mutex#lock" do
it "blocks the caller if already locked" do
m = Mutex.new
m.lock
- lambda { m.lock }.should block_caller
+ -> { m.lock }.should block_caller
end
it "does not block the caller if not locked" do
m = Mutex.new
- lambda { m.lock }.should_not block_caller
+ -> { m.lock }.should_not block_caller
end
# Unable to find a specific ticket but behavior change may be
diff --git a/spec/ruby/core/mutex/sleep_spec.rb b/spec/ruby/core/mutex/sleep_spec.rb
index 72ed397eb5..477f9278c8 100644
--- a/spec/ruby/core/mutex/sleep_spec.rb
+++ b/spec/ruby/core/mutex/sleep_spec.rb
@@ -4,21 +4,21 @@ describe "Mutex#sleep" do
describe "when not locked by the current thread" do
it "raises a ThreadError" do
m = Mutex.new
- lambda { m.sleep }.should raise_error(ThreadError)
+ -> { m.sleep }.should raise_error(ThreadError)
end
it "raises an ArgumentError if passed a negative duration" do
m = Mutex.new
- lambda { m.sleep(-0.1) }.should raise_error(ArgumentError)
- lambda { m.sleep(-1) }.should raise_error(ArgumentError)
+ -> { m.sleep(-0.1) }.should raise_error(ArgumentError)
+ -> { m.sleep(-1) }.should raise_error(ArgumentError)
end
end
it "raises an ArgumentError if passed a negative duration" do
m = Mutex.new
m.lock
- lambda { m.sleep(-0.1) }.should raise_error(ArgumentError)
- lambda { m.sleep(-1) }.should raise_error(ArgumentError)
+ -> { m.sleep(-0.1) }.should raise_error(ArgumentError)
+ -> { m.sleep(-1) }.should raise_error(ArgumentError)
end
it "pauses execution for approximately the duration requested" do
diff --git a/spec/ruby/core/mutex/synchronize_spec.rb b/spec/ruby/core/mutex/synchronize_spec.rb
index e3dad508b8..7942885197 100644
--- a/spec/ruby/core/mutex/synchronize_spec.rb
+++ b/spec/ruby/core/mutex/synchronize_spec.rb
@@ -8,7 +8,7 @@ describe "Mutex#synchronize" do
synchronized = false
th = Thread.new do
- lambda do
+ -> do
m1.synchronize do
synchronized = true
m2.lock
@@ -28,12 +28,12 @@ describe "Mutex#synchronize" do
it "blocks the caller if already locked" do
m = Mutex.new
m.lock
- lambda { m.synchronize { } }.should block_caller
+ -> { m.synchronize { } }.should block_caller
end
it "does not block the caller if not locked" do
m = Mutex.new
- lambda { m.synchronize { } }.should_not block_caller
+ -> { m.synchronize { } }.should_not block_caller
end
it "blocks the caller if another thread is also in the synchronize block" do
@@ -50,7 +50,7 @@ describe "Mutex#synchronize" do
q1.pop.should == :ready
- lambda { m.synchronize { } }.should block_caller
+ -> { m.synchronize { } }.should block_caller
q2.push :done
t.join
@@ -60,7 +60,7 @@ describe "Mutex#synchronize" do
m = Mutex.new
m.synchronize do
- lambda { m.synchronize { } }.should raise_error(ThreadError)
+ -> { m.synchronize { } }.should raise_error(ThreadError)
end
end
end
diff --git a/spec/ruby/core/mutex/unlock_spec.rb b/spec/ruby/core/mutex/unlock_spec.rb
index 12353f9ba3..c9c3bfe14f 100644
--- a/spec/ruby/core/mutex/unlock_spec.rb
+++ b/spec/ruby/core/mutex/unlock_spec.rb
@@ -3,7 +3,7 @@ require_relative '../../spec_helper'
describe "Mutex#unlock" do
it "raises ThreadError unless Mutex is locked" do
mutex = Mutex.new
- lambda { mutex.unlock }.should raise_error(ThreadError)
+ -> { mutex.unlock }.should raise_error(ThreadError)
end
it "raises ThreadError unless thread owns Mutex" do
@@ -19,7 +19,7 @@ describe "Mutex#unlock" do
Thread.pass until mutex.locked?
Thread.pass while th.status and th.status != "sleep"
- lambda { mutex.unlock }.should raise_error(ThreadError)
+ -> { mutex.unlock }.should raise_error(ThreadError)
wait.unlock
th.join
@@ -33,6 +33,6 @@ describe "Mutex#unlock" do
th.join
- lambda { mutex.unlock }.should raise_error(ThreadError)
+ -> { mutex.unlock }.should raise_error(ThreadError)
end
end
diff --git a/spec/ruby/core/nil/nilclass_spec.rb b/spec/ruby/core/nil/nilclass_spec.rb
index 72d3d37b2e..7f6d8af25d 100644
--- a/spec/ruby/core/nil/nilclass_spec.rb
+++ b/spec/ruby/core/nil/nilclass_spec.rb
@@ -2,13 +2,13 @@ require_relative '../../spec_helper'
describe "NilClass" do
it ".allocate raises a TypeError" do
- lambda do
+ -> do
NilClass.allocate
end.should raise_error(TypeError)
end
it ".new is undefined" do
- lambda do
+ -> do
NilClass.new
end.should raise_error(NoMethodError)
end
diff --git a/spec/ruby/core/nil/rationalize_spec.rb b/spec/ruby/core/nil/rationalize_spec.rb
index f65d8eebee..84d6e6f056 100644
--- a/spec/ruby/core/nil/rationalize_spec.rb
+++ b/spec/ruby/core/nil/rationalize_spec.rb
@@ -10,7 +10,7 @@ describe "NilClass#rationalize" do
end
it "raises ArgumentError when passed more than one argument" do
- lambda { nil.rationalize(0.1, 0.1) }.should raise_error(ArgumentError)
- lambda { nil.rationalize(0.1, 0.1, 2) }.should raise_error(ArgumentError)
+ -> { nil.rationalize(0.1, 0.1) }.should raise_error(ArgumentError)
+ -> { nil.rationalize(0.1, 0.1, 2) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/numeric/coerce_spec.rb b/spec/ruby/core/numeric/coerce_spec.rb
index c0136b181e..4c4416d30b 100644
--- a/spec/ruby/core/numeric/coerce_spec.rb
+++ b/spec/ruby/core/numeric/coerce_spec.rb
@@ -25,7 +25,7 @@ describe "Numeric#coerce" do
class << a; true; end
# watch it explode
- lambda { a.coerce(b) }.should raise_error(TypeError)
+ -> { a.coerce(b) }.should raise_error(TypeError)
end
end
@@ -38,22 +38,22 @@ describe "Numeric#coerce" do
it "raise TypeError if they are instances of different classes and other does not respond to #to_f" do
other = mock("numeric")
- lambda { @obj.coerce(other) }.should raise_error(TypeError)
+ -> { @obj.coerce(other) }.should raise_error(TypeError)
end
it "raises a TypeError when passed nil" do
- lambda { @obj.coerce(nil) }.should raise_error(TypeError)
+ -> { @obj.coerce(nil) }.should raise_error(TypeError)
end
it "raises a TypeError when passed a boolean" do
- lambda { @obj.coerce(false) }.should raise_error(TypeError)
+ -> { @obj.coerce(false) }.should raise_error(TypeError)
end
it "raises a TypeError when passed a Symbol" do
- lambda { @obj.coerce(:symbol) }.should raise_error(TypeError)
+ -> { @obj.coerce(:symbol) }.should raise_error(TypeError)
end
it "raises an ArgumentError when passed a non-numeric String" do
- lambda { @obj.coerce("test") }.should raise_error(ArgumentError)
+ -> { @obj.coerce("test") }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/numeric/div_spec.rb b/spec/ruby/core/numeric/div_spec.rb
index 0017311487..53917b84c9 100644
--- a/spec/ruby/core/numeric/div_spec.rb
+++ b/spec/ruby/core/numeric/div_spec.rb
@@ -15,8 +15,8 @@ describe "Numeric#div" do
end
it "raises ZeroDivisionError for 0" do
- lambda { @obj.div(0) }.should raise_error(ZeroDivisionError)
- lambda { @obj.div(0.0) }.should raise_error(ZeroDivisionError)
- lambda { @obj.div(Complex(0,0)) }.should raise_error(ZeroDivisionError)
+ -> { @obj.div(0) }.should raise_error(ZeroDivisionError)
+ -> { @obj.div(0.0) }.should raise_error(ZeroDivisionError)
+ -> { @obj.div(Complex(0,0)) }.should raise_error(ZeroDivisionError)
end
end
diff --git a/spec/ruby/core/numeric/quo_spec.rb b/spec/ruby/core/numeric/quo_spec.rb
index bf05cf678d..5c952b11a9 100644
--- a/spec/ruby/core/numeric/quo_spec.rb
+++ b/spec/ruby/core/numeric/quo_spec.rb
@@ -16,11 +16,11 @@ describe "Numeric#quo" do
end
it "raises a ZeroDivisionError when the given Integer is 0" do
- lambda { 0.quo(0) }.should raise_error(ZeroDivisionError)
- lambda { 10.quo(0) }.should raise_error(ZeroDivisionError)
- lambda { -10.quo(0) }.should raise_error(ZeroDivisionError)
- lambda { bignum_value.quo(0) }.should raise_error(ZeroDivisionError)
- lambda { -bignum_value.quo(0) }.should raise_error(ZeroDivisionError)
+ -> { 0.quo(0) }.should raise_error(ZeroDivisionError)
+ -> { 10.quo(0) }.should raise_error(ZeroDivisionError)
+ -> { -10.quo(0) }.should raise_error(ZeroDivisionError)
+ -> { bignum_value.quo(0) }.should raise_error(ZeroDivisionError)
+ -> { -bignum_value.quo(0) }.should raise_error(ZeroDivisionError)
end
it "calls #to_r to convert the object to a Rational" do
@@ -34,16 +34,16 @@ describe "Numeric#quo" do
obj = NumericSpecs::Subclass.new
obj.should_receive(:to_r).and_return(1)
- lambda { obj.quo(19) }.should raise_error(TypeError)
+ -> { obj.quo(19) }.should raise_error(TypeError)
end
it "raises a TypeError when given a non-Integer" do
- lambda {
+ -> {
(obj = mock('x')).should_not_receive(:to_int)
13.quo(obj)
}.should raise_error(TypeError)
- lambda { 13.quo("10") }.should raise_error(TypeError)
- lambda { 13.quo(:symbol) }.should raise_error(TypeError)
+ -> { 13.quo("10") }.should raise_error(TypeError)
+ -> { 13.quo(:symbol) }.should raise_error(TypeError)
end
it "returns the result of calling self#/ with other" do
diff --git a/spec/ruby/core/numeric/real_spec.rb b/spec/ruby/core/numeric/real_spec.rb
index 8c318dce0f..caa8dcec6d 100644
--- a/spec/ruby/core/numeric/real_spec.rb
+++ b/spec/ruby/core/numeric/real_spec.rb
@@ -25,7 +25,7 @@ describe "Numeric#real" do
it "raises an ArgumentError if given any arguments" do
@numbers.each do |number|
- lambda { number.real(number) }.should raise_error(ArgumentError)
+ -> { number.real(number) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/core/numeric/shared/imag.rb b/spec/ruby/core/numeric/shared/imag.rb
index 11daf0af55..ac2da40a3b 100644
--- a/spec/ruby/core/numeric/shared/imag.rb
+++ b/spec/ruby/core/numeric/shared/imag.rb
@@ -20,7 +20,7 @@ describe :numeric_imag, shared: true do
it "raises an ArgumentError if given any arguments" do
@numbers.each do |number|
- lambda { number.send(@method, number) }.should raise_error(ArgumentError)
+ -> { number.send(@method, number) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/core/numeric/shared/rect.rb b/spec/ruby/core/numeric/shared/rect.rb
index 047d6556e1..9cde19a398 100644
--- a/spec/ruby/core/numeric/shared/rect.rb
+++ b/spec/ruby/core/numeric/shared/rect.rb
@@ -42,7 +42,7 @@ describe :numeric_rect, shared: true do
it "raises an ArgumentError if given any arguments" do
@numbers.each do |number|
- lambda { number.send(@method, number) }.should raise_error(ArgumentError)
+ -> { number.send(@method, number) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/core/numeric/shared/step.rb b/spec/ruby/core/numeric/shared/step.rb
index 5dcaa4b253..b0cbbd0585 100644
--- a/spec/ruby/core/numeric/shared/step.rb
+++ b/spec/ruby/core/numeric/shared/step.rb
@@ -8,7 +8,7 @@ require_relative '../fixtures/classes'
describe :numeric_step, :shared => true do
before :each do
ScratchPad.record []
- @prc = lambda { |x| ScratchPad << x }
+ @prc = -> x { ScratchPad << x }
end
it "defaults to step = 1" do
@@ -233,33 +233,33 @@ describe :numeric_step, :shared => true do
describe "with self and stop as Fixnums" do
it "raises an #{error} when step is a numeric representation" do
- lambda { 1.send(@method, *@step_args.call(5, "1")) {} }.should raise_error(error)
- lambda { 1.send(@method, *@step_args.call(5, "0.1")) {} }.should raise_error(error)
- lambda { 1.send(@method, *@step_args.call(5, "1/3")) {} }.should raise_error(error)
+ -> { 1.send(@method, *@step_args.call(5, "1")) {} }.should raise_error(error)
+ -> { 1.send(@method, *@step_args.call(5, "0.1")) {} }.should raise_error(error)
+ -> { 1.send(@method, *@step_args.call(5, "1/3")) {} }.should raise_error(error)
end
it "raises an #{error} with step as an alphanumeric string" do
- lambda { 1.send(@method, *@step_args.call(5, "foo")) {} }.should raise_error(error)
+ -> { 1.send(@method, *@step_args.call(5, "foo")) {} }.should raise_error(error)
end
end
describe "with self and stop as Floats" do
it "raises an #{error} when step is a numeric representation" do
- lambda { 1.1.send(@method, *@step_args.call(5.1, "1")) {} }.should raise_error(error)
- lambda { 1.1.send(@method, *@step_args.call(5.1, "0.1")) {} }.should raise_error(error)
- lambda { 1.1.send(@method, *@step_args.call(5.1, "1/3")) {} }.should raise_error(error)
+ -> { 1.1.send(@method, *@step_args.call(5.1, "1")) {} }.should raise_error(error)
+ -> { 1.1.send(@method, *@step_args.call(5.1, "0.1")) {} }.should raise_error(error)
+ -> { 1.1.send(@method, *@step_args.call(5.1, "1/3")) {} }.should raise_error(error)
end
it "raises an #{error} with step as an alphanumeric string" do
- lambda { 1.1.send(@method, *@step_args.call(5.1, "foo")) {} }.should raise_error(error)
+ -> { 1.1.send(@method, *@step_args.call(5.1, "foo")) {} }.should raise_error(error)
end
end
end
it "does not rescue ArgumentError exceptions" do
- lambda { 1.send(@method, *@step_args.call(2)) { raise ArgumentError, "" }}.should raise_error(ArgumentError)
+ -> { 1.send(@method, *@step_args.call(2)) { raise ArgumentError, "" }}.should raise_error(ArgumentError)
end
it "does not rescue TypeError exceptions" do
- lambda { 1.send(@method, *@step_args.call(2)) { raise TypeError, "" } }.should raise_error(TypeError)
+ -> { 1.send(@method, *@step_args.call(2)) { raise TypeError, "" } }.should raise_error(TypeError)
end
describe "when no block is given" do
@@ -311,23 +311,23 @@ describe :numeric_step, :shared => true do
describe "with self and stop as Fixnums" do
it "raises an #{error} when step is a numeric representation" do
- lambda { 1.send(@method, *@step_args.call(5, "1")).size }.should raise_error(error)
- lambda { 1.send(@method, *@step_args.call(5, "0.1")).size }.should raise_error(error)
- lambda { 1.send(@method, *@step_args.call(5, "1/3")).size }.should raise_error(error)
+ -> { 1.send(@method, *@step_args.call(5, "1")).size }.should raise_error(error)
+ -> { 1.send(@method, *@step_args.call(5, "0.1")).size }.should raise_error(error)
+ -> { 1.send(@method, *@step_args.call(5, "1/3")).size }.should raise_error(error)
end
it "raises an #{error} with step as an alphanumeric string" do
- lambda { 1.send(@method, *@step_args.call(5, "foo")).size }.should raise_error(error)
+ -> { 1.send(@method, *@step_args.call(5, "foo")).size }.should raise_error(error)
end
end
describe "with self and stop as Floats" do
it "raises an #{error} when step is a numeric representation" do
- lambda { 1.1.send(@method, *@step_args.call(5.1, "1")).size }.should raise_error(error)
- lambda { 1.1.send(@method, *@step_args.call(5.1, "0.1")).size }.should raise_error(error)
- lambda { 1.1.send(@method, *@step_args.call(5.1, "1/3")).size }.should raise_error(error)
+ -> { 1.1.send(@method, *@step_args.call(5.1, "1")).size }.should raise_error(error)
+ -> { 1.1.send(@method, *@step_args.call(5.1, "0.1")).size }.should raise_error(error)
+ -> { 1.1.send(@method, *@step_args.call(5.1, "1/3")).size }.should raise_error(error)
end
it "raises an #{error} with step as an alphanumeric string" do
- lambda { 1.1.send(@method, *@step_args.call(5.1, "foo")).size }.should raise_error(error)
+ -> { 1.1.send(@method, *@step_args.call(5.1, "foo")).size }.should raise_error(error)
end
end
end
diff --git a/spec/ruby/core/numeric/singleton_method_added_spec.rb b/spec/ruby/core/numeric/singleton_method_added_spec.rb
index c39e9d7b32..2091398e5d 100644
--- a/spec/ruby/core/numeric/singleton_method_added_spec.rb
+++ b/spec/ruby/core/numeric/singleton_method_added_spec.rb
@@ -18,22 +18,22 @@ describe "Numeric#singleton_method_added" do
end
it "raises a TypeError when trying to define a singleton method on a Numeric" do
- lambda do
+ -> do
a = NumericSpecs::Subclass.new
def a.test; end
end.should raise_error(TypeError)
- lambda do
+ -> do
a = 1
def a.test; end
end.should raise_error(TypeError)
- lambda do
+ -> do
a = 1.5
def a.test; end
end.should raise_error(TypeError)
- lambda do
+ -> do
a = bignum_value
def a.test; end
end.should raise_error(TypeError)
diff --git a/spec/ruby/core/numeric/step_spec.rb b/spec/ruby/core/numeric/step_spec.rb
index 12369a47a2..fc80cc4ab0 100644
--- a/spec/ruby/core/numeric/step_spec.rb
+++ b/spec/ruby/core/numeric/step_spec.rb
@@ -6,17 +6,17 @@ describe "Numeric#step" do
describe 'with positional args' do
it "raises an ArgumentError when step is 0" do
- lambda { 1.step(5, 0) {} }.should raise_error(ArgumentError)
+ -> { 1.step(5, 0) {} }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when step is 0.0" do
- lambda { 1.step(2, 0.0) {} }.should raise_error(ArgumentError)
+ -> { 1.step(2, 0.0) {} }.should raise_error(ArgumentError)
end
before :all do
# This lambda definition limits to return the arguments it receives.
# It's needed to test numeric_step behaviour with positional arguments.
- @step_args = ->(*args) { args }
+ @step_args = -> *args { args }
end
it_behaves_like :numeric_step, :step
@@ -40,12 +40,12 @@ describe "Numeric#step" do
ruby_version_is ""..."2.6" do
it "raises an ArgumentError when step is 0" do
enum = 1.step(5, 0)
- lambda { enum.size }.should raise_error(ArgumentError)
+ -> { enum.size }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when step is 0.0" do
enum = 1.step(2, 0.0)
- lambda { enum.size }.should raise_error(ArgumentError)
+ -> { enum.size }.should raise_error(ArgumentError)
end
end
@@ -87,11 +87,11 @@ describe "Numeric#step" do
describe 'with keyword arguments' do
it "doesn't raise an error when step is 0" do
- lambda { 1.step(to: 5, by: 0) { break } }.should_not raise_error
+ -> { 1.step(to: 5, by: 0) { break } }.should_not raise_error
end
it "doesn't raise an error when step is 0.0" do
- lambda { 1.step(to: 2, by: 0.0) { break } }.should_not raise_error
+ -> { 1.step(to: 2, by: 0.0) { break } }.should_not raise_error
end
it "should loop over self when step is 0 or 0.0" do
@@ -138,7 +138,7 @@ describe "Numeric#step" do
# This lambda transforms a positional step method args into
# keyword arguments.
# It's needed to test numeric_step behaviour with keyword arguments.
- @step_args = ->(*args) do
+ @step_args = -> *args do
kw_args = {to: args[0]}
kw_args[:by] = args[1] if args.size == 2
[kw_args]
@@ -149,19 +149,19 @@ describe "Numeric#step" do
describe 'with mixed arguments' do
it "doesn't raise an error when step is 0" do
- lambda { 1.step(5, by: 0) { break } }.should_not raise_error
+ -> { 1.step(5, by: 0) { break } }.should_not raise_error
end
it "doesn't raise an error when step is 0.0" do
- lambda { 1.step(2, by: 0.0) { break } }.should_not raise_error
+ -> { 1.step(2, by: 0.0) { break } }.should_not raise_error
end
it "raises a ArgumentError when limit and to are defined" do
- lambda { 1.step(5, 1, to: 5) { break } }.should raise_error(ArgumentError)
+ -> { 1.step(5, 1, to: 5) { break } }.should raise_error(ArgumentError)
end
it "raises a ArgumentError when step and by are defined" do
- lambda { 1.step(5, 1, by: 5) { break } }.should raise_error(ArgumentError)
+ -> { 1.step(5, 1, by: 5) { break } }.should raise_error(ArgumentError)
end
it "should loop over self when step is 0 or 0.0" do
@@ -188,7 +188,7 @@ describe "Numeric#step" do
# a mix of positional and keyword arguments.
# It's needed to test numeric_step behaviour with positional mixed with
# keyword arguments.
- @step_args = ->(*args) do
+ @step_args = -> *args do
if args.size == 2
[args[0], {by: args[1]}]
else
diff --git a/spec/ruby/core/objectspace/define_finalizer_spec.rb b/spec/ruby/core/objectspace/define_finalizer_spec.rb
index b7e47473a0..3f7b1ae576 100644
--- a/spec/ruby/core/objectspace/define_finalizer_spec.rb
+++ b/spec/ruby/core/objectspace/define_finalizer_spec.rb
@@ -5,13 +5,13 @@ require_relative 'fixtures/classes'
# passed proc or callable will be called at any particular time.
describe "ObjectSpace.define_finalizer" do
it "raises an ArgumentError if the action does not respond to call" do
- lambda {
+ -> {
ObjectSpace.define_finalizer("", mock("ObjectSpace.define_finalizer no #call"))
}.should raise_error(ArgumentError)
end
it "accepts an object and a proc" do
- handler = lambda { |obj| obj }
+ handler = -> obj { obj }
ObjectSpace.define_finalizer("garbage", handler).should == [0, handler]
end
@@ -22,7 +22,7 @@ describe "ObjectSpace.define_finalizer" do
end
it "raises ArgumentError trying to define a finalizer on a non-reference" do
- lambda {
+ -> {
ObjectSpace.define_finalizer(:blah) { 1 }
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/core/objectspace/fixtures/classes.rb b/spec/ruby/core/objectspace/fixtures/classes.rb
index 9a4b0aa865..612156c180 100644
--- a/spec/ruby/core/objectspace/fixtures/classes.rb
+++ b/spec/ruby/core/objectspace/fixtures/classes.rb
@@ -24,7 +24,7 @@ module ObjectSpaceFixtures
end
def self.define_finalizer
- handler = lambda { |obj| ScratchPad.record :finalized }
+ handler = -> obj { ScratchPad.record :finalized }
ObjectSpace.define_finalizer "#{rand 5}", handler
end
diff --git a/spec/ruby/core/objectspace/garbage_collect_spec.rb b/spec/ruby/core/objectspace/garbage_collect_spec.rb
index 90000038c2..1aec3ea072 100644
--- a/spec/ruby/core/objectspace/garbage_collect_spec.rb
+++ b/spec/ruby/core/objectspace/garbage_collect_spec.rb
@@ -3,15 +3,15 @@ require_relative '../../spec_helper'
describe "ObjectSpace.garbage_collect" do
it "can be invoked without any exceptions" do
- lambda { ObjectSpace.garbage_collect }.should_not raise_error
+ -> { ObjectSpace.garbage_collect }.should_not raise_error
end
it "doesn't accept any arguments" do
- lambda { ObjectSpace.garbage_collect(1) }.should raise_error(ArgumentError)
+ -> { ObjectSpace.garbage_collect(1) }.should raise_error(ArgumentError)
end
it "ignores the supplied block" do
- lambda { ObjectSpace.garbage_collect {} }.should_not raise_error
+ -> { ObjectSpace.garbage_collect {} }.should_not raise_error
end
it "always returns nil" do
diff --git a/spec/ruby/core/proc/allocate_spec.rb b/spec/ruby/core/proc/allocate_spec.rb
index a512c73b1a..54e1b69df9 100644
--- a/spec/ruby/core/proc/allocate_spec.rb
+++ b/spec/ruby/core/proc/allocate_spec.rb
@@ -2,7 +2,7 @@ require_relative '../../spec_helper'
describe "Proc.allocate" do
it "raises a TypeError" do
- lambda {
+ -> {
Proc.allocate
}.should raise_error(TypeError)
end
diff --git a/spec/ruby/core/proc/binding_spec.rb b/spec/ruby/core/proc/binding_spec.rb
index 5e8a461a55..86ab6bd400 100644
--- a/spec/ruby/core/proc/binding_spec.rb
+++ b/spec/ruby/core/proc/binding_spec.rb
@@ -2,7 +2,7 @@ require_relative '../../spec_helper'
describe "Proc#binding" do
it "returns a Binding instance" do
- [Proc.new{}, lambda {}, proc {}].each { |p|
+ [Proc.new{}, -> {}, proc {}].each { |p|
p.binding.should be_kind_of(Binding)
}
end
@@ -10,7 +10,7 @@ describe "Proc#binding" do
it "returns the binding associated with self" do
obj = mock('binding')
def obj.test_binding(some, params)
- lambda {}
+ -> {}
end
lambdas_binding = obj.test_binding(1, 2).binding
diff --git a/spec/ruby/core/proc/compose_spec.rb b/spec/ruby/core/proc/compose_spec.rb
index f1befe658b..35e949a779 100644
--- a/spec/ruby/core/proc/compose_spec.rb
+++ b/spec/ruby/core/proc/compose_spec.rb
@@ -44,6 +44,14 @@ ruby_version_is "2.6" do
(inc << mul).call(2, 3).should == 7
end
+
+ it "passes blocks to the second proc" do
+ ScratchPad.record []
+ one = proc { |&arg| arg.call :one if arg }
+ two = proc { |&arg| arg.call :two if arg }
+ (one << two).call { |x| ScratchPad << x }
+ ScratchPad.recorded.should == [:two]
+ end
end
end
@@ -89,6 +97,14 @@ ruby_version_is "2.6" do
(mul >> inc).call(2, 3).should == 7
end
+
+ it "passes blocks to the first proc" do
+ ScratchPad.record []
+ one = proc { |&arg| arg.call :one if arg }
+ two = proc { |&arg| arg.call :two if arg }
+ (one >> two).call { |x| ScratchPad << x }
+ ScratchPad.recorded.should == [:one]
+ end
end
end
end
diff --git a/spec/ruby/core/proc/curry_spec.rb b/spec/ruby/core/proc/curry_spec.rb
index 7d1da441f1..24df2a8a72 100644
--- a/spec/ruby/core/proc/curry_spec.rb
+++ b/spec/ruby/core/proc/curry_spec.rb
@@ -3,7 +3,7 @@ require_relative '../../spec_helper'
describe "Proc#curry" do
before :each do
@proc_add = Proc.new {|x,y,z| (x||0) + (y||0) + (z||0) }
- @lambda_add = lambda {|x,y,z| (x||0) + (y||0) + (z||0) }
+ @lambda_add = -> x, y, z { (x||0) + (y||0) + (z||0) }
end
it "returns a Proc when called on a proc" do
@@ -12,7 +12,7 @@ describe "Proc#curry" do
end
it "returns a Proc when called on a lambda" do
- p = lambda { true }
+ p = -> { true }
p.curry.should be_an_instance_of(Proc)
end
@@ -36,10 +36,10 @@ describe "Proc#curry" do
it "can be called multiple times on the same Proc" do
@proc_add.curry
- lambda { @proc_add.curry }.should_not raise_error
+ -> { @proc_add.curry }.should_not raise_error
@lambda_add.curry
- lambda { @lambda_add.curry }.should_not raise_error
+ -> { @lambda_add.curry }.should_not raise_error
end
it "can be passed superfluous arguments if created from a proc" do
@@ -49,19 +49,19 @@ describe "Proc#curry" do
end
it "raises an ArgumentError if passed superfluous arguments when created from a lambda" do
- lambda { @lambda_add.curry[1,2,3,4] }.should raise_error(ArgumentError)
- lambda { @lambda_add.curry[1,2].curry[3,4,5,6] }.should raise_error(ArgumentError)
+ -> { @lambda_add.curry[1,2,3,4] }.should raise_error(ArgumentError)
+ -> { @lambda_add.curry[1,2].curry[3,4,5,6] }.should raise_error(ArgumentError)
end
it "returns Procs with arities of -1" do
@proc_add.curry.arity.should == -1
@lambda_add.curry.arity.should == -1
- l = lambda { |*a| }
+ l = -> *a { }
l.curry.arity.should == -1
end
it "produces Procs that raise ArgumentError for #binding" do
- lambda do
+ -> do
@proc_add.curry.binding
end.should raise_error(ArgumentError)
end
@@ -81,7 +81,7 @@ describe "Proc#curry" do
end
it "combines arguments and calculates incoming arity accurately for successively currying" do
- l = lambda{|a,b,c| a+b+c }
+ l = -> a, b, c { a+b+c }
l1 = l.curry.call(1)
# the l1 currying seems unnecessary, but it triggered the original issue
l2 = l1.curry.call(2)
@@ -93,13 +93,13 @@ end
describe "Proc#curry with arity argument" do
before :each do
- @proc_add = proc {|x,y,z| (x||0) + (y||0) + (z||0) }
- @lambda_add = lambda {|x,y,z| (x||0) + (y||0) + (z||0) }
+ @proc_add = proc { |x,y,z| (x||0) + (y||0) + (z||0) }
+ @lambda_add = -> x, y, z { (x||0) + (y||0) + (z||0) }
end
it "accepts an optional Integer argument for the arity" do
- lambda { @proc_add.curry(3) }.should_not raise_error
- lambda { @lambda_add.curry(3) }.should_not raise_error
+ -> { @proc_add.curry(3) }.should_not raise_error
+ -> { @lambda_add.curry(3) }.should_not raise_error
end
it "returns a Proc when called on a proc" do
@@ -117,22 +117,22 @@ describe "Proc#curry with arity argument" do
end
it "raises an ArgumentError if called on a lambda that requires more than _arity_ arguments" do
- lambda { @lambda_add.curry(2) }.should raise_error(ArgumentError)
- lambda { lambda{|x, y, z, *more|}.curry(2) }.should raise_error(ArgumentError)
+ -> { @lambda_add.curry(2) }.should raise_error(ArgumentError)
+ -> { -> x, y, z, *more{}.curry(2) }.should raise_error(ArgumentError)
end
it 'returns a Proc if called on a lambda that requires fewer than _arity_ arguments but may take more' do
- lambda{|a, b, c, d=nil, e=nil|}.curry(4).should be_an_instance_of(Proc)
- lambda{|a, b, c, d=nil, *e|}.curry(4).should be_an_instance_of(Proc)
- lambda{|a, b, c, *d|}.curry(4).should be_an_instance_of(Proc)
+ -> a, b, c, d=nil, e=nil {}.curry(4).should be_an_instance_of(Proc)
+ -> a, b, c, d=nil, *e {}.curry(4).should be_an_instance_of(Proc)
+ -> a, b, c, *d {}.curry(4).should be_an_instance_of(Proc)
end
it "raises an ArgumentError if called on a lambda that requires fewer than _arity_ arguments" do
- lambda { @lambda_add.curry(4) }.should raise_error(ArgumentError)
- lambda { lambda { true }.curry(1) }.should raise_error(ArgumentError)
- lambda { lambda {|a, b=nil|}.curry(5) }.should raise_error(ArgumentError)
- lambda { lambda {|a, &b|}.curry(2) }.should raise_error(ArgumentError)
- lambda { lambda {|a, b=nil, &c|}.curry(3) }.should raise_error(ArgumentError)
+ -> { @lambda_add.curry(4) }.should raise_error(ArgumentError)
+ -> { -> { true }.curry(1) }.should raise_error(ArgumentError)
+ -> { -> a, b=nil {}.curry(5) }.should raise_error(ArgumentError)
+ -> { -> a, &b {}.curry(2) }.should raise_error(ArgumentError)
+ -> { -> a, b=nil, &c {}.curry(3) }.should raise_error(ArgumentError)
end
it "calls the curried proc with the arguments if _arity_ arguments have been given" do
@@ -152,29 +152,29 @@ describe "Proc#curry with arity argument" do
it "can be specified multiple times on the same Proc" do
@proc_add.curry(2)
- lambda { @proc_add.curry(1) }.should_not raise_error
+ -> { @proc_add.curry(1) }.should_not raise_error
@lambda_add.curry(3)
- lambda { @lambda_add.curry(3) }.should_not raise_error
+ -> { @lambda_add.curry(3) }.should_not raise_error
end
it "can be passed more than _arity_ arguments if created from a proc" do
- lambda { @proc_add.curry(3)[1,2,3,4].should == 6 }.should_not
+ -> { @proc_add.curry(3)[1,2,3,4].should == 6 }.should_not
raise_error(ArgumentError)
- lambda { @proc_add.curry(1)[1,2].curry(3)[3,4,5,6].should == 6 }.should_not
+ -> { @proc_add.curry(1)[1,2].curry(3)[3,4,5,6].should == 6 }.should_not
raise_error(ArgumentError)
end
it "raises an ArgumentError if passed more than _arity_ arguments when created from a lambda" do
- lambda { @lambda_add.curry(3)[1,2,3,4] }.should raise_error(ArgumentError)
- lambda { @lambda_add.curry(1)[1,2].curry(3)[3,4,5,6] }.should raise_error(ArgumentError)
+ -> { @lambda_add.curry(3)[1,2,3,4] }.should raise_error(ArgumentError)
+ -> { @lambda_add.curry(1)[1,2].curry(3)[3,4,5,6] }.should raise_error(ArgumentError)
end
it "returns Procs with arities of -1 regardless of the value of _arity_" do
@proc_add.curry(1).arity.should == -1
@proc_add.curry(2).arity.should == -1
@lambda_add.curry(3).arity.should == -1
- l = lambda { |*a| }
+ l = -> *a { }
l.curry(3).arity.should == -1
end
end
diff --git a/spec/ruby/core/proc/fixtures/source_location.rb b/spec/ruby/core/proc/fixtures/source_location.rb
index 468262e02a..688dac1e22 100644
--- a/spec/ruby/core/proc/fixtures/source_location.rb
+++ b/spec/ruby/core/proc/fixtures/source_location.rb
@@ -5,7 +5,7 @@ module ProcSpecs
end
def self.my_lambda
- lambda { true }
+ -> { true }
end
def self.my_proc_new
@@ -24,7 +24,7 @@ module ProcSpecs
end
def self.my_multiline_lambda
- lambda do
+ -> do
'a'.upcase
1 + 22
end
@@ -43,7 +43,7 @@ module ProcSpecs
end
def self.my_detached_lambda
- body = lambda { true }
+ body = -> { true }
lambda(&body)
end
diff --git a/spec/ruby/core/proc/hash_spec.rb b/spec/ruby/core/proc/hash_spec.rb
index 5993ad5098..d780c1ceb0 100644
--- a/spec/ruby/core/proc/hash_spec.rb
+++ b/spec/ruby/core/proc/hash_spec.rb
@@ -3,7 +3,7 @@ require_relative '../../spec_helper'
describe "Proc#hash" do
it "is provided" do
proc {}.respond_to?(:hash).should be_true
- lambda {}.respond_to?(:hash).should be_true
+ -> {}.respond_to?(:hash).should be_true
end
it "returns an Integer" do
diff --git a/spec/ruby/core/proc/lambda_spec.rb b/spec/ruby/core/proc/lambda_spec.rb
index edf2151f27..fe2ceb4279 100644
--- a/spec/ruby/core/proc/lambda_spec.rb
+++ b/spec/ruby/core/proc/lambda_spec.rb
@@ -3,7 +3,7 @@ require_relative 'fixtures/common'
describe "Proc#lambda?" do
it "returns true if the Proc was created from a block with the lambda keyword" do
- lambda {}.lambda?.should be_true
+ -> {}.lambda?.should be_true
end
it "returns false if the Proc was created from a block with the proc keyword" do
@@ -15,17 +15,17 @@ describe "Proc#lambda?" do
end
it "is preserved when passing a Proc with & to the lambda keyword" do
- lambda(&lambda{}).lambda?.should be_true
+ lambda(&->{}).lambda?.should be_true
lambda(&proc{}).lambda?.should be_false
end
it "is preserved when passing a Proc with & to the proc keyword" do
- proc(&lambda{}).lambda?.should be_true
+ proc(&->{}).lambda?.should be_true
proc(&proc{}).lambda?.should be_false
end
it "is preserved when passing a Proc with & to Proc.new" do
- Proc.new(&lambda{}).lambda?.should be_true
+ Proc.new(&->{}).lambda?.should be_true
Proc.new(&proc{}).lambda?.should be_false
end
@@ -34,7 +34,7 @@ describe "Proc#lambda?" do
end
it "is preserved when the Proc was passed using &" do
- ProcSpecs.new_proc_from_amp(&lambda{}).lambda?.should be_true
+ ProcSpecs.new_proc_from_amp(&->{}).lambda?.should be_true
ProcSpecs.new_proc_from_amp(&proc{}).lambda?.should be_false
ProcSpecs.new_proc_from_amp(&Proc.new{}).lambda?.should be_false
end
@@ -47,13 +47,13 @@ describe "Proc#lambda?" do
# [ruby-core:24127]
it "is preserved when a Proc is curried" do
- lambda{}.curry.lambda?.should be_true
+ ->{}.curry.lambda?.should be_true
proc{}.curry.lambda?.should be_false
Proc.new{}.curry.lambda?.should be_false
end
it "is preserved when a curried Proc is called without enough arguments" do
- lambda{|x,y|}.curry.call(42).lambda?.should be_true
+ -> x, y{}.curry.call(42).lambda?.should be_true
proc{|x,y|}.curry.call(42).lambda?.should be_false
Proc.new{|x,y|}.curry.call(42).lambda?.should be_false
end
diff --git a/spec/ruby/core/proc/new_spec.rb b/spec/ruby/core/proc/new_spec.rb
index 60a7320e4b..cc033467e5 100644
--- a/spec/ruby/core/proc/new_spec.rb
+++ b/spec/ruby/core/proc/new_spec.rb
@@ -71,7 +71,7 @@ describe "Proc.new with an associated block" do
end
res = some_method()
- lambda { res.call }.should raise_error(LocalJumpError)
+ -> { res.call }.should raise_error(LocalJumpError)
end
it "returns from within enclosing method when 'return' is used in the block" do
@@ -169,15 +169,15 @@ end
describe "Proc.new without a block" do
it "raises an ArgumentError" do
- lambda { Proc.new }.should raise_error(ArgumentError)
+ -> { Proc.new }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if invoked from within a method with no block" do
- lambda { ProcSpecs.new_proc_in_method }.should raise_error(ArgumentError)
+ -> { ProcSpecs.new_proc_in_method }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if invoked on a subclass from within a method with no block" do
- lambda { ProcSpecs.new_proc_subclass_in_method }.should raise_error(ArgumentError)
+ -> { ProcSpecs.new_proc_subclass_in_method }.should raise_error(ArgumentError)
end
ruby_version_is ""..."2.7" do
@@ -205,11 +205,11 @@ describe "Proc.new without a block" do
ruby_version_is "2.7" do
it "can be created if invoked from within a method with a block" do
- lambda { ProcSpecs.new_proc_in_method { "hello" } }.should complain(/Capturing the given block using Proc.new is deprecated/)
+ -> { ProcSpecs.new_proc_in_method { "hello" } }.should complain(/Capturing the given block using Proc.new is deprecated/)
end
it "can be created if invoked on a subclass from within a method with a block" do
- lambda { ProcSpecs.new_proc_subclass_in_method { "hello" } }.should complain(/Capturing the given block using Proc.new is deprecated/)
+ -> { ProcSpecs.new_proc_subclass_in_method { "hello" } }.should complain(/Capturing the given block using Proc.new is deprecated/)
end
diff --git a/spec/ruby/core/proc/parameters_spec.rb b/spec/ruby/core/proc/parameters_spec.rb
index 4a8958497d..2bc5f1325c 100644
--- a/spec/ruby/core/proc/parameters_spec.rb
+++ b/spec/ruby/core/proc/parameters_spec.rb
@@ -25,17 +25,17 @@ describe "Proc#parameters" do
end
it "regards parameters with default values as optional" do
- lambda {|x=1| }.parameters.first.first.should == :opt
+ -> x=1 { }.parameters.first.first.should == :opt
proc {|x=1| }.parameters.first.first.should == :opt
end
it "sets the first element of each sub-Array to :req for required arguments" do
- lambda {|x,y=[]| }.parameters.first.first.should == :req
- lambda {|y,*x| }.parameters.first.first.should == :req
+ -> x, y=[] { }.parameters.first.first.should == :req
+ -> y, *x { }.parameters.first.first.should == :req
end
it "regards named parameters in lambdas as required" do
- lambda {|x| }.parameters.first.first.should == :req
+ -> x { }.parameters.first.first.should == :req
end
it "regards keyword parameters in lambdas as required" do
@@ -43,32 +43,32 @@ describe "Proc#parameters" do
end
it "sets the first element of each sub-Array to :rest for parameters prefixed with asterisks" do
- lambda {|*x| }.parameters.first.first.should == :rest
- lambda {|x,*y| }.parameters.last.first.should == :rest
+ -> *x { }.parameters.first.first.should == :rest
+ -> x, *y { }.parameters.last.first.should == :rest
proc {|*x| }.parameters.first.first.should == :rest
proc {|x,*y| }.parameters.last.first.should == :rest
end
it "sets the first element of each sub-Array to :keyrest for parameters prefixed with double asterisks" do
- lambda {|**x| }.parameters.first.first.should == :keyrest
- lambda {|x,**y| }.parameters.last.first.should == :keyrest
+ -> **x { }.parameters.first.first.should == :keyrest
+ -> x, **y { }.parameters.last.first.should == :keyrest
proc {|**x| }.parameters.first.first.should == :keyrest
proc {|x,**y| }.parameters.last.first.should == :keyrest
end
it "sets the first element of each sub-Array to :block for parameters prefixed with ampersands" do
- lambda {|&x| }.parameters.first.first.should == :block
- lambda {|x,&y| }.parameters.last.first.should == :block
+ ->&x { }.parameters.first.first.should == :block
+ -> x, &y { }.parameters.last.first.should == :block
proc {|&x| }.parameters.first.first.should == :block
proc {|x,&y| }.parameters.last.first.should == :block
end
it "sets the second element of each sub-Array to the name of the argument" do
- lambda {|x| }.parameters.first.last.should == :x
- lambda {|x=Math::PI| }.parameters.first.last.should == :x
- lambda {|an_argument, glark, &foo| }.parameters[1].last.should == :glark
- lambda {|*rest| }.parameters.first.last.should == :rest
- lambda {|&block| }.parameters.first.last.should == :block
+ -> x { }.parameters.first.last.should == :x
+ -> x=Math::PI { }.parameters.first.last.should == :x
+ -> an_argument, glark, &foo { }.parameters[1].last.should == :glark
+ -> *rest { }.parameters.first.last.should == :rest
+ ->&block { }.parameters.first.last.should == :block
proc {|x| }.parameters.first.last.should == :x
proc {|x=Math::PI| }.parameters.first.last.should == :x
proc {|an_argument, glark, &foo| }.parameters[1].last.should == :glark
@@ -77,15 +77,15 @@ describe "Proc#parameters" do
end
it "ignores unnamed rest args" do
- lambda {|x,|}.parameters.should == [[:req, :x]]
+ -> x {}.parameters.should == [[:req, :x]]
end
it "adds nameless rest arg for \"star\" argument" do
- lambda {|x,*|}.parameters.should == [[:req, :x], [:rest]]
+ -> x, * {}.parameters.should == [[:req, :x], [:rest]]
end
it "does not add locals as block options with a block and splat" do
- lambda do |*args, &blk|
+ -> *args, &blk do
local_is_not_parameter = {}
end.parameters.should == [[:rest, :args], [:block, :blk]]
proc do |*args, &blk|
diff --git a/spec/ruby/core/proc/shared/call.rb b/spec/ruby/core/proc/shared/call.rb
index 996d0e055d..c30ea84b23 100644
--- a/spec/ruby/core/proc/shared/call.rb
+++ b/spec/ruby/core/proc/shared/call.rb
@@ -3,7 +3,7 @@ require_relative '../fixtures/common'
describe :proc_call, shared: true do
it "invokes self" do
Proc.new { "test!" }.send(@method).should == "test!"
- lambda { "test!" }.send(@method).should == "test!"
+ -> { "test!" }.send(@method).should == "test!"
proc { "test!" }.send(@method).should == "test!"
end
@@ -12,9 +12,9 @@ describe :proc_call, shared: true do
Proc.new { |*args| args }.send(@method, 1, 2, 3, 4).should == [1, 2, 3, 4]
Proc.new { |_, *args| args }.send(@method, 1, 2, 3).should == [2, 3]
- lambda { |a, b| a + b }.send(@method, 1, 2).should == 3
- lambda { |*args| args }.send(@method, 1, 2, 3, 4).should == [1, 2, 3, 4]
- lambda { |_, *args| args }.send(@method, 1, 2, 3).should == [2, 3]
+ -> a, b { a + b }.send(@method, 1, 2).should == 3
+ -> *args { args }.send(@method, 1, 2, 3, 4).should == [1, 2, 3, 4]
+ -> _, *args { args }.send(@method, 1, 2, 3).should == [2, 3]
proc { |a, b| a + b }.send(@method, 1, 2).should == 3
proc { |*args| args }.send(@method, 1, 2, 3, 4).should == [1, 2, 3, 4]
@@ -65,28 +65,28 @@ describe :proc_call_on_proc_or_lambda, shared: true do
end
it "raises an ArgumentError on excess arguments when self is a lambda" do
- lambda {
- lambda {|x| x}.send(@method, 1, 2)
+ -> {
+ -> x { x }.send(@method, 1, 2)
}.should raise_error(ArgumentError)
- lambda {
- lambda {|x| x}.send(@method, 1, 2, 3)
+ -> {
+ -> x { x }.send(@method, 1, 2, 3)
}.should raise_error(ArgumentError)
end
it "raises an ArgumentError on missing arguments when self is a lambda" do
- lambda {
- lambda {|x| x}.send(@method)
+ -> {
+ -> x { x }.send(@method)
}.should raise_error(ArgumentError)
- lambda {
- lambda {|x,y| [x,y]}.send(@method, 1)
+ -> {
+ -> x, y { [x,y] }.send(@method, 1)
}.should raise_error(ArgumentError)
end
it "treats a single Array argument as a single argument when self is a lambda" do
- lambda { |a| a }.send(@method, [1, 2]).should == [1, 2]
- lambda { |a, b| [a, b] }.send(@method, [1, 2], 3).should == [[1,2], 3]
+ -> a { a }.send(@method, [1, 2]).should == [1, 2]
+ -> a, b { [a, b] }.send(@method, [1, 2], 3).should == [[1,2], 3]
end
it "treats a single Array argument as a single argument when self is a proc" do
diff --git a/spec/ruby/core/proc/shared/call_arguments.rb b/spec/ruby/core/proc/shared/call_arguments.rb
index a937bd99d0..ef6ec04620 100644
--- a/spec/ruby/core/proc/shared/call_arguments.rb
+++ b/spec/ruby/core/proc/shared/call_arguments.rb
@@ -1,7 +1,7 @@
describe :proc_call_block_args, shared: true do
it "can receive block arguments" do
Proc.new {|&b| b.send(@method)}.send(@method) {1 + 1}.should == 2
- lambda {|&b| b.send(@method)}.send(@method) {1 + 1}.should == 2
+ ->&b { b.send(@method)}.send(@method) {1 + 1}.should == 2
proc {|&b| b.send(@method)}.send(@method) {1 + 1}.should == 2
end
diff --git a/spec/ruby/core/proc/shared/dup.rb b/spec/ruby/core/proc/shared/dup.rb
index fb6fff299d..eda1d6929d 100644
--- a/spec/ruby/core/proc/shared/dup.rb
+++ b/spec/ruby/core/proc/shared/dup.rb
@@ -1,6 +1,6 @@
describe :proc_dup, shared: true do
it "returns a copy of self" do
- a = lambda { "hello" }
+ a = -> { "hello" }
b = a.send(@method)
a.should_not equal(b)
diff --git a/spec/ruby/core/proc/shared/equal.rb b/spec/ruby/core/proc/shared/equal.rb
index a5d067cea3..46a1894424 100644
--- a/spec/ruby/core/proc/shared/equal.rb
+++ b/spec/ruby/core/proc/shared/equal.rb
@@ -13,7 +13,7 @@ describe :proc_equal, shared: true do
p = Proc.new { :foo }
p.send(@method, p).should be_true
- p = lambda { :foo }
+ p = -> { :foo }
p.send(@method, p).should be_true
end
@@ -24,7 +24,7 @@ describe :proc_equal, shared: true do
p = Proc.new { :foo }
p.send(@method, p.dup).should be_true
- p = lambda { :foo }
+ p = -> { :foo }
p.send(@method, p.dup).should be_true
end
@@ -43,18 +43,18 @@ describe :proc_equal, shared: true do
end
it "returns true if both lambdas with the same body and environment" do
- x = lambda { :foo }
- x2 = lambda { :foo }
+ x = -> { :foo }
+ x2 = -> { :foo }
x.send(@method, x2).should be_true
end
it "returns true if both different kinds of procs with the same body and env" do
- p = lambda { :foo }
+ p = -> { :foo }
p2 = proc { :foo }
p.send(@method, p2).should be_true
x = proc { :bar }
- x2 = lambda { :bar }
+ x2 = -> { :bar }
x.send(@method, x2).should be_true
end
@@ -65,7 +65,7 @@ describe :proc_equal, shared: true do
p = Proc.new { :foo }
p.send(@method, Object.new).should be_false
- p = lambda { :foo }
+ p = -> { :foo }
p.send(@method, :foo).should be_false
end
@@ -76,8 +76,8 @@ describe :proc_equal, shared: true do
end
it "returns false if self and other are both lambdas but have different bodies" do
- p = lambda { :foo }
- p2 = lambda { :bar }
+ p = -> { :foo }
+ p2 = -> { :bar }
p.send(@method, p2).should be_false
end
end
@@ -94,7 +94,7 @@ describe :proc_equal_undefined, shared: true do
p = Proc.new { :foo }
p.send(@method, p.dup).should be_false
- p = lambda { :foo }
+ p = -> { :foo }
p.send(@method, p.dup).should be_false
end
end
diff --git a/spec/ruby/core/proc/shared/to_s.rb b/spec/ruby/core/proc/shared/to_s.rb
index 59fcf5bef0..a4d1d5d630 100644
--- a/spec/ruby/core/proc/shared/to_s.rb
+++ b/spec/ruby/core/proc/shared/to_s.rb
@@ -11,11 +11,11 @@ describe :proc_to_s, shared: true do
describe "for a proc created with lambda" do
it "returns a description including '(lambda)' and optionally including file and line number" do
- lambda { "hello" }.send(@method).should =~ /^#<Proc:([^ ]*?)(@([^ ]*)\/to_s\.rb:10)? \(lambda\)>$/
+ -> { "hello" }.send(@method).should =~ /^#<Proc:([^ ]*?)(@([^ ]*)\/to_s\.rb:10)? \(lambda\)>$/
end
it "has a binary encoding" do
- lambda { "hello" }.send(@method).encoding.should == Encoding::BINARY
+ -> { "hello" }.send(@method).encoding.should == Encoding::BINARY
end
end
diff --git a/spec/ruby/core/proc/source_location_spec.rb b/spec/ruby/core/proc/source_location_spec.rb
index 89409c357b..b5b8178df2 100644
--- a/spec/ruby/core/proc/source_location_spec.rb
+++ b/spec/ruby/core/proc/source_location_spec.rb
@@ -55,7 +55,7 @@ describe "Proc#source_location" do
it "works even if the proc was created on the same line" do
proc { true }.source_location.should == [__FILE__, __LINE__]
Proc.new { true }.source_location.should == [__FILE__, __LINE__]
- lambda { true }.source_location.should == [__FILE__, __LINE__]
+ -> { true }.source_location.should == [__FILE__, __LINE__]
end
it "returns the first line of a multi-line proc (i.e. the line containing 'proc do')" do
diff --git a/spec/ruby/core/proc/to_proc_spec.rb b/spec/ruby/core/proc/to_proc_spec.rb
index 24e66760e4..ffaa34929b 100644
--- a/spec/ruby/core/proc/to_proc_spec.rb
+++ b/spec/ruby/core/proc/to_proc_spec.rb
@@ -2,7 +2,7 @@ require_relative '../../spec_helper'
describe "Proc#to_proc" do
it "returns self" do
- [Proc.new {}, lambda {}, proc {}].each { |p|
+ [Proc.new {}, -> {}, proc {}].each { |p|
p.to_proc.should equal(p)
}
end
diff --git a/spec/ruby/core/process/clock_gettime_spec.rb b/spec/ruby/core/process/clock_gettime_spec.rb
index 4cd13857ea..d3f973d7ae 100644
--- a/spec/ruby/core/process/clock_gettime_spec.rb
+++ b/spec/ruby/core/process/clock_gettime_spec.rb
@@ -20,7 +20,7 @@ describe "Process.clock_gettime" do
end
it 'raises an ArgumentError for an invalid time unit' do
- lambda { Process.clock_gettime(Process::CLOCK_MONOTONIC, :bad) }.should raise_error(ArgumentError)
+ -> { Process.clock_gettime(Process::CLOCK_MONOTONIC, :bad) }.should raise_error(ArgumentError)
end
it 'defaults to :float_second' do
diff --git a/spec/ruby/core/process/daemon_spec.rb b/spec/ruby/core/process/daemon_spec.rb
index b472a3b9e9..70ffd1b320 100644
--- a/spec/ruby/core/process/daemon_spec.rb
+++ b/spec/ruby/core/process/daemon_spec.rb
@@ -107,7 +107,7 @@ end
platform_is :windows do
describe "Process.daemon" do
it "raises a NotImplementedError" do
- lambda {
+ -> {
Process.daemon
}.should raise_error(NotImplementedError)
end
diff --git a/spec/ruby/core/process/detach_spec.rb b/spec/ruby/core/process/detach_spec.rb
index 74169a2fed..1c27ed9c2c 100644
--- a/spec/ruby/core/process/detach_spec.rb
+++ b/spec/ruby/core/process/detach_spec.rb
@@ -23,7 +23,7 @@ describe "Process.detach" do
it "reaps the child process's status automatically" do
pid = Process.fork { Process.exit! }
Process.detach(pid).join
- lambda { Process.waitpid(pid) }.should raise_error(Errno::ECHILD)
+ -> { Process.waitpid(pid) }.should raise_error(Errno::ECHILD)
end
end
diff --git a/spec/ruby/core/process/euid_spec.rb b/spec/ruby/core/process/euid_spec.rb
index ffb71a7178..7bbacfadfd 100644
--- a/spec/ruby/core/process/euid_spec.rb
+++ b/spec/ruby/core/process/euid_spec.rb
@@ -18,16 +18,16 @@ describe "Process.euid=" do
platform_is_not :windows do
it "raises TypeError if not passed an Integer" do
- lambda { Process.euid = Object.new }.should raise_error(TypeError)
+ -> { Process.euid = Object.new }.should raise_error(TypeError)
end
as_user do
it "raises Errno::ERPERM if run by a non superuser trying to set the superuser id" do
- lambda { (Process.euid = 0)}.should raise_error(Errno::EPERM)
+ -> { (Process.euid = 0)}.should raise_error(Errno::EPERM)
end
it "raises Errno::ERPERM if run by a non superuser trying to set the superuser id from username" do
- lambda { Process.euid = "root" }.should raise_error(Errno::EPERM)
+ -> { Process.euid = "root" }.should raise_error(Errno::EPERM)
end
end
diff --git a/spec/ruby/core/process/exec_spec.rb b/spec/ruby/core/process/exec_spec.rb
index 098898d42e..848990c6dc 100644
--- a/spec/ruby/core/process/exec_spec.rb
+++ b/spec/ruby/core/process/exec_spec.rb
@@ -2,27 +2,27 @@ require_relative '../../spec_helper'
describe "Process.exec" do
it "raises Errno::ENOENT for an empty string" do
- lambda { Process.exec "" }.should raise_error(Errno::ENOENT)
+ -> { Process.exec "" }.should raise_error(Errno::ENOENT)
end
it "raises Errno::ENOENT for a command which does not exist" do
- lambda { Process.exec "bogus-noent-script.sh" }.should raise_error(Errno::ENOENT)
+ -> { Process.exec "bogus-noent-script.sh" }.should raise_error(Errno::ENOENT)
end
it "raises an ArgumentError if the command includes a null byte" do
- lambda { Process.exec "\000" }.should raise_error(ArgumentError)
+ -> { Process.exec "\000" }.should raise_error(ArgumentError)
end
unless File.executable?(__FILE__) # Some FS (e.g. vboxfs) locate all files executable
platform_is_not :windows do
it "raises Errno::EACCES when the file does not have execute permissions" do
- lambda { Process.exec __FILE__ }.should raise_error(Errno::EACCES)
+ -> { Process.exec __FILE__ }.should raise_error(Errno::EACCES)
end
end
platform_is :windows do
it "raises Errno::EACCES or Errno::ENOEXEC when the file is not an executable file" do
- lambda { Process.exec __FILE__ }.should raise_error(SystemCallError) { |e|
+ -> { Process.exec __FILE__ }.should raise_error(SystemCallError) { |e|
[Errno::EACCES, Errno::ENOEXEC].should include(e.class)
}
end
@@ -31,13 +31,13 @@ describe "Process.exec" do
platform_is_not :openbsd do
it "raises Errno::EACCES when passed a directory" do
- lambda { Process.exec File.dirname(__FILE__) }.should raise_error(Errno::EACCES)
+ -> { Process.exec File.dirname(__FILE__) }.should raise_error(Errno::EACCES)
end
end
platform_is :openbsd do
it "raises Errno::EISDIR when passed a directory" do
- lambda { Process.exec File.dirname(__FILE__) }.should raise_error(Errno::EISDIR)
+ -> { Process.exec File.dirname(__FILE__) }.should raise_error(Errno::EISDIR)
end
end
@@ -179,9 +179,9 @@ describe "Process.exec" do
end
it "raises an ArgumentError if the Array does not have exactly two elements" do
- lambda { Process.exec([]) }.should raise_error(ArgumentError)
- lambda { Process.exec([:a]) }.should raise_error(ArgumentError)
- lambda { Process.exec([:a, :b, :c]) }.should raise_error(ArgumentError)
+ -> { Process.exec([]) }.should raise_error(ArgumentError)
+ -> { Process.exec([:a]) }.should raise_error(ArgumentError)
+ -> { Process.exec([:a, :b, :c]) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/process/getrlimit_spec.rb b/spec/ruby/core/process/getrlimit_spec.rb
index d866a48186..f77a61a475 100644
--- a/spec/ruby/core/process/getrlimit_spec.rb
+++ b/spec/ruby/core/process/getrlimit_spec.rb
@@ -36,7 +36,7 @@ platform_is_not :windows do
obj = mock("process getrlimit integer")
obj.should_receive(:to_int).and_return(nil)
- lambda { Process.getrlimit(obj) }.should raise_error(TypeError)
+ -> { Process.getrlimit(obj) }.should raise_error(TypeError)
end
end
@@ -49,7 +49,7 @@ platform_is_not :windows do
end
it "raises ArgumentError when passed an unknown resource" do
- lambda { Process.getrlimit(:FOO) }.should raise_error(ArgumentError)
+ -> { Process.getrlimit(:FOO) }.should raise_error(ArgumentError)
end
end
@@ -62,7 +62,7 @@ platform_is_not :windows do
end
it "raises ArgumentError when passed an unknown resource" do
- lambda { Process.getrlimit("FOO") }.should raise_error(ArgumentError)
+ -> { Process.getrlimit("FOO") }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/process/groups_spec.rb b/spec/ruby/core/process/groups_spec.rb
index 325deb5977..6b9175736d 100644
--- a/spec/ruby/core/process/groups_spec.rb
+++ b/spec/ruby/core/process/groups_spec.rb
@@ -46,14 +46,14 @@ describe "Process.groups=" do
Process.groups.should == [ Process.gid ]
supplementary = groups - [ Process.gid ]
if supplementary.length > 0
- lambda { Process.groups = supplementary }.should raise_error(Errno::EPERM)
+ -> { Process.groups = supplementary }.should raise_error(Errno::EPERM)
end
end
end
platform_is_not :aix do
it "raises Errno::EPERM" do
- lambda {
+ -> {
Process.groups = [0]
}.should raise_error(Errno::EPERM)
end
diff --git a/spec/ruby/core/process/initgroups_spec.rb b/spec/ruby/core/process/initgroups_spec.rb
index e711fc0798..1dd516d8b2 100644
--- a/spec/ruby/core/process/initgroups_spec.rb
+++ b/spec/ruby/core/process/initgroups_spec.rb
@@ -14,7 +14,7 @@ describe "Process.initgroups" do
Process.groups.sort.should == augmented_groups.sort
Process.groups = groups
else
- lambda { Process.initgroups(name, gid) }.should raise_error(Errno::EPERM)
+ -> { Process.initgroups(name, gid) }.should raise_error(Errno::EPERM)
end
end
end
diff --git a/spec/ruby/core/process/kill_spec.rb b/spec/ruby/core/process/kill_spec.rb
index 14deba2451..4bd64a1fe8 100644
--- a/spec/ruby/core/process/kill_spec.rb
+++ b/spec/ruby/core/process/kill_spec.rb
@@ -9,25 +9,25 @@ describe "Process.kill" do
end
it "raises an ArgumentError for unknown signals" do
- lambda { Process.kill("FOO", @pid) }.should raise_error(ArgumentError)
+ -> { Process.kill("FOO", @pid) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if passed a lowercase signal name" do
- lambda { Process.kill("term", @pid) }.should raise_error(ArgumentError)
+ -> { Process.kill("term", @pid) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if signal is not a Fixnum or String" do
signal = mock("process kill signal")
signal.should_not_receive(:to_int)
- lambda { Process.kill(signal, @pid) }.should raise_error(ArgumentError)
+ -> { Process.kill(signal, @pid) }.should raise_error(ArgumentError)
end
it "raises Errno::ESRCH if the process does not exist" do
pid = Process.spawn(*ruby_exe, "-e", "sleep 10")
Process.kill("SIGKILL", pid)
Process.wait(pid)
- lambda {
+ -> {
Process.kill("SIGKILL", pid)
}.should raise_error(Errno::ESRCH)
end
diff --git a/spec/ruby/core/process/setrlimit_spec.rb b/spec/ruby/core/process/setrlimit_spec.rb
index f4ff607b7b..8bc035a4f1 100644
--- a/spec/ruby/core/process/setrlimit_spec.rb
+++ b/spec/ruby/core/process/setrlimit_spec.rb
@@ -16,7 +16,7 @@ platform_is_not :windows do
obj = mock("process getrlimit integer")
obj.should_receive(:to_int).and_return(nil)
- lambda { Process.setrlimit(obj, @limit, @max) }.should raise_error(TypeError)
+ -> { Process.setrlimit(obj, @limit, @max) }.should raise_error(TypeError)
end
it "calls #to_int to convert the soft limit to an Integer" do
@@ -27,7 +27,7 @@ platform_is_not :windows do
obj = mock("process getrlimit integer")
obj.should_receive(:to_int).and_return(nil)
- lambda { Process.setrlimit(@resource, obj, @max) }.should raise_error(TypeError)
+ -> { Process.setrlimit(@resource, obj, @max) }.should raise_error(TypeError)
end
it "calls #to_int to convert the hard limit to an Integer" do
@@ -38,7 +38,7 @@ platform_is_not :windows do
obj = mock("process getrlimit integer")
obj.should_receive(:to_int).and_return(nil)
- lambda { Process.setrlimit(@resource, @limit, obj) }.should raise_error(TypeError)
+ -> { Process.setrlimit(@resource, @limit, obj) }.should raise_error(TypeError)
end
end
@@ -120,7 +120,7 @@ platform_is_not :windows do
end
it "raises ArgumentError when passed an unknown resource" do
- lambda { Process.setrlimit(:FOO, 1, 1) }.should raise_error(ArgumentError)
+ -> { Process.setrlimit(:FOO, 1, 1) }.should raise_error(ArgumentError)
end
end
@@ -202,7 +202,7 @@ platform_is_not :windows do
end
it "raises ArgumentError when passed an unknown resource" do
- lambda { Process.setrlimit("FOO", 1, 1) }.should raise_error(ArgumentError)
+ -> { Process.setrlimit("FOO", 1, 1) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/process/spawn_spec.rb b/spec/ruby/core/process/spawn_spec.rb
index aa7a7dc3aa..46faced3e4 100644
--- a/spec/ruby/core/process/spawn_spec.rb
+++ b/spec/ruby/core/process/spawn_spec.rb
@@ -45,7 +45,7 @@ describe "Process.spawn" do
end
it "executes the given command" do
- lambda { Process.wait Process.spawn("echo spawn") }.should output_to_fd("spawn\n")
+ -> { Process.wait Process.spawn("echo spawn") }.should output_to_fd("spawn\n")
end
it "returns the process ID of the new process as a Fixnum" do
@@ -67,43 +67,43 @@ describe "Process.spawn" do
describe "with a single argument" do
platform_is_not :windows do
it "subjects the specified command to shell expansion" do
- lambda { Process.wait Process.spawn("echo *") }.should_not output_to_fd("*\n")
+ -> { Process.wait Process.spawn("echo *") }.should_not output_to_fd("*\n")
end
it "creates an argument array with shell parsing semantics for whitespace" do
- lambda { Process.wait Process.spawn("echo a b c d") }.should output_to_fd("a b c d\n")
+ -> { Process.wait Process.spawn("echo a b c d") }.should output_to_fd("a b c d\n")
end
end
platform_is :windows do
# There is no shell expansion on Windows
it "does not subject the specified command to shell expansion on Windows" do
- lambda { Process.wait Process.spawn("echo *") }.should output_to_fd("*\n")
+ -> { Process.wait Process.spawn("echo *") }.should output_to_fd("*\n")
end
it "does not create an argument array with shell parsing semantics for whitespace on Windows" do
- lambda { Process.wait Process.spawn("echo a b c d") }.should output_to_fd("a b c d\n")
+ -> { Process.wait Process.spawn("echo a b c d") }.should output_to_fd("a b c d\n")
end
end
it "calls #to_str to convert the argument to a String" do
o = mock("to_str")
o.should_receive(:to_str).and_return("echo foo")
- lambda { Process.wait Process.spawn(o) }.should output_to_fd("foo\n")
+ -> { Process.wait Process.spawn(o) }.should output_to_fd("foo\n")
end
it "raises an ArgumentError if the command includes a null byte" do
- lambda { Process.spawn "\000" }.should raise_error(ArgumentError)
+ -> { Process.spawn "\000" }.should raise_error(ArgumentError)
end
it "raises a TypeError if the argument does not respond to #to_str" do
- lambda { Process.spawn :echo }.should raise_error(TypeError)
+ -> { Process.spawn :echo }.should raise_error(TypeError)
end
end
describe "with multiple arguments" do
it "does not subject the arguments to shell expansion" do
- lambda { Process.wait Process.spawn("echo", "*") }.should output_to_fd("*\n")
+ -> { Process.wait Process.spawn("echo", "*") }.should output_to_fd("*\n")
end
it "preserves whitespace in passed arguments" do
@@ -112,36 +112,36 @@ describe "Process.spawn" do
# The echo command on Windows takes quotes literally
out = "\"a b c d\"\n"
end
- lambda { Process.wait Process.spawn("echo", "a b c d") }.should output_to_fd(out)
+ -> { Process.wait Process.spawn("echo", "a b c d") }.should output_to_fd(out)
end
it "calls #to_str to convert the arguments to Strings" do
o = mock("to_str")
o.should_receive(:to_str).and_return("foo")
- lambda { Process.wait Process.spawn("echo", o) }.should output_to_fd("foo\n")
+ -> { Process.wait Process.spawn("echo", o) }.should output_to_fd("foo\n")
end
it "raises an ArgumentError if an argument includes a null byte" do
- lambda { Process.spawn "echo", "\000" }.should raise_error(ArgumentError)
+ -> { Process.spawn "echo", "\000" }.should raise_error(ArgumentError)
end
it "raises a TypeError if an argument does not respond to #to_str" do
- lambda { Process.spawn "echo", :foo }.should raise_error(TypeError)
+ -> { Process.spawn "echo", :foo }.should raise_error(TypeError)
end
end
describe "with a command array" do
it "uses the first element as the command name and the second as the argv[0] value" do
platform_is_not :windows do
- lambda { Process.wait Process.spawn(["/bin/sh", "argv_zero"], "-c", "echo $0") }.should output_to_fd("argv_zero\n")
+ -> { Process.wait Process.spawn(["/bin/sh", "argv_zero"], "-c", "echo $0") }.should output_to_fd("argv_zero\n")
end
platform_is :windows do
- lambda { Process.wait Process.spawn(["cmd.exe", "/C"], "/C", "echo", "argv_zero") }.should output_to_fd("argv_zero\n")
+ -> { Process.wait Process.spawn(["cmd.exe", "/C"], "/C", "echo", "argv_zero") }.should output_to_fd("argv_zero\n")
end
end
it "does not subject the arguments to shell expansion" do
- lambda { Process.wait Process.spawn(["echo", "echo"], "*") }.should output_to_fd("*\n")
+ -> { Process.wait Process.spawn(["echo", "echo"], "*") }.should output_to_fd("*\n")
end
it "preserves whitespace in passed arguments" do
@@ -150,47 +150,47 @@ describe "Process.spawn" do
# The echo command on Windows takes quotes literally
out = "\"a b c d\"\n"
end
- lambda { Process.wait Process.spawn(["echo", "echo"], "a b c d") }.should output_to_fd(out)
+ -> { Process.wait Process.spawn(["echo", "echo"], "a b c d") }.should output_to_fd(out)
end
it "calls #to_ary to convert the argument to an Array" do
o = mock("to_ary")
platform_is_not :windows do
o.should_receive(:to_ary).and_return(["/bin/sh", "argv_zero"])
- lambda { Process.wait Process.spawn(o, "-c", "echo $0") }.should output_to_fd("argv_zero\n")
+ -> { Process.wait Process.spawn(o, "-c", "echo $0") }.should output_to_fd("argv_zero\n")
end
platform_is :windows do
o.should_receive(:to_ary).and_return(["cmd.exe", "/C"])
- lambda { Process.wait Process.spawn(o, "/C", "echo", "argv_zero") }.should output_to_fd("argv_zero\n")
+ -> { Process.wait Process.spawn(o, "/C", "echo", "argv_zero") }.should output_to_fd("argv_zero\n")
end
end
it "calls #to_str to convert the first element to a String" do
o = mock("to_str")
o.should_receive(:to_str).and_return("echo")
- lambda { Process.wait Process.spawn([o, "echo"], "foo") }.should output_to_fd("foo\n")
+ -> { Process.wait Process.spawn([o, "echo"], "foo") }.should output_to_fd("foo\n")
end
it "calls #to_str to convert the second element to a String" do
o = mock("to_str")
o.should_receive(:to_str).and_return("echo")
- lambda { Process.wait Process.spawn(["echo", o], "foo") }.should output_to_fd("foo\n")
+ -> { Process.wait Process.spawn(["echo", o], "foo") }.should output_to_fd("foo\n")
end
it "raises an ArgumentError if the Array does not have exactly two elements" do
- lambda { Process.spawn([]) }.should raise_error(ArgumentError)
- lambda { Process.spawn([:a]) }.should raise_error(ArgumentError)
- lambda { Process.spawn([:a, :b, :c]) }.should raise_error(ArgumentError)
+ -> { Process.spawn([]) }.should raise_error(ArgumentError)
+ -> { Process.spawn([:a]) }.should raise_error(ArgumentError)
+ -> { Process.spawn([:a, :b, :c]) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if the Strings in the Array include a null byte" do
- lambda { Process.spawn ["\000", "echo"] }.should raise_error(ArgumentError)
- lambda { Process.spawn ["echo", "\000"] }.should raise_error(ArgumentError)
+ -> { Process.spawn ["\000", "echo"] }.should raise_error(ArgumentError)
+ -> { Process.spawn ["echo", "\000"] }.should raise_error(ArgumentError)
end
it "raises a TypeError if an element in the Array does not respond to #to_str" do
- lambda { Process.spawn ["echo", :echo] }.should raise_error(TypeError)
- lambda { Process.spawn [:echo, "echo"] }.should raise_error(TypeError)
+ -> { Process.spawn ["echo", :echo] }.should raise_error(TypeError)
+ -> { Process.spawn [:echo, "echo"] }.should raise_error(TypeError)
end
end
@@ -238,19 +238,19 @@ describe "Process.spawn" do
end
it "raises an ArgumentError if an environment key includes an equals sign" do
- lambda do
+ -> do
Process.spawn({"FOO=" => "BAR"}, "echo #{@var}>#{@name}")
end.should raise_error(ArgumentError)
end
it "raises an ArgumentError if an environment key includes a null byte" do
- lambda do
+ -> do
Process.spawn({"\000" => "BAR"}, "echo #{@var}>#{@name}")
end.should raise_error(ArgumentError)
end
it "raises an ArgumentError if an environment value includes a null byte" do
- lambda do
+ -> do
Process.spawn({"FOO" => "\000"}, "echo #{@var}>#{@name}")
end.should raise_error(ArgumentError)
end
@@ -294,25 +294,25 @@ describe "Process.spawn" do
platform_is_not :windows do
it "joins the current process group by default" do
- lambda do
+ -> do
Process.wait Process.spawn(ruby_cmd("print Process.getpgid(Process.pid)"))
end.should output_to_fd(Process.getpgid(Process.pid).to_s)
end
it "joins the current process if pgroup: false" do
- lambda do
+ -> do
Process.wait Process.spawn(ruby_cmd("print Process.getpgid(Process.pid)"), pgroup: false)
end.should output_to_fd(Process.getpgid(Process.pid).to_s)
end
it "joins the current process if pgroup: nil" do
- lambda do
+ -> do
Process.wait Process.spawn(ruby_cmd("print Process.getpgid(Process.pid)"), pgroup: nil)
end.should output_to_fd(Process.getpgid(Process.pid).to_s)
end
it "joins a new process group if pgroup: true" do
- process = lambda do
+ process = -> do
Process.wait Process.spawn(ruby_cmd("print Process.getpgid(Process.pid)"), pgroup: true)
end
@@ -321,7 +321,7 @@ describe "Process.spawn" do
end
it "joins a new process group if pgroup: 0" do
- process = lambda do
+ process = -> do
Process.wait Process.spawn(ruby_cmd("print Process.getpgid(Process.pid)"), pgroup: 0)
end
@@ -331,23 +331,23 @@ describe "Process.spawn" do
it "joins the specified process group if pgroup: pgid" do
pgid = Process.getpgid(Process.pid)
- lambda do
+ -> do
Process.wait Process.spawn(ruby_cmd("print Process.getpgid(Process.pid)"), pgroup: pgid)
end.should output_to_fd(pgid.to_s)
end
it "raises an ArgumentError if given a negative :pgroup option" do
- lambda { Process.spawn("echo", pgroup: -1) }.should raise_error(ArgumentError)
+ -> { Process.spawn("echo", pgroup: -1) }.should raise_error(ArgumentError)
end
it "raises a TypeError if given a symbol as :pgroup option" do
- lambda { Process.spawn("echo", pgroup: :true) }.should raise_error(TypeError)
+ -> { Process.spawn("echo", pgroup: :true) }.should raise_error(TypeError)
end
end
platform_is :windows do
it "raises an ArgumentError if given :pgroup option" do
- lambda { Process.spawn("echo", pgroup: false) }.should raise_error(ArgumentError)
+ -> { Process.spawn("echo", pgroup: false) }.should raise_error(ArgumentError)
end
end
@@ -358,7 +358,7 @@ describe "Process.spawn" do
# :chdir
it "uses the current working directory as its working directory" do
- lambda do
+ -> do
Process.wait Process.spawn(ruby_cmd("print Dir.pwd"))
end.should output_to_fd(Dir.pwd)
end
@@ -374,7 +374,7 @@ describe "Process.spawn" do
end
it "changes to the directory passed for :chdir" do
- lambda do
+ -> do
Process.wait Process.spawn(ruby_cmd("print Dir.pwd"), chdir: @dir)
end.should output_to_fd(@dir)
end
@@ -383,7 +383,7 @@ describe "Process.spawn" do
dir = mock("spawn_to_path")
dir.should_receive(:to_path).and_return(@dir)
- lambda do
+ -> do
Process.wait Process.spawn(ruby_cmd("print Dir.pwd"), chdir: dir)
end.should output_to_fd(@dir)
end
@@ -424,7 +424,7 @@ describe "Process.spawn" do
sleep(1)
children.each do |child|
- lambda do
+ -> do
Process.kill("TERM", child)
end.should raise_error(Errno::ESRCH)
end
@@ -436,14 +436,14 @@ describe "Process.spawn" do
# :umask
it "uses the current umask by default" do
- lambda do
+ -> do
Process.wait Process.spawn(ruby_cmd("print File.umask"))
end.should output_to_fd(File.umask.to_s)
end
platform_is_not :windows do
it "sets the umask if given the :umask option" do
- lambda do
+ -> do
Process.wait Process.spawn(ruby_cmd("print File.umask"), umask: 146)
end.should output_to_fd("146")
end
@@ -453,7 +453,7 @@ describe "Process.spawn" do
it "redirects STDOUT to the given file descriptor if out: Fixnum" do
File.open(@name, 'w') do |file|
- lambda do
+ -> do
Process.wait Process.spawn("echo glark", out: file.fileno)
end.should output_to_fd("glark\n", file)
end
@@ -461,7 +461,7 @@ describe "Process.spawn" do
it "redirects STDOUT to the given file if out: IO" do
File.open(@name, 'w') do |file|
- lambda do
+ -> do
Process.wait Process.spawn("echo glark", out: file)
end.should output_to_fd("glark\n", file)
end
@@ -479,7 +479,7 @@ describe "Process.spawn" do
it "redirects STDERR to the given file descriptor if err: Fixnum" do
File.open(@name, 'w') do |file|
- lambda do
+ -> do
Process.wait Process.spawn("echo glark>&2", err: file.fileno)
end.should output_to_fd("glark\n", file)
end
@@ -487,7 +487,7 @@ describe "Process.spawn" do
it "redirects STDERR to the given file descriptor if err: IO" do
File.open(@name, 'w') do |file|
- lambda do
+ -> do
Process.wait Process.spawn("echo glark>&2", err: file)
end.should output_to_fd("glark\n", file)
end
@@ -500,7 +500,7 @@ describe "Process.spawn" do
it "redirects STDERR to child STDOUT if :err => [:child, :out]" do
File.open(@name, 'w') do |file|
- lambda do
+ -> do
Process.wait Process.spawn("echo glark>&2", :out => file, :err => [:child, :out])
end.should output_to_fd("glark\n", file)
end
@@ -508,7 +508,7 @@ describe "Process.spawn" do
it "redirects both STDERR and STDOUT to the given file descriptor" do
File.open(@name, 'w') do |file|
- lambda do
+ -> do
Process.wait Process.spawn(ruby_cmd("print(:glark); STDOUT.flush; STDERR.print(:bang)"),
[:out, :err] => file.fileno)
end.should output_to_fd("glarkbang", file)
@@ -517,7 +517,7 @@ describe "Process.spawn" do
it "redirects both STDERR and STDOUT to the given IO" do
File.open(@name, 'w') do |file|
- lambda do
+ -> do
Process.wait Process.spawn(ruby_cmd("print(:glark); STDOUT.flush; STDERR.print(:bang)"),
[:out, :err] => file)
end.should output_to_fd("glarkbang", file)
@@ -626,35 +626,35 @@ describe "Process.spawn" do
# error handling
it "raises an ArgumentError if passed no command arguments" do
- lambda { Process.spawn }.should raise_error(ArgumentError)
+ -> { Process.spawn }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if passed env or options but no command arguments" do
- lambda { Process.spawn({}) }.should raise_error(ArgumentError)
+ -> { Process.spawn({}) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if passed env and options but no command arguments" do
- lambda { Process.spawn({}, {}) }.should raise_error(ArgumentError)
+ -> { Process.spawn({}, {}) }.should raise_error(ArgumentError)
end
it "raises an Errno::ENOENT for an empty string" do
- lambda { Process.spawn "" }.should raise_error(Errno::ENOENT)
+ -> { Process.spawn "" }.should raise_error(Errno::ENOENT)
end
it "raises an Errno::ENOENT if the command does not exist" do
- lambda { Process.spawn "nonesuch" }.should raise_error(Errno::ENOENT)
+ -> { Process.spawn "nonesuch" }.should raise_error(Errno::ENOENT)
end
unless File.executable?(__FILE__) # Some FS (e.g. vboxfs) locate all files executable
platform_is_not :windows do
it "raises an Errno::EACCES when the file does not have execute permissions" do
- lambda { Process.spawn __FILE__ }.should raise_error(Errno::EACCES)
+ -> { Process.spawn __FILE__ }.should raise_error(Errno::EACCES)
end
end
platform_is :windows do
it "raises Errno::EACCES or Errno::ENOEXEC when the file is not an executable file" do
- lambda { Process.spawn __FILE__ }.should raise_error(SystemCallError) { |e|
+ -> { Process.spawn __FILE__ }.should raise_error(SystemCallError) { |e|
[Errno::EACCES, Errno::ENOEXEC].should include(e.class)
}
end
@@ -662,17 +662,17 @@ describe "Process.spawn" do
end
it "raises an Errno::EACCES or Errno::EISDIR when passed a directory" do
- lambda { Process.spawn File.dirname(__FILE__) }.should raise_error(SystemCallError) { |e|
+ -> { Process.spawn File.dirname(__FILE__) }.should raise_error(SystemCallError) { |e|
[Errno::EACCES, Errno::EISDIR].should include(e.class)
}
end
it "raises an ArgumentError when passed a string key in options" do
- lambda { Process.spawn("echo", "chdir" => Dir.pwd) }.should raise_error(ArgumentError)
+ -> { Process.spawn("echo", "chdir" => Dir.pwd) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when passed an unknown option key" do
- lambda { Process.spawn("echo", nonesuch: :foo) }.should raise_error(ArgumentError)
+ -> { Process.spawn("echo", nonesuch: :foo) }.should raise_error(ArgumentError)
end
platform_is_not :windows, :aix do
diff --git a/spec/ruby/core/process/uid_spec.rb b/spec/ruby/core/process/uid_spec.rb
index 350779aff3..a068b1a2c1 100644
--- a/spec/ruby/core/process/uid_spec.rb
+++ b/spec/ruby/core/process/uid_spec.rb
@@ -20,16 +20,16 @@ end
describe "Process.uid=" do
platform_is_not :windows do
it "raises TypeError if not passed an Integer" do
- lambda { Process.uid = Object.new }.should raise_error(TypeError)
+ -> { Process.uid = Object.new }.should raise_error(TypeError)
end
as_user do
it "raises Errno::ERPERM if run by a non privileged user trying to set the superuser id" do
- lambda { (Process.uid = 0)}.should raise_error(Errno::EPERM)
+ -> { (Process.uid = 0)}.should raise_error(Errno::EPERM)
end
it "raises Errno::ERPERM if run by a non privileged user trying to set the superuser id from username" do
- lambda { Process.uid = "root" }.should raise_error(Errno::EPERM)
+ -> { Process.uid = "root" }.should raise_error(Errno::EPERM)
end
end
diff --git a/spec/ruby/core/process/wait2_spec.rb b/spec/ruby/core/process/wait2_spec.rb
index 4b6491ccd2..6eb7fc6d06 100644
--- a/spec/ruby/core/process/wait2_spec.rb
+++ b/spec/ruby/core/process/wait2_spec.rb
@@ -30,7 +30,7 @@ describe "Process.wait2" do
end
it "raises a StandardError if no child processes exist" do
- lambda { Process.wait2 }.should raise_error(Errno::ECHILD)
- lambda { Process.wait2 }.should raise_error(StandardError)
+ -> { Process.wait2 }.should raise_error(Errno::ECHILD)
+ -> { Process.wait2 }.should raise_error(StandardError)
end
end
diff --git a/spec/ruby/core/process/wait_spec.rb b/spec/ruby/core/process/wait_spec.rb
index 000ff684d4..f393a99e0f 100644
--- a/spec/ruby/core/process/wait_spec.rb
+++ b/spec/ruby/core/process/wait_spec.rb
@@ -15,7 +15,7 @@ describe "Process.wait" do
end
it "raises an Errno::ECHILD if there are no child processes" do
- lambda { Process.wait }.should raise_error(Errno::ECHILD)
+ -> { Process.wait }.should raise_error(Errno::ECHILD)
end
platform_is_not :windows do
@@ -34,7 +34,7 @@ describe "Process.wait" do
it "waits for any child process if no pid is given" do
pid = Process.spawn(ruby_cmd('exit'))
Process.wait.should == pid
- lambda { Process.kill(0, pid) }.should raise_error(Errno::ESRCH)
+ -> { Process.kill(0, pid) }.should raise_error(Errno::ESRCH)
end
it "waits for a specific child if a pid is given" do
@@ -42,14 +42,14 @@ describe "Process.wait" do
pid2 = Process.spawn(ruby_cmd('exit'))
Process.wait(pid2).should == pid2
Process.wait(pid1).should == pid1
- lambda { Process.kill(0, pid1) }.should raise_error(Errno::ESRCH)
- lambda { Process.kill(0, pid2) }.should raise_error(Errno::ESRCH)
+ -> { Process.kill(0, pid1) }.should raise_error(Errno::ESRCH)
+ -> { Process.kill(0, pid2) }.should raise_error(Errno::ESRCH)
end
it "coerces the pid to an Integer" do
pid1 = Process.spawn(ruby_cmd('exit'))
Process.wait(mock_int(pid1)).should == pid1
- lambda { Process.kill(0, pid1) }.should raise_error(Errno::ESRCH)
+ -> { Process.kill(0, pid1) }.should raise_error(Errno::ESRCH)
end
# This spec is probably system-dependent.
@@ -86,7 +86,7 @@ describe "Process.wait" do
it "always accepts flags=0" do
pid = Process.spawn(ruby_cmd('exit'))
Process.wait(-1, 0).should == pid
- lambda { Process.kill(0, pid) }.should raise_error(Errno::ESRCH)
+ -> { Process.kill(0, pid) }.should raise_error(Errno::ESRCH)
end
end
end
diff --git a/spec/ruby/core/process/waitall_spec.rb b/spec/ruby/core/process/waitall_spec.rb
index bdc1ea7490..6cf4e32bc9 100644
--- a/spec/ruby/core/process/waitall_spec.rb
+++ b/spec/ruby/core/process/waitall_spec.rb
@@ -13,7 +13,7 @@ describe "Process.waitall" do
end
it "takes no arguments" do
- lambda { Process.waitall(0) }.should raise_error(ArgumentError)
+ -> { Process.waitall(0) }.should raise_error(ArgumentError)
end
platform_is_not :windows do
@@ -24,7 +24,7 @@ describe "Process.waitall" do
pids << Process.fork { Process.exit! 0 }
Process.waitall
pids.each { |pid|
- lambda { Process.kill(0, pid) }.should raise_error(Errno::ESRCH)
+ -> { Process.kill(0, pid) }.should raise_error(Errno::ESRCH)
}
end
diff --git a/spec/ruby/core/random/fixtures/classes.rb b/spec/ruby/core/random/fixtures/classes.rb
new file mode 100644
index 0000000000..9c8d113e24
--- /dev/null
+++ b/spec/ruby/core/random/fixtures/classes.rb
@@ -0,0 +1,15 @@
+module RandomSpecs
+ CustomRangeInteger = Struct.new(:value) do
+ def to_int; value; end
+ def <=>(other); to_int <=> other.to_int; end
+ def -(other); self.class.new(to_int - other.to_int); end
+ def +(other); self.class.new(to_int + other.to_int); end
+ end
+
+ CustomRangeFloat = Struct.new(:value) do
+ def to_f; value; end
+ def <=>(other); to_f <=> other.to_f; end
+ def -(other); to_f - other.to_f; end
+ def +(other); self.class.new(to_f + other.to_f); end
+ end
+end
diff --git a/spec/ruby/core/random/new_spec.rb b/spec/ruby/core/random/new_spec.rb
index 8160f44d79..07d7b439ca 100644
--- a/spec/ruby/core/random/new_spec.rb
+++ b/spec/ruby/core/random/new_spec.rb
@@ -30,7 +30,7 @@ describe "Random.new" do
end
it "raises a RangeError if passed a Complex (with imaginary part) seed value as an argument" do
- lambda do
+ -> do
Random.new(Complex(20,2))
end.should raise_error(RangeError)
end
diff --git a/spec/ruby/core/random/rand_spec.rb b/spec/ruby/core/random/rand_spec.rb
index 395e89dc75..b585aa9737 100644
--- a/spec/ruby/core/random/rand_spec.rb
+++ b/spec/ruby/core/random/rand_spec.rb
@@ -1,4 +1,5 @@
require_relative '../../spec_helper'
+require_relative 'fixtures/classes'
describe "Random.rand" do
it "returns a Float if no max argument is passed" do
@@ -83,13 +84,13 @@ describe "Random#rand with Fixnum" do
end
it "raises an ArgumentError when the argument is 0" do
- lambda do
+ -> do
Random.new.rand(0)
end.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the argument is negative" do
- lambda do
+ -> do
Random.new.rand(-12)
end.should raise_error(ArgumentError)
end
@@ -122,7 +123,7 @@ describe "Random#rand with Bignum" do
end
it "raises an ArgumentError when the argument is negative" do
- lambda do
+ -> do
Random.new.rand(-bignum_value)
end.should raise_error(ArgumentError)
end
@@ -154,7 +155,7 @@ describe "Random#rand with Float" do
end
it "raises an ArgumentError when the argument is negative" do
- lambda do
+ -> do
Random.new.rand(-1.234567)
end.should raise_error(ArgumentError)
end
@@ -165,6 +166,12 @@ describe "Random#rand with Range" do
Random.new.rand(20..43).should be_an_instance_of(Fixnum)
end
+ it "supports custom object types" do
+ rand(RandomSpecs::CustomRangeInteger.new(1)..RandomSpecs::CustomRangeInteger.new(42)).should be_an_instance_of(RandomSpecs::CustomRangeInteger)
+ rand(RandomSpecs::CustomRangeFloat.new(1.0)..RandomSpecs::CustomRangeFloat.new(42.0)).should be_an_instance_of(RandomSpecs::CustomRangeFloat)
+ rand(Time.now..Time.now).should be_an_instance_of(Time)
+ end
+
it "returns an object that is a member of the Range" do
prng = Random.new
r = 20..30
@@ -203,13 +210,13 @@ describe "Random#rand with Range" do
end
it "raises an ArgumentError when the startpoint lacks #+ and #- methods" do
- lambda do
+ -> do
Random.new.rand(Object.new..67)
end.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the endpoint lacks #+ and #- methods" do
- lambda do
+ -> do
Random.new.rand(68..Object.new)
end.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/core/random/shared/urandom.rb b/spec/ruby/core/random/shared/urandom.rb
index 316167b63f..159716075c 100644
--- a/spec/ruby/core/random/shared/urandom.rb
+++ b/spec/ruby/core/random/shared/urandom.rb
@@ -8,7 +8,7 @@ describe :random_urandom, shared: true do
end
it "raises an ArgumentError on a negative size" do
- lambda {
+ -> {
Random.send(@method, -1)
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/core/range/bsearch_spec.rb b/spec/ruby/core/range/bsearch_spec.rb
index 399bd49623..009cafb00e 100644
--- a/spec/ruby/core/range/bsearch_spec.rb
+++ b/spec/ruby/core/range/bsearch_spec.rb
@@ -9,22 +9,22 @@ describe "Range#bsearch" do
it_behaves_like :enumeratorized_with_unknown_size, :bsearch, (1..3)
it "raises a TypeError if the block returns an Object" do
- lambda { (0..1).bsearch { Object.new } }.should raise_error(TypeError)
+ -> { (0..1).bsearch { Object.new } }.should raise_error(TypeError)
end
it "raises a TypeError if the block returns a String" do
- lambda { (0..1).bsearch { "1" } }.should raise_error(TypeError)
+ -> { (0..1).bsearch { "1" } }.should raise_error(TypeError)
end
it "raises a TypeError if the Range has Object values" do
value = mock("range bsearch")
r = Range.new value, value
- lambda { r.bsearch { true } }.should raise_error(TypeError)
+ -> { r.bsearch { true } }.should raise_error(TypeError)
end
it "raises a TypeError if the Range has String values" do
- lambda { ("a".."e").bsearch { true } }.should raise_error(TypeError)
+ -> { ("a".."e").bsearch { true } }.should raise_error(TypeError)
end
context "with Integer values" do
diff --git a/spec/ruby/core/range/case_compare_spec.rb b/spec/ruby/core/range/case_compare_spec.rb
index 37d8cc4677..0ca03f6a35 100644
--- a/spec/ruby/core/range/case_compare_spec.rb
+++ b/spec/ruby/core/range/case_compare_spec.rb
@@ -13,7 +13,7 @@ describe "Range#===" do
it "requires #succ method to be implemented" do
range = RangeSpecs::WithoutSucc.new(0)..RangeSpecs::WithoutSucc.new(10)
- lambda do
+ -> do
range === RangeSpecs::WithoutSucc.new(2)
end.should raise_error(TypeError, /can't iterate from/)
end
diff --git a/spec/ruby/core/range/each_spec.rb b/spec/ruby/core/range/each_spec.rb
index c5253dafd9..110b0602d0 100644
--- a/spec/ruby/core/range/each_spec.rb
+++ b/spec/ruby/core/range/each_spec.rb
@@ -33,12 +33,12 @@ describe "Range#each" do
end
it "raises a TypeError if the first element does not respond to #succ" do
- lambda { (0.5..2.4).each { |i| i } }.should raise_error(TypeError)
+ -> { (0.5..2.4).each { |i| i } }.should raise_error(TypeError)
b = mock('x')
(a = mock('1')).should_receive(:<=>).with(b).and_return(1)
- lambda { (a..b).each { |i| i } }.should raise_error(TypeError)
+ -> { (a..b).each { |i| i } }.should raise_error(TypeError)
end
it "returns self" do
@@ -54,7 +54,7 @@ describe "Range#each" do
it "raises a TypeError if the first element is a Time object" do
t = Time.now
- lambda { (t..t+1).each { |i| i } }.should raise_error(TypeError)
+ -> { (t..t+1).each { |i| i } }.should raise_error(TypeError)
end
it "passes each Symbol element by using #succ" do
diff --git a/spec/ruby/core/range/first_spec.rb b/spec/ruby/core/range/first_spec.rb
index b7ae72ec6c..5f073b48ee 100644
--- a/spec/ruby/core/range/first_spec.rb
+++ b/spec/ruby/core/range/first_spec.rb
@@ -21,7 +21,7 @@ describe "Range#first" do
end
it "raises an ArgumentError when count is negative" do
- lambda { (0..2).first(-1) }.should raise_error(ArgumentError)
+ -> { (0..2).first(-1) }.should raise_error(ArgumentError)
end
it "calls #to_int to convert the argument" do
@@ -32,7 +32,7 @@ describe "Range#first" do
it "raises a TypeError if #to_int does not return an Integer" do
obj = mock("to_int")
obj.should_receive(:to_int).and_return("1")
- lambda { (2..3).first(obj) }.should raise_error(TypeError)
+ -> { (2..3).first(obj) }.should raise_error(TypeError)
end
it "truncates the value when passed a Float" do
@@ -40,10 +40,10 @@ describe "Range#first" do
end
it "raises a TypeError when passed nil" do
- lambda { (2..3).first(nil) }.should raise_error(TypeError)
+ -> { (2..3).first(nil) }.should raise_error(TypeError)
end
it "raises a TypeError when passed a String" do
- lambda { (2..3).first("1") }.should raise_error(TypeError)
+ -> { (2..3).first("1") }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/range/initialize_spec.rb b/spec/ruby/core/range/initialize_spec.rb
index 53f6485954..8caf12baa2 100644
--- a/spec/ruby/core/range/initialize_spec.rb
+++ b/spec/ruby/core/range/initialize_spec.rb
@@ -10,32 +10,32 @@ describe "Range#initialize" do
end
it "initializes correctly the Range object when given 2 arguments" do
- lambda { @range.send(:initialize, 0, 1) }.should_not raise_error
+ -> { @range.send(:initialize, 0, 1) }.should_not raise_error
end
it "initializes correctly the Range object when given 3 arguments" do
- lambda { @range.send(:initialize, 0, 1, true) }.should_not raise_error
+ -> { @range.send(:initialize, 0, 1, true) }.should_not raise_error
end
it "raises an ArgumentError if passed without or with only one argument" do
- lambda { @range.send(:initialize) }.should raise_error(ArgumentError)
- lambda { @range.send(:initialize, 1) }.should raise_error(ArgumentError)
+ -> { @range.send(:initialize) }.should raise_error(ArgumentError)
+ -> { @range.send(:initialize, 1) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if passed with four or more arguments" do
- lambda { @range.send(:initialize, 1, 3, 5, 7) }.should raise_error(ArgumentError)
- lambda { @range.send(:initialize, 1, 3, 5, 7, 9) }.should raise_error(ArgumentError)
+ -> { @range.send(:initialize, 1, 3, 5, 7) }.should raise_error(ArgumentError)
+ -> { @range.send(:initialize, 1, 3, 5, 7, 9) }.should raise_error(ArgumentError)
end
it "raises a NameError if called on an already initialized Range" do
- lambda { (0..1).send(:initialize, 1, 3) }.should raise_error(NameError)
- lambda { (0..1).send(:initialize, 1, 3, true) }.should raise_error(NameError)
+ -> { (0..1).send(:initialize, 1, 3) }.should raise_error(NameError)
+ -> { (0..1).send(:initialize, 1, 3, true) }.should raise_error(NameError)
end
it "raises an ArgumentError if arguments don't respond to <=>" do
o1 = Object.new
o2 = Object.new
- lambda { @range.send(:initialize, o1, o2) }.should raise_error(ArgumentError)
+ -> { @range.send(:initialize, o1, o2) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/range/last_spec.rb b/spec/ruby/core/range/last_spec.rb
index 8983f80cfb..c7e629e62c 100644
--- a/spec/ruby/core/range/last_spec.rb
+++ b/spec/ruby/core/range/last_spec.rb
@@ -21,7 +21,7 @@ describe "Range#last" do
end
it "raises an ArgumentError when count is negative" do
- lambda { (0..2).last(-1) }.should raise_error(ArgumentError)
+ -> { (0..2).last(-1) }.should raise_error(ArgumentError)
end
it "calls #to_int to convert the argument" do
@@ -32,7 +32,7 @@ describe "Range#last" do
it "raises a TypeError if #to_int does not return an Integer" do
obj = mock("to_int")
obj.should_receive(:to_int).and_return("1")
- lambda { (2..3).last(obj) }.should raise_error(TypeError)
+ -> { (2..3).last(obj) }.should raise_error(TypeError)
end
it "truncates the value when passed a Float" do
@@ -40,10 +40,10 @@ describe "Range#last" do
end
it "raises a TypeError when passed nil" do
- lambda { (2..3).last(nil) }.should raise_error(TypeError)
+ -> { (2..3).last(nil) }.should raise_error(TypeError)
end
it "raises a TypeError when passed a String" do
- lambda { (2..3).last("1") }.should raise_error(TypeError)
+ -> { (2..3).last("1") }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/range/max_spec.rb b/spec/ruby/core/range/max_spec.rb
index e6915cc450..faac0a2032 100644
--- a/spec/ruby/core/range/max_spec.rb
+++ b/spec/ruby/core/range/max_spec.rb
@@ -14,7 +14,7 @@ describe "Range#max" do
end
it "raises TypeError when called on an exclusive range and a non Integer value" do
- lambda { (303.20...908.1111).max }.should raise_error(TypeError)
+ -> { (303.20...908.1111).max }.should raise_error(TypeError)
end
it "returns nil when the endpoint is less than the start point" do
@@ -43,7 +43,7 @@ describe "Range#max" do
it "raises TypeError when called on a Time...Time(excluded end point)" do
time_start = Time.now
time_end = Time.now + 1.0
- lambda { (time_start...time_end).max }.should raise_error(TypeError)
+ -> { (time_start...time_end).max }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/range/new_spec.rb b/spec/ruby/core/range/new_spec.rb
index 367511742c..9ed2b65d5a 100644
--- a/spec/ruby/core/range/new_spec.rb
+++ b/spec/ruby/core/range/new_spec.rb
@@ -25,12 +25,12 @@ describe "Range.new" do
end
it "raises an ArgumentError when the given start and end can't be compared by using #<=>" do
- lambda { Range.new(1, mock('x')) }.should raise_error(ArgumentError)
- lambda { Range.new(mock('x'), mock('y')) }.should raise_error(ArgumentError)
+ -> { Range.new(1, mock('x')) }.should raise_error(ArgumentError)
+ -> { Range.new(mock('x'), mock('y')) }.should raise_error(ArgumentError)
b = mock('x')
(a = mock('nil')).should_receive(:<=>).with(b).and_return(nil)
- lambda { Range.new(a, b) }.should raise_error(ArgumentError)
+ -> { Range.new(a, b) }.should raise_error(ArgumentError)
end
ruby_version_is "2.5" do
diff --git a/spec/ruby/core/range/shared/cover_and_include.rb b/spec/ruby/core/range/shared/cover_and_include.rb
index bed2c77038..a19e2c6ead 100644
--- a/spec/ruby/core/range/shared/cover_and_include.rb
+++ b/spec/ruby/core/range/shared/cover_and_include.rb
@@ -29,8 +29,8 @@ describe :range_cover_and_include, shared: true do
end
it "raises an ArgumentError without exactly one argument" do
- lambda{ (1..2).send(@method) }.should raise_error(ArgumentError)
- lambda{ (1..2).send(@method, 1, 2) }.should raise_error(ArgumentError)
+ ->{ (1..2).send(@method) }.should raise_error(ArgumentError)
+ ->{ (1..2).send(@method, 1, 2) }.should raise_error(ArgumentError)
end
it "returns true if argument is equal to the first value of the range" do
diff --git a/spec/ruby/core/range/step_spec.rb b/spec/ruby/core/range/step_spec.rb
index eb136a8902..d564e4a5cd 100644
--- a/spec/ruby/core/range/step_spec.rb
+++ b/spec/ruby/core/range/step_spec.rb
@@ -12,7 +12,7 @@ describe "Range#step" do
it "raises TypeError if step" do
obj = mock("mock")
- lambda { (1..10).step(obj) { } }.should raise_error(TypeError)
+ -> { (1..10).step(obj) { } }.should raise_error(TypeError)
end
it "calls #to_int to coerce step to an Integer" do
@@ -26,14 +26,14 @@ describe "Range#step" do
it "raises a TypeError if step does not respond to #to_int" do
obj = mock("Range#step non-integer")
- lambda { (1..2).step(obj) { } }.should raise_error(TypeError)
+ -> { (1..2).step(obj) { } }.should raise_error(TypeError)
end
it "raises a TypeError if #to_int does not return an Integer" do
obj = mock("Range#step non-integer")
obj.should_receive(:to_int).and_return("1")
- lambda { (1..2).step(obj) { } }.should raise_error(TypeError)
+ -> { (1..2).step(obj) { } }.should raise_error(TypeError)
end
it "coerces the argument to integer by invoking to_int" do
@@ -47,19 +47,19 @@ describe "Range#step" do
obj = mock("Range#step non-comparable")
obj.should_receive(:<=>).with(obj).and_return(1)
- lambda { (obj..obj).step { |x| x } }.should raise_error(TypeError)
+ -> { (obj..obj).step { |x| x } }.should raise_error(TypeError)
end
it "raises an ArgumentError if step is 0" do
- lambda { (-1..1).step(0) { |x| x } }.should raise_error(ArgumentError)
+ -> { (-1..1).step(0) { |x| x } }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if step is 0.0" do
- lambda { (-1..1).step(0.0) { |x| x } }.should raise_error(ArgumentError)
+ -> { (-1..1).step(0.0) { |x| x } }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if step is negative" do
- lambda { (-1..1).step(-2) { |x| x } }.should raise_error(ArgumentError)
+ -> { (-1..1).step(-2) { |x| x } }.should raise_error(ArgumentError)
end
describe "with inclusive end" do
@@ -159,7 +159,7 @@ describe "Range#step" do
end
it "raises a TypeError when passed a Float step" do
- lambda { ("A".."G").step(2.0) { } }.should raise_error(TypeError)
+ -> { ("A".."G").step(2.0) { } }.should raise_error(TypeError)
end
it "calls #succ on begin and each element returned by #succ" do
@@ -269,7 +269,7 @@ describe "Range#step" do
end
it "raises a TypeError when passed a Float step" do
- lambda { ("A"..."G").step(2.0) { } }.should raise_error(TypeError)
+ -> { ("A"..."G").step(2.0) { } }.should raise_error(TypeError)
end
end
end
@@ -280,7 +280,7 @@ describe "Range#step" do
it "raises a TypeError if step does not respond to #to_int" do
obj = mock("Range#step non-integer")
enum = (1..2).step(obj)
- lambda { enum.size }.should raise_error(TypeError)
+ -> { enum.size }.should raise_error(TypeError)
end
it "raises a TypeError if #to_int does not return an Integer" do
@@ -288,23 +288,23 @@ describe "Range#step" do
obj.should_receive(:to_int).and_return("1")
enum = (1..2).step(obj)
- lambda { enum.size }.should raise_error(TypeError)
+ -> { enum.size }.should raise_error(TypeError)
end
ruby_version_is ""..."2.6" do
it "raises an ArgumentError if step is 0" do
enum = (-1..1).step(0)
- lambda { enum.size }.should raise_error(ArgumentError)
+ -> { enum.size }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if step is 0.0" do
enum = (-1..1).step(0.0)
- lambda { enum.size }.should raise_error(ArgumentError)
+ -> { enum.size }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if step is negative" do
enum = (-1..1).step(-2)
- lambda { enum.size }.should raise_error(ArgumentError)
+ -> { enum.size }.should raise_error(ArgumentError)
end
end
@@ -366,7 +366,7 @@ describe "Range#step" do
obj = mock("Range#step non-comparable")
obj.should_receive(:<=>).with(obj).and_return(1)
enum = (obj..obj).step
- lambda { enum.size }.should_not raise_error
+ -> { enum.size }.should_not raise_error
enum.size.should == nil
end
end
diff --git a/spec/ruby/core/range/to_a_spec.rb b/spec/ruby/core/range/to_a_spec.rb
index ad2fbf5223..15f0b44a9c 100644
--- a/spec/ruby/core/range/to_a_spec.rb
+++ b/spec/ruby/core/range/to_a_spec.rb
@@ -6,7 +6,7 @@ describe "Range#to_a" do
('A'..'D').to_a.should == ['A','B','C','D']
('A'...'D').to_a.should == ['A','B','C']
(0xfffd...0xffff).to_a.should == [0xfffd,0xfffe]
- lambda { (0.5..2.4).to_a }.should raise_error(TypeError)
+ -> { (0.5..2.4).to_a }.should raise_error(TypeError)
end
it "returns empty array for descending-ordered" do
diff --git a/spec/ruby/core/rational/rationalize_spec.rb b/spec/ruby/core/rational/rationalize_spec.rb
index 61c7411104..3db027d446 100644
--- a/spec/ruby/core/rational/rationalize_spec.rb
+++ b/spec/ruby/core/rational/rationalize_spec.rb
@@ -30,7 +30,7 @@ describe "Rational#rationalize" do
end
it "raises ArgumentError when passed more than one argument" do
- lambda { Rational(1,1).rationalize(0.1, 0.1) }.should raise_error(ArgumentError)
- lambda { Rational(1,1).rationalize(0.1, 0.1, 2) }.should raise_error(ArgumentError)
+ -> { Rational(1,1).rationalize(0.1, 0.1) }.should raise_error(ArgumentError)
+ -> { Rational(1,1).rationalize(0.1, 0.1, 2) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/rational/to_r_spec.rb b/spec/ruby/core/rational/to_r_spec.rb
index bd1c7c9307..cc704c965e 100644
--- a/spec/ruby/core/rational/to_r_spec.rb
+++ b/spec/ruby/core/rational/to_r_spec.rb
@@ -5,7 +5,7 @@ describe "Rational#to_r" do
it "raises TypeError trying to convert BasicObject" do
obj = BasicObject.new
- lambda { Rational(obj) }.should raise_error(TypeError)
+ -> { Rational(obj) }.should raise_error(TypeError)
end
it "works when a BasicObject has to_r" do
@@ -15,6 +15,6 @@ describe "Rational#to_r" do
it "fails when a BasicObject's to_r does not return a Rational" do
obj = BasicObject.new; def obj.to_r; 1 end
- lambda { Rational(obj) }.should raise_error(TypeError)
+ -> { Rational(obj) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/regexp/initialize_spec.rb b/spec/ruby/core/regexp/initialize_spec.rb
index 026348b1dd..36fd5c7bf2 100644
--- a/spec/ruby/core/regexp/initialize_spec.rb
+++ b/spec/ruby/core/regexp/initialize_spec.rb
@@ -6,10 +6,10 @@ describe "Regexp#initialize" do
end
it "raises a SecurityError on a Regexp literal" do
- lambda { //.send(:initialize, "") }.should raise_error(SecurityError)
+ -> { //.send(:initialize, "") }.should raise_error(SecurityError)
end
it "raises a TypeError on an initialized non-literal Regexp" do
- lambda { Regexp.new("").send(:initialize, "") }.should raise_error(TypeError)
+ -> { Regexp.new("").send(:initialize, "") }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/regexp/match_spec.rb b/spec/ruby/core/regexp/match_spec.rb
index ebbba38211..a68448b39c 100644
--- a/spec/ruby/core/regexp/match_spec.rb
+++ b/spec/ruby/core/regexp/match_spec.rb
@@ -35,7 +35,7 @@ describe "Regexp#match" do
end
it "raises a TypeError on an uninitialized Regexp" do
- lambda { Regexp.allocate.match('foo') }.should raise_error(TypeError)
+ -> { Regexp.allocate.match('foo') }.should raise_error(TypeError)
end
describe "with [string, position]" do
@@ -50,7 +50,7 @@ describe "Regexp#match" do
it "raises an ArgumentError for an invalid encoding" do
x96 = ([150].pack('C')).force_encoding('utf-8')
- lambda { /(.).(.)/.match("Hello, #{x96} world!", 1) }.should raise_error(ArgumentError)
+ -> { /(.).(.)/.match("Hello, #{x96} world!", 1) }.should raise_error(ArgumentError)
end
end
@@ -65,7 +65,7 @@ describe "Regexp#match" do
it "raises an ArgumentError for an invalid encoding" do
x96 = ([150].pack('C')).force_encoding('utf-8')
- lambda { /(.).(.)/.match("Hello, #{x96} world!", -1) }.should raise_error(ArgumentError)
+ -> { /(.).(.)/.match("Hello, #{x96} world!", -1) }.should raise_error(ArgumentError)
end
end
@@ -98,12 +98,12 @@ describe "Regexp#match" do
it "raises TypeError when the given argument cannot be coerced to String" do
f = 1
- lambda { /foo/.match(f)[0] }.should raise_error(TypeError)
+ -> { /foo/.match(f)[0] }.should raise_error(TypeError)
end
it "raises TypeError when the given argument is an Exception" do
f = Exception.new("foo")
- lambda { /foo/.match(f)[0] }.should raise_error(TypeError)
+ -> { /foo/.match(f)[0] }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/regexp/new_spec.rb b/spec/ruby/core/regexp/new_spec.rb
index 8259b61714..d2d867b3d3 100644
--- a/spec/ruby/core/regexp/new_spec.rb
+++ b/spec/ruby/core/regexp/new_spec.rb
@@ -16,12 +16,12 @@ end
describe "Regexp.new given a Fixnum" do
it "raises a TypeError" do
- lambda { Regexp.new(1) }.should raise_error(TypeError)
+ -> { Regexp.new(1) }.should raise_error(TypeError)
end
end
describe "Regexp.new given a Float" do
it "raises a TypeError" do
- lambda { Regexp.new(1.0) }.should raise_error(TypeError)
+ -> { Regexp.new(1.0) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/regexp/options_spec.rb b/spec/ruby/core/regexp/options_spec.rb
index 5fbde89988..fb4853a014 100644
--- a/spec/ruby/core/regexp/options_spec.rb
+++ b/spec/ruby/core/regexp/options_spec.rb
@@ -29,7 +29,7 @@ describe "Regexp#options" do
end
it "raises a TypeError on an uninitialized Regexp" do
- lambda { Regexp.allocate.options }.should raise_error(TypeError)
+ -> { Regexp.allocate.options }.should raise_error(TypeError)
end
it "includes Regexp::FIXEDENCODING for a Regexp literal with the 'u' option" do
diff --git a/spec/ruby/core/regexp/shared/new.rb b/spec/ruby/core/regexp/shared/new.rb
index ab833ec236..bb5df7bc2e 100644
--- a/spec/ruby/core/regexp/shared/new.rb
+++ b/spec/ruby/core/regexp/shared/new.rb
@@ -30,7 +30,7 @@ describe :regexp_new_string, shared: true do
end
it "raises a RegexpError when passed an incorrect regexp" do
- lambda { Regexp.send(@method, "^[$", 0) }.should raise_error(RegexpError)
+ -> { Regexp.send(@method, "^[$", 0) }.should raise_error(RegexpError)
end
it "does not set Regexp options if only given one argument" do
@@ -98,7 +98,7 @@ describe :regexp_new_string, shared: true do
end
it "ignores the third argument if it is 'e' or 'euc' (case-insensitive)" do
- lambda {
+ -> {
Regexp.send(@method, 'Hi', nil, 'e').encoding.should == Encoding::US_ASCII
Regexp.send(@method, 'Hi', nil, 'euc').encoding.should == Encoding::US_ASCII
Regexp.send(@method, 'Hi', nil, 'E').encoding.should == Encoding::US_ASCII
@@ -107,7 +107,7 @@ describe :regexp_new_string, shared: true do
end
it "ignores the third argument if it is 's' or 'sjis' (case-insensitive)" do
- lambda {
+ -> {
Regexp.send(@method, 'Hi', nil, 's').encoding.should == Encoding::US_ASCII
Regexp.send(@method, 'Hi', nil, 'sjis').encoding.should == Encoding::US_ASCII
Regexp.send(@method, 'Hi', nil, 'S').encoding.should == Encoding::US_ASCII
@@ -116,7 +116,7 @@ describe :regexp_new_string, shared: true do
end
it "ignores the third argument if it is 'u' or 'utf8' (case-insensitive)" do
- lambda {
+ -> {
Regexp.send(@method, 'Hi', nil, 'u').encoding.should == Encoding::US_ASCII
Regexp.send(@method, 'Hi', nil, 'utf8').encoding.should == Encoding::US_ASCII
Regexp.send(@method, 'Hi', nil, 'U').encoding.should == Encoding::US_ASCII
@@ -143,11 +143,11 @@ describe :regexp_new_string, shared: true do
describe "with escaped characters" do
it "raises a Regexp error if there is a trailing backslash" do
- lambda { Regexp.send(@method, "\\") }.should raise_error(RegexpError)
+ -> { Regexp.send(@method, "\\") }.should raise_error(RegexpError)
end
it "does not raise a Regexp error if there is an escaped trailing backslash" do
- lambda { Regexp.send(@method, "\\\\") }.should_not raise_error(RegexpError)
+ -> { Regexp.send(@method, "\\\\") }.should_not raise_error(RegexpError)
end
it "accepts a backspace followed by a character" do
@@ -175,7 +175,7 @@ describe :regexp_new_string, shared: true do
end
it "raises a RegexpError if \\x is not followed by any hexadecimal digits" do
- lambda { Regexp.send(@method, "\\" + "xn") }.should raise_error(RegexpError)
+ -> { Regexp.send(@method, "\\" + "xn") }.should raise_error(RegexpError)
end
it "accepts an escaped string interpolation" do
@@ -331,15 +331,15 @@ describe :regexp_new_string, shared: true do
end
it "raises a RegexpError if less than four digits are given for \\uHHHH" do
- lambda { Regexp.send(@method, "\\" + "u304") }.should raise_error(RegexpError)
+ -> { Regexp.send(@method, "\\" + "u304") }.should raise_error(RegexpError)
end
it "raises a RegexpError if the \\u{} escape is empty" do
- lambda { Regexp.send(@method, "\\" + "u{}") }.should raise_error(RegexpError)
+ -> { Regexp.send(@method, "\\" + "u{}") }.should raise_error(RegexpError)
end
it "raises a RegexpError if more than six hexadecimal digits are given" do
- lambda { Regexp.send(@method, "\\" + "u{0ffffff}") }.should raise_error(RegexpError)
+ -> { Regexp.send(@method, "\\" + "u{0ffffff}") }.should raise_error(RegexpError)
end
it "returns a Regexp with US-ASCII encoding if only 7-bit ASCII characters are present regardless of the input String's encoding" do
@@ -475,7 +475,7 @@ describe :regexp_new_regexp, shared: true do
it "does not honour options given as additional arguments" do
r = nil
- lambda {
+ -> {
r = Regexp.send @method, /hi/, Regexp::IGNORECASE
}.should complain(/flags ignored/)
(r.options & Regexp::IGNORECASE).should == 0
diff --git a/spec/ruby/core/regexp/union_spec.rb b/spec/ruby/core/regexp/union_spec.rb
index 25901c6f2b..81a31d89b3 100644
--- a/spec/ruby/core/regexp/union_spec.rb
+++ b/spec/ruby/core/regexp/union_spec.rb
@@ -52,83 +52,83 @@ describe "Regexp.union" do
end
it "raises ArgumentError if the arguments include conflicting ASCII-incompatible Strings" do
- lambda {
+ -> {
Regexp.union("a".encode("UTF-16LE"), "b".encode("UTF-16BE"))
}.should raise_error(ArgumentError)
end
it "raises ArgumentError if the arguments include conflicting ASCII-incompatible Regexps" do
- lambda {
+ -> {
Regexp.union(Regexp.new("a".encode("UTF-16LE")),
Regexp.new("b".encode("UTF-16BE")))
}.should raise_error(ArgumentError)
end
it "raises ArgumentError if the arguments include conflicting fixed encoding Regexps" do
- lambda {
+ -> {
Regexp.union(Regexp.new("a".encode("UTF-8"), Regexp::FIXEDENCODING),
Regexp.new("b".encode("US-ASCII"), Regexp::FIXEDENCODING))
}.should raise_error(ArgumentError)
end
it "raises ArgumentError if the arguments include a fixed encoding Regexp and a String containing non-ASCII-compatible characters in a different encoding" do
- lambda {
+ -> {
Regexp.union(Regexp.new("a".encode("UTF-8"), Regexp::FIXEDENCODING),
"\u00A9".encode("ISO-8859-1"))
}.should raise_error(ArgumentError)
end
it "raises ArgumentError if the arguments include a String containing non-ASCII-compatible characters and a fixed encoding Regexp in a different encoding" do
- lambda {
+ -> {
Regexp.union("\u00A9".encode("ISO-8859-1"),
Regexp.new("a".encode("UTF-8"), Regexp::FIXEDENCODING))
}.should raise_error(ArgumentError)
end
it "raises ArgumentError if the arguments include an ASCII-incompatible String and an ASCII-only String" do
- lambda {
+ -> {
Regexp.union("a".encode("UTF-16LE"), "b".encode("UTF-8"))
}.should raise_error(ArgumentError)
end
it "raises ArgumentError if the arguments include an ASCII-incompatible Regexp and an ASCII-only String" do
- lambda {
+ -> {
Regexp.union(Regexp.new("a".encode("UTF-16LE")), "b".encode("UTF-8"))
}.should raise_error(ArgumentError)
end
it "raises ArgumentError if the arguments include an ASCII-incompatible String and an ASCII-only Regexp" do
- lambda {
+ -> {
Regexp.union("a".encode("UTF-16LE"), Regexp.new("b".encode("UTF-8")))
}.should raise_error(ArgumentError)
end
it "raises ArgumentError if the arguments include an ASCII-incompatible Regexp and an ASCII-only Regexp" do
- lambda {
+ -> {
Regexp.union(Regexp.new("a".encode("UTF-16LE")), Regexp.new("b".encode("UTF-8")))
}.should raise_error(ArgumentError)
end
it "raises ArgumentError if the arguments include an ASCII-incompatible String and a String containing non-ASCII-compatible characters in a different encoding" do
- lambda {
+ -> {
Regexp.union("a".encode("UTF-16LE"), "\u00A9".encode("ISO-8859-1"))
}.should raise_error(ArgumentError)
end
it "raises ArgumentError if the arguments include an ASCII-incompatible Regexp and a String containing non-ASCII-compatible characters in a different encoding" do
- lambda {
+ -> {
Regexp.union(Regexp.new("a".encode("UTF-16LE")), "\u00A9".encode("ISO-8859-1"))
}.should raise_error(ArgumentError)
end
it "raises ArgumentError if the arguments include an ASCII-incompatible String and a Regexp containing non-ASCII-compatible characters in a different encoding" do
- lambda {
+ -> {
Regexp.union("a".encode("UTF-16LE"), Regexp.new("\u00A9".encode("ISO-8859-1")))
}.should raise_error(ArgumentError)
end
it "raises ArgumentError if the arguments include an ASCII-incompatible Regexp and a Regexp containing non-ASCII-compatible characters in a different encoding" do
- lambda {
+ -> {
Regexp.union(Regexp.new("a".encode("UTF-16LE")), Regexp.new("\u00A9".encode("ISO-8859-1")))
}.should raise_error(ArgumentError)
end
@@ -144,6 +144,6 @@ describe "Regexp.union" do
not_supported_on :opal do
Regexp.union([/dogs/, /cats/i]).should == /(?-mix:dogs)|(?i-mx:cats)/
end
- lambda{Regexp.union(["skiing", "sledding"], [/dogs/, /cats/i])}.should raise_error(TypeError)
+ ->{Regexp.union(["skiing", "sledding"], [/dogs/, /cats/i])}.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/signal/signame_spec.rb b/spec/ruby/core/signal/signame_spec.rb
index 41b43d3482..b66de9fc85 100644
--- a/spec/ruby/core/signal/signame_spec.rb
+++ b/spec/ruby/core/signal/signame_spec.rb
@@ -10,7 +10,7 @@ describe "Signal.signame" do
end
it "raises a TypeError when the passed argument can't be coerced to Integer" do
- lambda { Signal.signame("hello") }.should raise_error(TypeError)
+ -> { Signal.signame("hello") }.should raise_error(TypeError)
end
platform_is_not :windows do
diff --git a/spec/ruby/core/sizedqueue/append_spec.rb b/spec/ruby/core/sizedqueue/append_spec.rb
index ff96b46d2c..ca79068930 100644
--- a/spec/ruby/core/sizedqueue/append_spec.rb
+++ b/spec/ruby/core/sizedqueue/append_spec.rb
@@ -7,5 +7,5 @@ describe "SizedQueue#<<" do
end
describe "SizedQueue#<<" do
- it_behaves_like :sizedqueue_enq, :<<, ->(n) { SizedQueue.new(n) }
+ it_behaves_like :sizedqueue_enq, :<<, -> n { SizedQueue.new(n) }
end
diff --git a/spec/ruby/core/sizedqueue/enq_spec.rb b/spec/ruby/core/sizedqueue/enq_spec.rb
index 11c65ec14d..3821afac95 100644
--- a/spec/ruby/core/sizedqueue/enq_spec.rb
+++ b/spec/ruby/core/sizedqueue/enq_spec.rb
@@ -7,5 +7,5 @@ describe "SizedQueue#enq" do
end
describe "SizedQueue#enq" do
- it_behaves_like :sizedqueue_enq, :enq, ->(n) { SizedQueue.new(n) }
+ it_behaves_like :sizedqueue_enq, :enq, -> n { SizedQueue.new(n) }
end
diff --git a/spec/ruby/core/sizedqueue/max_spec.rb b/spec/ruby/core/sizedqueue/max_spec.rb
index b65a67eeb0..cbabb5dc10 100644
--- a/spec/ruby/core/sizedqueue/max_spec.rb
+++ b/spec/ruby/core/sizedqueue/max_spec.rb
@@ -2,9 +2,9 @@ require_relative '../../spec_helper'
require_relative '../../shared/sizedqueue/max'
describe "SizedQueue#max" do
- it_behaves_like :sizedqueue_max, :max, ->(n) { SizedQueue.new(n) }
+ it_behaves_like :sizedqueue_max, :max, -> n { SizedQueue.new(n) }
end
describe "SizedQueue#max=" do
- it_behaves_like :sizedqueue_max=, :max=, ->(n) { SizedQueue.new(n) }
+ it_behaves_like :sizedqueue_max=, :max=, -> n { SizedQueue.new(n) }
end
diff --git a/spec/ruby/core/sizedqueue/new_spec.rb b/spec/ruby/core/sizedqueue/new_spec.rb
index 8febbfa63b..d5704732c3 100644
--- a/spec/ruby/core/sizedqueue/new_spec.rb
+++ b/spec/ruby/core/sizedqueue/new_spec.rb
@@ -2,5 +2,5 @@ require_relative '../../spec_helper'
require_relative '../../shared/sizedqueue/new'
describe "SizedQueue.new" do
- it_behaves_like :sizedqueue_new, :new, ->(*n) { SizedQueue.new(*n) }
+ it_behaves_like :sizedqueue_new, :new, -> *n { SizedQueue.new(*n) }
end
diff --git a/spec/ruby/core/sizedqueue/num_waiting_spec.rb b/spec/ruby/core/sizedqueue/num_waiting_spec.rb
index cbbbb2d062..9aef25e33d 100644
--- a/spec/ruby/core/sizedqueue/num_waiting_spec.rb
+++ b/spec/ruby/core/sizedqueue/num_waiting_spec.rb
@@ -2,5 +2,5 @@ require_relative '../../spec_helper'
require_relative '../../shared/sizedqueue/num_waiting'
describe "SizedQueue#num_waiting" do
- it_behaves_like :sizedqueue_num_waiting, :new, ->(n) { SizedQueue.new(n) }
+ it_behaves_like :sizedqueue_num_waiting, :new, -> n { SizedQueue.new(n) }
end
diff --git a/spec/ruby/core/sizedqueue/push_spec.rb b/spec/ruby/core/sizedqueue/push_spec.rb
index 5f92c5a2b7..bba9be9e3f 100644
--- a/spec/ruby/core/sizedqueue/push_spec.rb
+++ b/spec/ruby/core/sizedqueue/push_spec.rb
@@ -7,5 +7,5 @@ describe "SizedQueue#push" do
end
describe "SizedQueue#push" do
- it_behaves_like :sizedqueue_enq, :push, ->(n) { SizedQueue.new(n) }
+ it_behaves_like :sizedqueue_enq, :push, -> n { SizedQueue.new(n) }
end
diff --git a/spec/ruby/core/string/capitalize_spec.rb b/spec/ruby/core/string/capitalize_spec.rb
index c7f4aed20c..df64cdaa3b 100644
--- a/spec/ruby/core/string/capitalize_spec.rb
+++ b/spec/ruby/core/string/capitalize_spec.rb
@@ -52,7 +52,7 @@ describe "String#capitalize" do
end
it "does not allow any other additional option" do
- lambda { "iSa".capitalize(:turkic, :ascii) }.should raise_error(ArgumentError)
+ -> { "iSa".capitalize(:turkic, :ascii) }.should raise_error(ArgumentError)
end
end
@@ -66,16 +66,16 @@ describe "String#capitalize" do
end
it "does not allow any other additional option" do
- lambda { "iß".capitalize(:lithuanian, :ascii) }.should raise_error(ArgumentError)
+ -> { "iß".capitalize(:lithuanian, :ascii) }.should raise_error(ArgumentError)
end
end
it "does not allow the :fold option for upcasing" do
- lambda { "abc".capitalize(:fold) }.should raise_error(ArgumentError)
+ -> { "abc".capitalize(:fold) }.should raise_error(ArgumentError)
end
it "does not allow invalid options" do
- lambda { "abc".capitalize(:invalid_option) }.should raise_error(ArgumentError)
+ -> { "abc".capitalize(:invalid_option) }.should raise_error(ArgumentError)
end
it "returns subclass instances when called on a subclass" do
@@ -137,7 +137,7 @@ describe "String#capitalize!" do
end
it "does not allow any other additional option" do
- lambda { a = "iSa"; a.capitalize!(:turkic, :ascii) }.should raise_error(ArgumentError)
+ -> { a = "iSa"; a.capitalize!(:turkic, :ascii) }.should raise_error(ArgumentError)
end
end
@@ -155,16 +155,16 @@ describe "String#capitalize!" do
end
it "does not allow any other additional option" do
- lambda { a = "iß"; a.capitalize!(:lithuanian, :ascii) }.should raise_error(ArgumentError)
+ -> { a = "iß"; a.capitalize!(:lithuanian, :ascii) }.should raise_error(ArgumentError)
end
end
it "does not allow the :fold option for upcasing" do
- lambda { a = "abc"; a.capitalize!(:fold) }.should raise_error(ArgumentError)
+ -> { a = "abc"; a.capitalize!(:fold) }.should raise_error(ArgumentError)
end
it "does not allow invalid options" do
- lambda { a = "abc"; a.capitalize!(:invalid_option) }.should raise_error(ArgumentError)
+ -> { a = "abc"; a.capitalize!(:invalid_option) }.should raise_error(ArgumentError)
end
it "returns nil when no changes are made" do
@@ -179,7 +179,7 @@ describe "String#capitalize!" do
it "raises a #{frozen_error_class} when self is frozen" do
["", "Hello", "hello"].each do |a|
a.freeze
- lambda { a.capitalize! }.should raise_error(frozen_error_class)
+ -> { a.capitalize! }.should raise_error(frozen_error_class)
end
end
end
diff --git a/spec/ruby/core/string/casecmp_spec.rb b/spec/ruby/core/string/casecmp_spec.rb
index 35afcc0152..01b22e8f13 100644
--- a/spec/ruby/core/string/casecmp_spec.rb
+++ b/spec/ruby/core/string/casecmp_spec.rb
@@ -27,7 +27,7 @@ describe "String#casecmp independent of case" do
ruby_version_is ""..."2.5" do
it "raises a TypeError if other can't be converted to a string" do
- lambda { "abc".casecmp(mock('abc')) }.should raise_error(TypeError)
+ -> { "abc".casecmp(mock('abc')) }.should raise_error(TypeError)
end
end
@@ -198,7 +198,7 @@ describe 'String#casecmp? independent of case' do
ruby_version_is "2.4"..."2.5" do
it "raises a TypeError if other can't be converted to a string" do
- lambda { "abc".casecmp?(mock('abc')) }.should raise_error(TypeError)
+ -> { "abc".casecmp?(mock('abc')) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/string/center_spec.rb b/spec/ruby/core/string/center_spec.rb
index 3a9e689eac..27f8b7387f 100644
--- a/spec/ruby/core/string/center_spec.rb
+++ b/spec/ruby/core/string/center_spec.rb
@@ -65,10 +65,10 @@ describe "String#center with length, padding" do
end
it "raises a TypeError when length can't be converted to an integer" do
- lambda { "hello".center("x") }.should raise_error(TypeError)
- lambda { "hello".center("x", "y") }.should raise_error(TypeError)
- lambda { "hello".center([]) }.should raise_error(TypeError)
- lambda { "hello".center(mock('x')) }.should raise_error(TypeError)
+ -> { "hello".center("x") }.should raise_error(TypeError)
+ -> { "hello".center("x", "y") }.should raise_error(TypeError)
+ -> { "hello".center([]) }.should raise_error(TypeError)
+ -> { "hello".center(mock('x')) }.should raise_error(TypeError)
end
it "calls #to_str to convert padstr to a String" do
@@ -79,14 +79,14 @@ describe "String#center with length, padding" do
end
it "raises a TypeError when padstr can't be converted to a string" do
- lambda { "hello".center(20, 100) }.should raise_error(TypeError)
- lambda { "hello".center(20, []) }.should raise_error(TypeError)
- lambda { "hello".center(20, mock('x')) }.should raise_error(TypeError)
+ -> { "hello".center(20, 100) }.should raise_error(TypeError)
+ -> { "hello".center(20, []) }.should raise_error(TypeError)
+ -> { "hello".center(20, mock('x')) }.should raise_error(TypeError)
end
it "raises an ArgumentError if padstr is empty" do
- lambda { "hello".center(10, "") }.should raise_error(ArgumentError)
- lambda { "hello".center(0, "") }.should raise_error(ArgumentError)
+ -> { "hello".center(10, "") }.should raise_error(ArgumentError)
+ -> { "hello".center(0, "") }.should raise_error(ArgumentError)
end
it "returns subclass instances when called on subclasses" do
@@ -123,7 +123,7 @@ describe "String#center with length, padding" do
it "raises an Encoding::CompatibilityError if the encodings are incompatible" do
pat = "ア".encode Encoding::EUC_JP
- lambda do
+ -> do
"あれ".center 5, pat
end.should raise_error(Encoding::CompatibilityError)
end
diff --git a/spec/ruby/core/string/chomp_spec.rb b/spec/ruby/core/string/chomp_spec.rb
index 7400d71336..9db47d1dc6 100644
--- a/spec/ruby/core/string/chomp_spec.rb
+++ b/spec/ruby/core/string/chomp_spec.rb
@@ -134,7 +134,7 @@ describe "String#chomp" do
it "raises a TypeError if #to_str does not return a String" do
arg = mock("string chomp")
arg.should_receive(:to_str).and_return(1)
- lambda { "abc".chomp(arg) }.should raise_error(TypeError)
+ -> { "abc".chomp(arg) }.should raise_error(TypeError)
end
end
@@ -288,7 +288,7 @@ describe "String#chomp!" do
it "raises a TypeError if #to_str does not return a String" do
arg = mock("string chomp")
arg.should_receive(:to_str).and_return(1)
- lambda { "abc".chomp!(arg) }.should raise_error(TypeError)
+ -> { "abc".chomp!(arg) }.should raise_error(TypeError)
end
end
@@ -318,15 +318,15 @@ describe "String#chomp!" do
a = "string\n\r"
a.freeze
- lambda { a.chomp! }.should raise_error(frozen_error_class)
+ -> { a.chomp! }.should raise_error(frozen_error_class)
end
# see [ruby-core:23666]
it "raises a #{frozen_error_class} on a frozen instance when it would not be modified" do
a = "string\n\r"
a.freeze
- lambda { a.chomp!(nil) }.should raise_error(frozen_error_class)
- lambda { a.chomp!("x") }.should raise_error(frozen_error_class)
+ -> { a.chomp!(nil) }.should raise_error(frozen_error_class)
+ -> { a.chomp!("x") }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/string/chop_spec.rb b/spec/ruby/core/string/chop_spec.rb
index f33da3ecc4..35a5766b2f 100644
--- a/spec/ruby/core/string/chop_spec.rb
+++ b/spec/ruby/core/string/chop_spec.rb
@@ -112,13 +112,13 @@ describe "String#chop!" do
end
it "raises a #{frozen_error_class} on a frozen instance that is modified" do
- lambda { "string\n\r".freeze.chop! }.should raise_error(frozen_error_class)
+ -> { "string\n\r".freeze.chop! }.should raise_error(frozen_error_class)
end
# see [ruby-core:23666]
it "raises a #{frozen_error_class} on a frozen instance that would not be modified" do
a = ""
a.freeze
- lambda { a.chop! }.should raise_error(frozen_error_class)
+ -> { a.chop! }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/string/clear_spec.rb b/spec/ruby/core/string/clear_spec.rb
index 45d452e947..0b5b8e6998 100644
--- a/spec/ruby/core/string/clear_spec.rb
+++ b/spec/ruby/core/string/clear_spec.rb
@@ -31,7 +31,7 @@ describe "String#clear" do
it "raises a #{frozen_error_class} if self is frozen" do
@s.freeze
- lambda { @s.clear }.should raise_error(frozen_error_class)
- lambda { "".freeze.clear }.should raise_error(frozen_error_class)
+ -> { @s.clear }.should raise_error(frozen_error_class)
+ -> { "".freeze.clear }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/string/codepoints_spec.rb b/spec/ruby/core/string/codepoints_spec.rb
index e5eeb8b69d..0b6cde82f7 100644
--- a/spec/ruby/core/string/codepoints_spec.rb
+++ b/spec/ruby/core/string/codepoints_spec.rb
@@ -13,6 +13,6 @@ describe "String#codepoints" do
it "raises an ArgumentError when no block is given if self has an invalid encoding" do
s = "\xDF".force_encoding(Encoding::UTF_8)
s.valid_encoding?.should be_false
- lambda { s.codepoints }.should raise_error(ArgumentError)
+ -> { s.codepoints }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/string/count_spec.rb b/spec/ruby/core/string/count_spec.rb
index e82a7c77ca..06ba5a4f0e 100644
--- a/spec/ruby/core/string/count_spec.rb
+++ b/spec/ruby/core/string/count_spec.rb
@@ -23,7 +23,7 @@ describe "String#count" do
end
it "raises an ArgumentError when given no arguments" do
- lambda { "hell yeah".count }.should raise_error(ArgumentError)
+ -> { "hell yeah".count }.should raise_error(ArgumentError)
end
it "negates sets starting with ^" do
@@ -76,8 +76,8 @@ describe "String#count" do
it "raises if the given sequences are invalid" do
s = "hel-[()]-lo012^"
- lambda { s.count("h-e") }.should raise_error(ArgumentError)
- lambda { s.count("^h-e") }.should raise_error(ArgumentError)
+ -> { s.count("h-e") }.should raise_error(ArgumentError)
+ -> { s.count("^h-e") }.should raise_error(ArgumentError)
end
it 'returns the number of occurrences of a multi-byte character' do
@@ -98,8 +98,8 @@ describe "String#count" do
end
it "raises a TypeError when a set arg can't be converted to a string" do
- lambda { "hello world".count(100) }.should raise_error(TypeError)
- lambda { "hello world".count([]) }.should raise_error(TypeError)
- lambda { "hello world".count(mock('x')) }.should raise_error(TypeError)
+ -> { "hello world".count(100) }.should raise_error(TypeError)
+ -> { "hello world".count([]) }.should raise_error(TypeError)
+ -> { "hello world".count(mock('x')) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/string/crypt_spec.rb b/spec/ruby/core/string/crypt_spec.rb
index 66161b280f..7a0f8835f2 100644
--- a/spec/ruby/core/string/crypt_spec.rb
+++ b/spec/ruby/core/string/crypt_spec.rb
@@ -15,7 +15,7 @@ describe "String#crypt" do
end
it "raises Errno::EINVAL when the salt is shorter than 29 characters" do
- lambda { "mypassword".crypt("$2a$04$0WVaz0pV3jzfZ5G5tpmHW") }.should raise_error(Errno::EINVAL)
+ -> { "mypassword".crypt("$2a$04$0WVaz0pV3jzfZ5G5tpmHW") }.should raise_error(Errno::EINVAL)
end
it "calls #to_str to converts the salt arg to a String" do
@@ -73,7 +73,7 @@ describe "String#crypt" do
end
it "raises an ArgumentError when the string contains NUL character" do
- lambda { "poison\0null".crypt("aa") }.should raise_error(ArgumentError)
+ -> { "poison\0null".crypt("aa") }.should raise_error(ArgumentError)
end
it "calls #to_str to converts the salt arg to a String" do
@@ -103,16 +103,16 @@ describe "String#crypt" do
end
it "raises an ArgumentError when the salt is shorter than two characters" do
- lambda { "hello".crypt("") }.should raise_error(ArgumentError)
- lambda { "hello".crypt("f") }.should raise_error(ArgumentError)
- lambda { "hello".crypt("\x00\x00") }.should raise_error(ArgumentError)
- lambda { "hello".crypt("\x00a") }.should raise_error(ArgumentError)
- lambda { "hello".crypt("a\x00") }.should raise_error(ArgumentError)
+ -> { "hello".crypt("") }.should raise_error(ArgumentError)
+ -> { "hello".crypt("f") }.should raise_error(ArgumentError)
+ -> { "hello".crypt("\x00\x00") }.should raise_error(ArgumentError)
+ -> { "hello".crypt("\x00a") }.should raise_error(ArgumentError)
+ -> { "hello".crypt("a\x00") }.should raise_error(ArgumentError)
end
end
it "raises a type error when the salt arg can't be converted to a string" do
- lambda { "".crypt(5) }.should raise_error(TypeError)
- lambda { "".crypt(mock('x')) }.should raise_error(TypeError)
+ -> { "".crypt(5) }.should raise_error(TypeError)
+ -> { "".crypt(mock('x')) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/string/delete_prefix_spec.rb b/spec/ruby/core/string/delete_prefix_spec.rb
index 4b4858c9c2..b88c503658 100644
--- a/spec/ruby/core/string/delete_prefix_spec.rb
+++ b/spec/ruby/core/string/delete_prefix_spec.rb
@@ -73,9 +73,9 @@ ruby_version_is '2.5' do
end
it "raises a #{frozen_error_class} when self is frozen" do
- lambda { 'hello'.freeze.delete_prefix!('hell') }.should raise_error(frozen_error_class)
- lambda { 'hello'.freeze.delete_prefix!('') }.should raise_error(frozen_error_class)
- lambda { ''.freeze.delete_prefix!('') }.should raise_error(frozen_error_class)
+ -> { 'hello'.freeze.delete_prefix!('hell') }.should raise_error(frozen_error_class)
+ -> { 'hello'.freeze.delete_prefix!('') }.should raise_error(frozen_error_class)
+ -> { ''.freeze.delete_prefix!('') }.should raise_error(frozen_error_class)
end
end
end
diff --git a/spec/ruby/core/string/delete_spec.rb b/spec/ruby/core/string/delete_spec.rb
index 8725b54c3b..6136cd54af 100644
--- a/spec/ruby/core/string/delete_spec.rb
+++ b/spec/ruby/core/string/delete_spec.rb
@@ -14,7 +14,7 @@ describe "String#delete" do
end
it "raises an ArgumentError when given no arguments" do
- lambda { "hell yeah".delete }.should raise_error(ArgumentError)
+ -> { "hell yeah".delete }.should raise_error(ArgumentError)
end
it "negates sets starting with ^" do
@@ -62,10 +62,10 @@ describe "String#delete" do
not_supported_on :opal do
xFF = [0xFF].pack('C')
range = "\x00 - #{xFF}".force_encoding('utf-8')
- lambda { "hello".delete(range).should == "" }.should raise_error(ArgumentError)
+ -> { "hello".delete(range).should == "" }.should raise_error(ArgumentError)
end
- lambda { "hello".delete("h-e") }.should raise_error(ArgumentError)
- lambda { "hello".delete("^h-e") }.should raise_error(ArgumentError)
+ -> { "hello".delete("h-e") }.should raise_error(ArgumentError)
+ -> { "hello".delete("^h-e") }.should raise_error(ArgumentError)
end
it "taints result when self is tainted" do
@@ -86,9 +86,9 @@ describe "String#delete" do
end
it "raises a TypeError when one set arg can't be converted to a string" do
- lambda { "hello world".delete(100) }.should raise_error(TypeError)
- lambda { "hello world".delete([]) }.should raise_error(TypeError)
- lambda { "hello world".delete(mock('x')) }.should raise_error(TypeError)
+ -> { "hello world".delete(100) }.should raise_error(TypeError)
+ -> { "hello world".delete([]) }.should raise_error(TypeError)
+ -> { "hello world".delete(mock('x')) }.should raise_error(TypeError)
end
it "returns subclass instances when called on a subclass" do
@@ -113,7 +113,7 @@ describe "String#delete!" do
a = "hello"
a.freeze
- lambda { a.delete!("") }.should raise_error(frozen_error_class)
- lambda { a.delete!("aeiou", "^e") }.should raise_error(frozen_error_class)
+ -> { a.delete!("") }.should raise_error(frozen_error_class)
+ -> { a.delete!("aeiou", "^e") }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/string/delete_suffix_spec.rb b/spec/ruby/core/string/delete_suffix_spec.rb
index 8541c1d5d2..94909cf71d 100644
--- a/spec/ruby/core/string/delete_suffix_spec.rb
+++ b/spec/ruby/core/string/delete_suffix_spec.rb
@@ -73,9 +73,9 @@ ruby_version_is '2.5' do
end
it "raises a #{frozen_error_class} when self is frozen" do
- lambda { 'hello'.freeze.delete_suffix!('ello') }.should raise_error(frozen_error_class)
- lambda { 'hello'.freeze.delete_suffix!('') }.should raise_error(frozen_error_class)
- lambda { ''.freeze.delete_suffix!('') }.should raise_error(frozen_error_class)
+ -> { 'hello'.freeze.delete_suffix!('ello') }.should raise_error(frozen_error_class)
+ -> { 'hello'.freeze.delete_suffix!('') }.should raise_error(frozen_error_class)
+ -> { ''.freeze.delete_suffix!('') }.should raise_error(frozen_error_class)
end
end
end
diff --git a/spec/ruby/core/string/downcase_spec.rb b/spec/ruby/core/string/downcase_spec.rb
index 9d57ea8e25..31c8f3f446 100644
--- a/spec/ruby/core/string/downcase_spec.rb
+++ b/spec/ruby/core/string/downcase_spec.rb
@@ -39,7 +39,7 @@ describe "String#downcase" do
end
it "does not allow any other additional option" do
- lambda { "İ".downcase(:turkic, :ascii) }.should raise_error(ArgumentError)
+ -> { "İ".downcase(:turkic, :ascii) }.should raise_error(ArgumentError)
end
end
@@ -53,7 +53,7 @@ describe "String#downcase" do
end
it "does not allow any other additional option" do
- lambda { "İS".downcase(:lithuanian, :ascii) }.should raise_error(ArgumentError)
+ -> { "İS".downcase(:lithuanian, :ascii) }.should raise_error(ArgumentError)
end
end
@@ -65,7 +65,7 @@ describe "String#downcase" do
end
it "does not allow invalid options" do
- lambda { "ABC".downcase(:invalid_option) }.should raise_error(ArgumentError)
+ -> { "ABC".downcase(:invalid_option) }.should raise_error(ArgumentError)
end
it "taints result when self is tainted" do
@@ -126,7 +126,7 @@ describe "String#downcase!" do
end
it "does not allow any other additional option" do
- lambda { a = "İ"; a.downcase!(:turkic, :ascii) }.should raise_error(ArgumentError)
+ -> { a = "İ"; a.downcase!(:turkic, :ascii) }.should raise_error(ArgumentError)
end
end
@@ -144,7 +144,7 @@ describe "String#downcase!" do
end
it "does not allow any other additional option" do
- lambda { a = "İS"; a.downcase!(:lithuanian, :ascii) }.should raise_error(ArgumentError)
+ -> { a = "İS"; a.downcase!(:lithuanian, :ascii) }.should raise_error(ArgumentError)
end
end
@@ -160,7 +160,7 @@ describe "String#downcase!" do
end
it "does not allow invalid options" do
- lambda { a = "ABC"; a.downcase!(:invalid_option) }.should raise_error(ArgumentError)
+ -> { a = "ABC"; a.downcase!(:invalid_option) }.should raise_error(ArgumentError)
end
it "returns nil if no modifications were made" do
@@ -170,8 +170,8 @@ describe "String#downcase!" do
end
it "raises a #{frozen_error_class} when self is frozen" do
- lambda { "HeLlo".freeze.downcase! }.should raise_error(frozen_error_class)
- lambda { "hello".freeze.downcase! }.should raise_error(frozen_error_class)
+ -> { "HeLlo".freeze.downcase! }.should raise_error(frozen_error_class)
+ -> { "hello".freeze.downcase! }.should raise_error(frozen_error_class)
end
it "sets the result String encoding to the source String encoding" do
diff --git a/spec/ruby/core/string/dup_spec.rb b/spec/ruby/core/string/dup_spec.rb
index 3c6021b5c2..d650788210 100644
--- a/spec/ruby/core/string/dup_spec.rb
+++ b/spec/ruby/core/string/dup_spec.rb
@@ -21,7 +21,7 @@ describe "String#dup" do
it "does not copy singleton methods" do
def @obj.special() :the_one end
dup = @obj.dup
- lambda { dup.special }.should raise_error(NameError)
+ -> { dup.special }.should raise_error(NameError)
end
it "does not copy modules included in the singleton class" do
@@ -30,7 +30,7 @@ describe "String#dup" do
end
dup = @obj.dup
- lambda { dup.repr }.should raise_error(NameError)
+ -> { dup.repr }.should raise_error(NameError)
end
it "does not copy constants defined in the singleton class" do
@@ -39,7 +39,7 @@ describe "String#dup" do
end
dup = @obj.dup
- lambda { class << dup; CLONE; end }.should raise_error(NameError)
+ -> { class << dup; CLONE; end }.should raise_error(NameError)
end
it "does not modify the original string when changing dupped string" do
diff --git a/spec/ruby/core/string/element_set_spec.rb b/spec/ruby/core/string/element_set_spec.rb
index 1fdf72ab0f..34e122b055 100644
--- a/spec/ruby/core/string/element_set_spec.rb
+++ b/spec/ruby/core/string/element_set_spec.rb
@@ -27,13 +27,13 @@ describe "String#[]= with Fixnum index" do
it "raises an IndexError without changing self if idx is outside of self" do
str = "hello"
- lambda { str[20] = "bam" }.should raise_error(IndexError)
+ -> { str[20] = "bam" }.should raise_error(IndexError)
str.should == "hello"
- lambda { str[-20] = "bam" }.should raise_error(IndexError)
+ -> { str[-20] = "bam" }.should raise_error(IndexError)
str.should == "hello"
- lambda { ""[-1] = "bam" }.should raise_error(IndexError)
+ -> { ""[-1] = "bam" }.should raise_error(IndexError)
end
# Behaviour is verified by matz in
@@ -46,7 +46,7 @@ describe "String#[]= with Fixnum index" do
it "raises IndexError if the string index doesn't match a position in the string" do
str = "hello"
- lambda { str['y'] = "bam" }.should raise_error(IndexError)
+ -> { str['y'] = "bam" }.should raise_error(IndexError)
str.should == "hello"
end
@@ -54,7 +54,7 @@ describe "String#[]= with Fixnum index" do
a = "hello"
a.freeze
- lambda { a[0] = "bam" }.should raise_error(frozen_error_class)
+ -> { a[0] = "bam" }.should raise_error(frozen_error_class)
end
it "calls to_int on index" do
@@ -78,17 +78,17 @@ describe "String#[]= with Fixnum index" do
end
it "raises a TypeError if other_str can't be converted to a String" do
- lambda { "test"[1] = [] }.should raise_error(TypeError)
- lambda { "test"[1] = mock('x') }.should raise_error(TypeError)
- lambda { "test"[1] = nil }.should raise_error(TypeError)
+ -> { "test"[1] = [] }.should raise_error(TypeError)
+ -> { "test"[1] = mock('x') }.should raise_error(TypeError)
+ -> { "test"[1] = nil }.should raise_error(TypeError)
end
it "raises a TypeError if passed a Fixnum replacement" do
- lambda { "abc"[1] = 65 }.should raise_error(TypeError)
+ -> { "abc"[1] = 65 }.should raise_error(TypeError)
end
it "raises an IndexError if the index is greater than character size" do
- lambda { "あれ"[4] = "a" }.should raise_error(IndexError)
+ -> { "あれ"[4] = "a" }.should raise_error(IndexError)
end
it "calls #to_int to convert the index" do
@@ -104,14 +104,14 @@ describe "String#[]= with Fixnum index" do
index = mock("string element set")
index.should_receive(:to_int).and_return('1')
- lambda { "abc"[index] = "d" }.should raise_error(TypeError)
+ -> { "abc"[index] = "d" }.should raise_error(TypeError)
end
it "raises an IndexError if #to_int returns a value out of range" do
index = mock("string element set")
index.should_receive(:to_int).and_return(4)
- lambda { "ab"[index] = "c" }.should raise_error(IndexError)
+ -> { "ab"[index] = "c" }.should raise_error(IndexError)
end
it "replaces a character with a multibyte character" do
@@ -142,7 +142,7 @@ describe "String#[]= with Fixnum index" do
it "raises an Encoding::CompatibilityError if the replacement encoding is incompatible" do
str = "あれ"
rep = "が".encode Encoding::EUC_JP
- lambda { str[0] = rep }.should raise_error(Encoding::CompatibilityError)
+ -> { str[0] = rep }.should raise_error(Encoding::CompatibilityError)
end
end
@@ -167,7 +167,7 @@ describe "String#[]= with String index" do
it "raises an IndexError if the search String is not found" do
str = "abcde"
- lambda { str["g"] = "h" }.should raise_error(IndexError)
+ -> { str["g"] = "h" }.should raise_error(IndexError)
end
it "replaces characters with a multibyte character" do
@@ -198,7 +198,7 @@ describe "String#[]= with String index" do
it "raises an Encoding::CompatibilityError if the replacement encoding is incompatible" do
str = "あれ"
rep = "が".encode Encoding::EUC_JP
- lambda { str["れ"] = rep }.should raise_error(Encoding::CompatibilityError)
+ -> { str["れ"] = rep }.should raise_error(Encoding::CompatibilityError)
end
end
@@ -211,7 +211,7 @@ describe "String#[]= with a Regexp index" do
it "raises IndexError if the regexp index doesn't match a position in the string" do
str = "hello"
- lambda { str[/y/] = "bam" }.should raise_error(IndexError)
+ -> { str[/y/] = "bam" }.should raise_error(IndexError)
str.should == "hello"
end
@@ -228,7 +228,7 @@ describe "String#[]= with a Regexp index" do
rep = mock("string element set regexp")
rep.should_not_receive(:to_str)
- lambda { "abc"[/def/] = rep }.should raise_error(IndexError)
+ -> { "abc"[/def/] = rep }.should raise_error(IndexError)
end
describe "with 3 arguments" do
@@ -245,7 +245,7 @@ describe "String#[]= with a Regexp index" do
ref = mock("string element set regexp ref")
ref.should_receive(:to_int).and_return(nil)
- lambda { "abc"[/a(b)/, ref] = "x" }.should raise_error(TypeError)
+ -> { "abc"[/a(b)/, ref] = "x" }.should raise_error(TypeError)
end
it "uses the 2nd of 3 arguments as which capture should be replaced" do
@@ -264,20 +264,20 @@ describe "String#[]= with a Regexp index" do
rep = mock("string element set regexp")
rep.should_not_receive(:to_str)
- lambda { "abc"[/a(b)/, 2] = rep }.should raise_error(IndexError)
+ -> { "abc"[/a(b)/, 2] = rep }.should raise_error(IndexError)
end
it "raises IndexError if the specified capture isn't available" do
str = "aaa bbb ccc"
- lambda { str[/a (bbb) c/, 2] = "ddd" }.should raise_error(IndexError)
- lambda { str[/a (bbb) c/, -2] = "ddd" }.should raise_error(IndexError)
+ -> { str[/a (bbb) c/, 2] = "ddd" }.should raise_error(IndexError)
+ -> { str[/a (bbb) c/, -2] = "ddd" }.should raise_error(IndexError)
end
describe "when the optional capture does not match" do
it "raises an IndexError before setting the replacement" do
str1 = "a b c"
str2 = str1.dup
- lambda { str2[/a (b) (Z)?/, 2] = "d" }.should raise_error(IndexError)
+ -> { str2[/a (b) (Z)?/, 2] = "d" }.should raise_error(IndexError)
str2.should == str1
end
end
@@ -311,7 +311,7 @@ describe "String#[]= with a Regexp index" do
it "raises an Encoding::CompatibilityError if the replacement encoding is incompatible" do
str = "あれ"
rep = "が".encode Encoding::EUC_JP
- lambda { str[/れ/] = rep }.should raise_error(Encoding::CompatibilityError)
+ -> { str[/れ/] = rep }.should raise_error(Encoding::CompatibilityError)
end
end
@@ -361,11 +361,11 @@ describe "String#[]= with a Range index" do
end
it "raises a RangeError if negative Range begin is out of range" do
- lambda { "abc"[-4..-2] = "x" }.should raise_error(RangeError)
+ -> { "abc"[-4..-2] = "x" }.should raise_error(RangeError)
end
it "raises a RangeError if positive Range begin is greater than String size" do
- lambda { "abc"[4..2] = "x" }.should raise_error(RangeError)
+ -> { "abc"[4..2] = "x" }.should raise_error(RangeError)
end
it "uses the Range end as an index rather than a count" do
@@ -432,7 +432,7 @@ describe "String#[]= with a Range index" do
it "raises an Encoding::CompatibilityError if the replacement encoding is incompatible" do
str = "あれ"
rep = "が".encode Encoding::EUC_JP
- lambda { str[0..1] = rep }.should raise_error(Encoding::CompatibilityError)
+ -> { str[0..1] = rep }.should raise_error(Encoding::CompatibilityError)
end
end
@@ -511,14 +511,14 @@ describe "String#[]= with Fixnum index, count" do
index = mock("string element set index")
index.should_receive(:to_int).and_return("1")
- lambda { "abc"[index, 2] = "xyz" }.should raise_error(TypeError)
+ -> { "abc"[index, 2] = "xyz" }.should raise_error(TypeError)
end
it "raises a TypeError if #to_int for count does not return an Integer" do
count = mock("string element set count")
count.should_receive(:to_int).and_return("1")
- lambda { "abc"[1, count] = "xyz" }.should raise_error(TypeError)
+ -> { "abc"[1, count] = "xyz" }.should raise_error(TypeError)
end
it "calls #to_str to convert the replacement object" do
@@ -534,23 +534,23 @@ describe "String#[]= with Fixnum index, count" do
r = mock("string element set replacement")
r.should_receive(:to_str).and_return(nil)
- lambda { "abc"[1, 1] = r }.should raise_error(TypeError)
+ -> { "abc"[1, 1] = r }.should raise_error(TypeError)
end
it "raises an IndexError if |idx| is greater than the length of the string" do
- lambda { "hello"[6, 0] = "bob" }.should raise_error(IndexError)
- lambda { "hello"[-6, 0] = "bob" }.should raise_error(IndexError)
+ -> { "hello"[6, 0] = "bob" }.should raise_error(IndexError)
+ -> { "hello"[-6, 0] = "bob" }.should raise_error(IndexError)
end
it "raises an IndexError if count < 0" do
- lambda { "hello"[0, -1] = "bob" }.should raise_error(IndexError)
- lambda { "hello"[1, -1] = "bob" }.should raise_error(IndexError)
+ -> { "hello"[0, -1] = "bob" }.should raise_error(IndexError)
+ -> { "hello"[1, -1] = "bob" }.should raise_error(IndexError)
end
it "raises a TypeError if other_str is a type other than String" do
- lambda { "hello"[0, 2] = nil }.should raise_error(TypeError)
- lambda { "hello"[0, 2] = [] }.should raise_error(TypeError)
- lambda { "hello"[0, 2] = 33 }.should raise_error(TypeError)
+ -> { "hello"[0, 2] = nil }.should raise_error(TypeError)
+ -> { "hello"[0, 2] = [] }.should raise_error(TypeError)
+ -> { "hello"[0, 2] = 33 }.should raise_error(TypeError)
end
it "replaces characters with a multibyte character" do
@@ -584,7 +584,7 @@ describe "String#[]= with Fixnum index, count" do
end
it "raises an IndexError if the character index is out of range of a multibyte String" do
- lambda { "あれ"[3, 0] = "り" }.should raise_error(IndexError)
+ -> { "あれ"[3, 0] = "り" }.should raise_error(IndexError)
end
it "encodes the String in an encoding compatible with the replacement" do
@@ -597,6 +597,6 @@ describe "String#[]= with Fixnum index, count" do
it "raises an Encoding::CompatibilityError if the replacement encoding is incompatible" do
str = "あれ"
rep = "が".encode Encoding::EUC_JP
- lambda { str[0, 1] = rep }.should raise_error(Encoding::CompatibilityError)
+ -> { str[0, 1] = rep }.should raise_error(Encoding::CompatibilityError)
end
end
diff --git a/spec/ruby/core/string/encode_spec.rb b/spec/ruby/core/string/encode_spec.rb
index 67a25aff04..1c0c939358 100644
--- a/spec/ruby/core/string/encode_spec.rb
+++ b/spec/ruby/core/string/encode_spec.rb
@@ -113,12 +113,12 @@ describe "String#encode!" do
it_behaves_like :string_encode, :encode!
it "raises a #{frozen_error_class} when called on a frozen String" do
- lambda { "foo".freeze.encode!("euc-jp") }.should raise_error(frozen_error_class)
+ -> { "foo".freeze.encode!("euc-jp") }.should raise_error(frozen_error_class)
end
# http://redmine.ruby-lang.org/issues/show/1836
it "raises a #{frozen_error_class} when called on a frozen String when it's a no-op" do
- lambda { "foo".freeze.encode!("utf-8") }.should raise_error(frozen_error_class)
+ -> { "foo".freeze.encode!("utf-8") }.should raise_error(frozen_error_class)
end
describe "when passed no options" do
diff --git a/spec/ruby/core/string/end_with_spec.rb b/spec/ruby/core/string/end_with_spec.rb
index 429888803c..b7a04fdefe 100644
--- a/spec/ruby/core/string/end_with_spec.rb
+++ b/spec/ruby/core/string/end_with_spec.rb
@@ -32,9 +32,9 @@ describe "String#end_with?" do
it "ignores arguments not convertible to string" do
"hello".end_with?().should be_false
- lambda { "hello".end_with?(1) }.should raise_error(TypeError)
- lambda { "hello".end_with?(["o"]) }.should raise_error(TypeError)
- lambda { "hello".end_with?(1, nil, "o") }.should raise_error(TypeError)
+ -> { "hello".end_with?(1) }.should raise_error(TypeError)
+ -> { "hello".end_with?(["o"]) }.should raise_error(TypeError)
+ -> { "hello".end_with?(1, nil, "o") }.should raise_error(TypeError)
end
it "uses only the needed arguments" do
@@ -49,7 +49,7 @@ describe "String#end_with?" do
it "raises an Encoding::CompatibilityError if the encodings are incompatible" do
pat = "ア".encode Encoding::EUC_JP
- lambda do
+ -> do
"あれ".end_with?(pat)
end.should raise_error(Encoding::CompatibilityError)
end
diff --git a/spec/ruby/core/string/force_encoding_spec.rb b/spec/ruby/core/string/force_encoding_spec.rb
index 7a5503de56..56d9b1e9bc 100644
--- a/spec/ruby/core/string/force_encoding_spec.rb
+++ b/spec/ruby/core/string/force_encoding_spec.rb
@@ -40,11 +40,11 @@ describe "String#force_encoding" do
obj = mock("force_encoding")
obj.should_receive(:to_str).and_return(1)
- lambda { "abc".force_encoding(obj) }.should raise_error(TypeError)
+ -> { "abc".force_encoding(obj) }.should raise_error(TypeError)
end
it "raises a TypeError if passed nil" do
- lambda { "abc".force_encoding(nil) }.should raise_error(TypeError)
+ -> { "abc".force_encoding(nil) }.should raise_error(TypeError)
end
it "returns self" do
@@ -66,6 +66,6 @@ describe "String#force_encoding" do
it "raises a #{frozen_error_class} if self is frozen" do
str = "abcd".freeze
- lambda { str.force_encoding(str.encoding) }.should raise_error(frozen_error_class)
+ -> { str.force_encoding(str.encoding) }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/string/getbyte_spec.rb b/spec/ruby/core/string/getbyte_spec.rb
index 84286ada92..27b7d826ea 100644
--- a/spec/ruby/core/string/getbyte_spec.rb
+++ b/spec/ruby/core/string/getbyte_spec.rb
@@ -59,11 +59,11 @@ describe "String#getbyte" do
end
it "raises an ArgumentError unless given one argument" do
- lambda { "glark".getbyte }.should raise_error(ArgumentError)
- lambda { "food".getbyte(0,0) }.should raise_error(ArgumentError)
+ -> { "glark".getbyte }.should raise_error(ArgumentError)
+ -> { "food".getbyte(0,0) }.should raise_error(ArgumentError)
end
it "raises a TypeError unless its argument can be coerced into an Integer" do
- lambda { "a".getbyte('a') }.should raise_error(TypeError)
+ -> { "a".getbyte('a') }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/string/gsub_spec.rb b/spec/ruby/core/string/gsub_spec.rb
index 29b65c72a7..cd66a4f875 100644
--- a/spec/ruby/core/string/gsub_spec.rb
+++ b/spec/ruby/core/string/gsub_spec.rb
@@ -214,9 +214,9 @@ describe "String#gsub with pattern and replacement" do
end
it "raises a TypeError when pattern can't be converted to a string" do
- lambda { "hello".gsub([], "x") }.should raise_error(TypeError)
- lambda { "hello".gsub(Object.new, "x") }.should raise_error(TypeError)
- lambda { "hello".gsub(nil, "x") }.should raise_error(TypeError)
+ -> { "hello".gsub([], "x") }.should raise_error(TypeError)
+ -> { "hello".gsub(Object.new, "x") }.should raise_error(TypeError)
+ -> { "hello".gsub(nil, "x") }.should raise_error(TypeError)
end
it "tries to convert replacement to a string using to_str" do
@@ -227,9 +227,9 @@ describe "String#gsub with pattern and replacement" do
end
it "raises a TypeError when replacement can't be converted to a string" do
- lambda { "hello".gsub(/[aeiou]/, []) }.should raise_error(TypeError)
- lambda { "hello".gsub(/[aeiou]/, Object.new) }.should raise_error(TypeError)
- lambda { "hello".gsub(/[aeiou]/, nil) }.should raise_error(TypeError)
+ -> { "hello".gsub(/[aeiou]/, []) }.should raise_error(TypeError)
+ -> { "hello".gsub(/[aeiou]/, Object.new) }.should raise_error(TypeError)
+ -> { "hello".gsub(/[aeiou]/, nil) }.should raise_error(TypeError)
end
it "returns subclass instances when called on a subclass" do
@@ -298,7 +298,7 @@ describe "String#gsub with pattern and Hash" do
it "uses the hash's value set from default_proc for missing keys" do
hsh = {}
- hsh.default_proc = lambda { |k,v| 'lamb' }
+ hsh.default_proc = -> k, v { 'lamb' }
"food!".gsub(/./, hsh).should == "lamblamblamblamblamb"
end
@@ -387,7 +387,7 @@ describe "String#gsub! with pattern and Hash" do
it "uses the hash's value set from default_proc for missing keys" do
hsh = {}
- hsh.default_proc = lambda { |k,v| 'lamb' }
+ hsh.default_proc = -> k, v { 'lamb' }
"food!".gsub!(/./, hsh).should == "lamblamblamblamblamb"
end
@@ -536,8 +536,8 @@ describe "String#gsub with pattern and block" do
s = "hllëllo"
s2 = "hellö"
- lambda { s.gsub(/l/) { |bar| "Русский".force_encoding("iso-8859-5") } }.should raise_error(Encoding::CompatibilityError)
- lambda { s2.gsub(/l/) { |bar| "Русский".force_encoding("iso-8859-5") } }.should raise_error(Encoding::CompatibilityError)
+ -> { s.gsub(/l/) { |bar| "Русский".force_encoding("iso-8859-5") } }.should raise_error(Encoding::CompatibilityError)
+ -> { s2.gsub(/l/) { |bar| "Русский".force_encoding("iso-8859-5") } }.should raise_error(Encoding::CompatibilityError)
end
it "replaces the incompatible part properly even if the encodings are not compatible" do
@@ -549,7 +549,7 @@ describe "String#gsub with pattern and block" do
not_supported_on :opal do
it "raises an ArgumentError if encoding is not valid" do
x92 = [0x92].pack('C').force_encoding('utf-8')
- lambda { "a#{x92}b".gsub(/[^\x00-\x7f]/u, '') }.should raise_error(ArgumentError)
+ -> { "a#{x92}b".gsub(/[^\x00-\x7f]/u, '') }.should raise_error(ArgumentError)
end
end
end
@@ -607,9 +607,9 @@ describe "String#gsub! with pattern and replacement" do
s = "hello"
s.freeze
- lambda { s.gsub!(/ROAR/, "x") }.should raise_error(frozen_error_class)
- lambda { s.gsub!(/e/, "e") }.should raise_error(frozen_error_class)
- lambda { s.gsub!(/[aeiou]/, '*') }.should raise_error(frozen_error_class)
+ -> { s.gsub!(/ROAR/, "x") }.should raise_error(frozen_error_class)
+ -> { s.gsub!(/e/, "e") }.should raise_error(frozen_error_class)
+ -> { s.gsub!(/[aeiou]/, '*') }.should raise_error(frozen_error_class)
end
end
@@ -644,9 +644,9 @@ describe "String#gsub! with pattern and block" do
s = "hello"
s.freeze
- lambda { s.gsub!(/ROAR/) { "x" } }.should raise_error(frozen_error_class)
- lambda { s.gsub!(/e/) { "e" } }.should raise_error(frozen_error_class)
- lambda { s.gsub!(/[aeiou]/) { '*' } }.should raise_error(frozen_error_class)
+ -> { s.gsub!(/ROAR/) { "x" } }.should raise_error(frozen_error_class)
+ -> { s.gsub!(/e/) { "e" } }.should raise_error(frozen_error_class)
+ -> { s.gsub!(/[aeiou]/) { '*' } }.should raise_error(frozen_error_class)
end
it "uses the compatible encoding if they are compatible" do
@@ -661,8 +661,8 @@ describe "String#gsub! with pattern and block" do
s = "hllëllo"
s2 = "hellö"
- lambda { s.gsub!(/l/) { |bar| "Русский".force_encoding("iso-8859-5") } }.should raise_error(Encoding::CompatibilityError)
- lambda { s2.gsub!(/l/) { |bar| "Русский".force_encoding("iso-8859-5") } }.should raise_error(Encoding::CompatibilityError)
+ -> { s.gsub!(/l/) { |bar| "Русский".force_encoding("iso-8859-5") } }.should raise_error(Encoding::CompatibilityError)
+ -> { s2.gsub!(/l/) { |bar| "Русский".force_encoding("iso-8859-5") } }.should raise_error(Encoding::CompatibilityError)
end
it "replaces the incompatible part properly even if the encodings are not compatible" do
@@ -674,7 +674,7 @@ describe "String#gsub! with pattern and block" do
not_supported_on :opal do
it "raises an ArgumentError if encoding is not valid" do
x92 = [0x92].pack('C').force_encoding('utf-8')
- lambda { "a#{x92}b".gsub!(/[^\x00-\x7f]/u, '') }.should raise_error(ArgumentError)
+ -> { "a#{x92}b".gsub!(/[^\x00-\x7f]/u, '') }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/core/string/include_spec.rb b/spec/ruby/core/string/include_spec.rb
index 03ef3ba802..e32eb17c29 100644
--- a/spec/ruby/core/string/include_spec.rb
+++ b/spec/ruby/core/string/include_spec.rb
@@ -21,14 +21,14 @@ describe "String#include? with String" do
end
it "raises a TypeError if other can't be converted to string" do
- lambda { "hello".include?([]) }.should raise_error(TypeError)
- lambda { "hello".include?('h'.ord) }.should raise_error(TypeError)
- lambda { "hello".include?(mock('x')) }.should raise_error(TypeError)
+ -> { "hello".include?([]) }.should raise_error(TypeError)
+ -> { "hello".include?('h'.ord) }.should raise_error(TypeError)
+ -> { "hello".include?(mock('x')) }.should raise_error(TypeError)
end
it "raises an Encoding::CompatibilityError if the encodings are incompatible" do
pat = "ア".encode Encoding::EUC_JP
- lambda do
+ -> do
"あれ".include?(pat)
end.should raise_error(Encoding::CompatibilityError)
end
diff --git a/spec/ruby/core/string/index_spec.rb b/spec/ruby/core/string/index_spec.rb
index fb5f4e75e7..ca62911db0 100644
--- a/spec/ruby/core/string/index_spec.rb
+++ b/spec/ruby/core/string/index_spec.rb
@@ -4,15 +4,15 @@ require_relative 'fixtures/classes'
describe "String#index" do
it "raises a TypeError if passed nil" do
- lambda { "abc".index nil }.should raise_error(TypeError)
+ -> { "abc".index nil }.should raise_error(TypeError)
end
it "raises a TypeError if passed a boolean" do
- lambda { "abc".index true }.should raise_error(TypeError)
+ -> { "abc".index true }.should raise_error(TypeError)
end
it "raises a TypeError if passed a Symbol" do
- lambda { "abc".index :a }.should raise_error(TypeError)
+ -> { "abc".index :a }.should raise_error(TypeError)
end
it "calls #to_str to convert the first argument" do
@@ -28,7 +28,7 @@ describe "String#index" do
end
it "raises a TypeError if passed a Fixnum" do
- lambda { "abc".index 97 }.should raise_error(TypeError)
+ -> { "abc".index 97 }.should raise_error(TypeError)
end
end
@@ -154,7 +154,7 @@ describe "String#index with String" do
it "raises an Encoding::CompatibilityError if the encodings are incompatible" do
char = "れ".encode Encoding::EUC_JP
- lambda do
+ -> do
"あれ".index char
end.should raise_error(Encoding::CompatibilityError)
end
@@ -305,7 +305,7 @@ describe "String#index with Regexp" do
it "raises an Encoding::CompatibilityError if the encodings are incompatible" do
re = Regexp.new "れ".encode(Encoding::EUC_JP)
- lambda do
+ -> do
"あれ".index re
end.should raise_error(Encoding::CompatibilityError)
end
diff --git a/spec/ruby/core/string/insert_spec.rb b/spec/ruby/core/string/insert_spec.rb
index d5b9026f3d..588b8ab272 100644
--- a/spec/ruby/core/string/insert_spec.rb
+++ b/spec/ruby/core/string/insert_spec.rb
@@ -23,8 +23,8 @@ describe "String#insert with index, other" do
end
it "raises an IndexError if the index is beyond string" do
- lambda { "abcd".insert(5, 'X') }.should raise_error(IndexError)
- lambda { "abcd".insert(-6, 'X') }.should raise_error(IndexError)
+ -> { "abcd".insert(5, 'X') }.should raise_error(IndexError)
+ -> { "abcd".insert(-6, 'X') }.should raise_error(IndexError)
end
it "converts index to an integer using to_int" do
@@ -52,15 +52,15 @@ describe "String#insert with index, other" do
end
it "raises a TypeError if other can't be converted to string" do
- lambda { "abcd".insert(-6, Object.new)}.should raise_error(TypeError)
- lambda { "abcd".insert(-6, []) }.should raise_error(TypeError)
- lambda { "abcd".insert(-6, mock('x')) }.should raise_error(TypeError)
+ -> { "abcd".insert(-6, Object.new)}.should raise_error(TypeError)
+ -> { "abcd".insert(-6, []) }.should raise_error(TypeError)
+ -> { "abcd".insert(-6, mock('x')) }.should raise_error(TypeError)
end
it "raises a #{frozen_error_class} if self is frozen" do
str = "abcd".freeze
- lambda { str.insert(4, '') }.should raise_error(frozen_error_class)
- lambda { str.insert(4, 'X') }.should raise_error(frozen_error_class)
+ -> { str.insert(4, '') }.should raise_error(frozen_error_class)
+ -> { str.insert(4, 'X') }.should raise_error(frozen_error_class)
end
it "inserts a character into a multibyte encoded string" do
@@ -75,7 +75,7 @@ describe "String#insert with index, other" do
it "raises an Encoding::CompatibilityError if the encodings are incompatible" do
pat = "ア".encode Encoding::EUC_JP
- lambda do
+ -> do
"あれ".insert 0, pat
end.should raise_error(Encoding::CompatibilityError)
end
diff --git a/spec/ruby/core/string/ljust_spec.rb b/spec/ruby/core/string/ljust_spec.rb
index a8160c727b..ed4cb86859 100644
--- a/spec/ruby/core/string/ljust_spec.rb
+++ b/spec/ruby/core/string/ljust_spec.rb
@@ -49,10 +49,10 @@ describe "String#ljust with length, padding" do
end
it "raises a TypeError when length can't be converted to an integer" do
- lambda { "hello".ljust("x") }.should raise_error(TypeError)
- lambda { "hello".ljust("x", "y") }.should raise_error(TypeError)
- lambda { "hello".ljust([]) }.should raise_error(TypeError)
- lambda { "hello".ljust(mock('x')) }.should raise_error(TypeError)
+ -> { "hello".ljust("x") }.should raise_error(TypeError)
+ -> { "hello".ljust("x", "y") }.should raise_error(TypeError)
+ -> { "hello".ljust([]) }.should raise_error(TypeError)
+ -> { "hello".ljust(mock('x')) }.should raise_error(TypeError)
end
it "tries to convert padstr to a string using to_str" do
@@ -63,13 +63,13 @@ describe "String#ljust with length, padding" do
end
it "raises a TypeError when padstr can't be converted" do
- lambda { "hello".ljust(20, []) }.should raise_error(TypeError)
- lambda { "hello".ljust(20, Object.new)}.should raise_error(TypeError)
- lambda { "hello".ljust(20, mock('x')) }.should raise_error(TypeError)
+ -> { "hello".ljust(20, []) }.should raise_error(TypeError)
+ -> { "hello".ljust(20, Object.new)}.should raise_error(TypeError)
+ -> { "hello".ljust(20, mock('x')) }.should raise_error(TypeError)
end
it "raises an ArgumentError when padstr is empty" do
- lambda { "hello".ljust(10, '') }.should raise_error(ArgumentError)
+ -> { "hello".ljust(10, '') }.should raise_error(ArgumentError)
end
it "returns subclass instances when called on subclasses" do
@@ -106,7 +106,7 @@ describe "String#ljust with length, padding" do
it "raises an Encoding::CompatibilityError if the encodings are incompatible" do
pat = "ア".encode Encoding::EUC_JP
- lambda do
+ -> do
"あれ".ljust 5, pat
end.should raise_error(Encoding::CompatibilityError)
end
diff --git a/spec/ruby/core/string/lstrip_spec.rb b/spec/ruby/core/string/lstrip_spec.rb
index ecfc89dd6b..7f9363d398 100644
--- a/spec/ruby/core/string/lstrip_spec.rb
+++ b/spec/ruby/core/string/lstrip_spec.rb
@@ -39,12 +39,12 @@ describe "String#lstrip!" do
end
it "raises a #{frozen_error_class} on a frozen instance that is modified" do
- lambda { " hello ".freeze.lstrip! }.should raise_error(frozen_error_class)
+ -> { " hello ".freeze.lstrip! }.should raise_error(frozen_error_class)
end
# see [ruby-core:23657]
it "raises a #{frozen_error_class} on a frozen instance that would not be modified" do
- lambda { "hello".freeze.lstrip! }.should raise_error(frozen_error_class)
- lambda { "".freeze.lstrip! }.should raise_error(frozen_error_class)
+ -> { "hello".freeze.lstrip! }.should raise_error(frozen_error_class)
+ -> { "".freeze.lstrip! }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/string/match_spec.rb b/spec/ruby/core/string/match_spec.rb
index c5505fd382..78b94baa44 100644
--- a/spec/ruby/core/string/match_spec.rb
+++ b/spec/ruby/core/string/match_spec.rb
@@ -19,8 +19,8 @@ describe "String#=~" do
end
it "raises a TypeError if a obj is a string" do
- lambda { "some string" =~ "another string" }.should raise_error(TypeError)
- lambda { "a" =~ StringSpecs::MyString.new("b") }.should raise_error(TypeError)
+ -> { "some string" =~ "another string" }.should raise_error(TypeError)
+ -> { "a" =~ StringSpecs::MyString.new("b") }.should raise_error(TypeError)
end
it "invokes obj.=~ with self if obj is neither a string nor regexp" do
@@ -107,9 +107,9 @@ describe "String#match" do
end
it "raises a TypeError if pattern is not a regexp or a string" do
- lambda { 'hello'.match(10) }.should raise_error(TypeError)
+ -> { 'hello'.match(10) }.should raise_error(TypeError)
not_supported_on :opal do
- lambda { 'hello'.match(:ell) }.should raise_error(TypeError)
+ -> { 'hello'.match(:ell) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/string/modulo_spec.rb b/spec/ruby/core/string/modulo_spec.rb
index fc4972b9d7..0ac0963403 100644
--- a/spec/ruby/core/string/modulo_spec.rb
+++ b/spec/ruby/core/string/modulo_spec.rb
@@ -4,7 +4,7 @@ require_relative '../../shared/hash/key_error'
describe "String#%" do
context "when key is missing from passed-in hash" do
- it_behaves_like :key_error, -> (obj, key) { "%{#{key}}" % obj }, { a: 5 }
+ it_behaves_like :key_error, -> obj, key { "%{#{key}}" % obj }, { a: 5 }
end
it "formats multiple expressions" do
@@ -32,7 +32,7 @@ describe "String#%" do
end
it "raises if a compatible encoding can't be found" do
- lambda { "hello %s".encode("utf-8") % "world".encode("UTF-16LE") }.should raise_error(Encoding::CompatibilityError)
+ -> { "hello %s".encode("utf-8") % "world".encode("UTF-16LE") }.should raise_error(Encoding::CompatibilityError)
end
end
@@ -45,8 +45,8 @@ describe "String#%" do
ruby_version_is "2.5" do
it "raises an error if single % appears at the end" do
- lambda { ("%" % []) }.should raise_error(ArgumentError)
- lambda { ("foo%" % [])}.should raise_error(ArgumentError)
+ -> { ("%" % []) }.should raise_error(ArgumentError)
+ -> { ("foo%" % [])}.should raise_error(ArgumentError)
end
end
@@ -63,18 +63,18 @@ describe "String#%" do
end
it "raises an error if single % appears anywhere else" do
- lambda { (" % " % []) }.should raise_error(ArgumentError)
- lambda { ("foo%quux" % []) }.should raise_error(ArgumentError)
+ -> { (" % " % []) }.should raise_error(ArgumentError)
+ -> { ("foo%quux" % []) }.should raise_error(ArgumentError)
end
it "raises an error if NULL or \\n appear anywhere else in the format string" do
begin
old_debug, $DEBUG = $DEBUG, false
- lambda { "%.\n3f" % 1.2 }.should raise_error(ArgumentError)
- lambda { "%.3\nf" % 1.2 }.should raise_error(ArgumentError)
- lambda { "%.\03f" % 1.2 }.should raise_error(ArgumentError)
- lambda { "%.3\0f" % 1.2 }.should raise_error(ArgumentError)
+ -> { "%.\n3f" % 1.2 }.should raise_error(ArgumentError)
+ -> { "%.3\nf" % 1.2 }.should raise_error(ArgumentError)
+ -> { "%.\03f" % 1.2 }.should raise_error(ArgumentError)
+ -> { "%.3\0f" % 1.2 }.should raise_error(ArgumentError)
ensure
$DEBUG = old_debug
end
@@ -99,8 +99,8 @@ describe "String#%" do
s = $stderr
$stderr = IOStub.new
- lambda { "" % [1, 2, 3] }.should raise_error(ArgumentError)
- lambda { "%s" % [1, 2, 3] }.should raise_error(ArgumentError)
+ -> { "" % [1, 2, 3] }.should raise_error(ArgumentError)
+ -> { "%s" % [1, 2, 3] }.should raise_error(ArgumentError)
ensure
$DEBUG = old_debug
$stderr = s
@@ -125,21 +125,21 @@ describe "String#%" do
end
it "raises an ArgumentError when given invalid argument specifiers" do
- lambda { "%1" % [] }.should raise_error(ArgumentError)
- lambda { "%+" % [] }.should raise_error(ArgumentError)
- lambda { "%-" % [] }.should raise_error(ArgumentError)
- lambda { "%#" % [] }.should raise_error(ArgumentError)
- lambda { "%0" % [] }.should raise_error(ArgumentError)
- lambda { "%*" % [] }.should raise_error(ArgumentError)
- lambda { "%." % [] }.should raise_error(ArgumentError)
- lambda { "%_" % [] }.should raise_error(ArgumentError)
- lambda { "%0$s" % "x" }.should raise_error(ArgumentError)
- lambda { "%*0$s" % [5, "x"] }.should raise_error(ArgumentError)
- lambda { "%*1$.*0$1$s" % [1, 2, 3] }.should raise_error(ArgumentError)
+ -> { "%1" % [] }.should raise_error(ArgumentError)
+ -> { "%+" % [] }.should raise_error(ArgumentError)
+ -> { "%-" % [] }.should raise_error(ArgumentError)
+ -> { "%#" % [] }.should raise_error(ArgumentError)
+ -> { "%0" % [] }.should raise_error(ArgumentError)
+ -> { "%*" % [] }.should raise_error(ArgumentError)
+ -> { "%." % [] }.should raise_error(ArgumentError)
+ -> { "%_" % [] }.should raise_error(ArgumentError)
+ -> { "%0$s" % "x" }.should raise_error(ArgumentError)
+ -> { "%*0$s" % [5, "x"] }.should raise_error(ArgumentError)
+ -> { "%*1$.*0$1$s" % [1, 2, 3] }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when multiple positional argument tokens are given for one format specifier" do
- lambda { "%1$1$s" % "foo" }.should raise_error(ArgumentError)
+ -> { "%1$1$s" % "foo" }.should raise_error(ArgumentError)
end
it "respects positional arguments and precision tokens given for one format specifier" do
@@ -155,36 +155,36 @@ describe "String#%" do
end
it "raises an ArgumentError when multiple width star tokens are given for one format specifier" do
- lambda { "%**s" % [5, 5, 5] }.should raise_error(ArgumentError)
+ -> { "%**s" % [5, 5, 5] }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when a width star token is seen after a width token" do
- lambda { "%5*s" % [5, 5] }.should raise_error(ArgumentError)
+ -> { "%5*s" % [5, 5] }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when multiple precision tokens are given" do
- lambda { "%.5.5s" % 5 }.should raise_error(ArgumentError)
- lambda { "%.5.*s" % [5, 5] }.should raise_error(ArgumentError)
- lambda { "%.*.5s" % [5, 5] }.should raise_error(ArgumentError)
+ -> { "%.5.5s" % 5 }.should raise_error(ArgumentError)
+ -> { "%.5.*s" % [5, 5] }.should raise_error(ArgumentError)
+ -> { "%.*.5s" % [5, 5] }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when there are less arguments than format specifiers" do
("foo" % []).should == "foo"
- lambda { "%s" % [] }.should raise_error(ArgumentError)
- lambda { "%s %s" % [1] }.should raise_error(ArgumentError)
+ -> { "%s" % [] }.should raise_error(ArgumentError)
+ -> { "%s %s" % [1] }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when absolute and relative argument numbers are mixed" do
- lambda { "%s %1$s" % "foo" }.should raise_error(ArgumentError)
- lambda { "%1$s %s" % "foo" }.should raise_error(ArgumentError)
+ -> { "%s %1$s" % "foo" }.should raise_error(ArgumentError)
+ -> { "%1$s %s" % "foo" }.should raise_error(ArgumentError)
- lambda { "%s %2$s" % ["foo", "bar"] }.should raise_error(ArgumentError)
- lambda { "%2$s %s" % ["foo", "bar"] }.should raise_error(ArgumentError)
+ -> { "%s %2$s" % ["foo", "bar"] }.should raise_error(ArgumentError)
+ -> { "%2$s %s" % ["foo", "bar"] }.should raise_error(ArgumentError)
- lambda { "%*2$s" % [5, 5, 5] }.should raise_error(ArgumentError)
- lambda { "%*.*2$s" % [5, 5, 5] }.should raise_error(ArgumentError)
- lambda { "%*2$.*2$s" % [5, 5, 5] }.should raise_error(ArgumentError)
- lambda { "%*.*2$s" % [5, 5, 5] }.should raise_error(ArgumentError)
+ -> { "%*2$s" % [5, 5, 5] }.should raise_error(ArgumentError)
+ -> { "%*.*2$s" % [5, 5, 5] }.should raise_error(ArgumentError)
+ -> { "%*2$.*2$s" % [5, 5, 5] }.should raise_error(ArgumentError)
+ -> { "%*.*2$s" % [5, 5, 5] }.should raise_error(ArgumentError)
end
it "allows reuse of the one argument multiple via absolute argument numbers" do
@@ -193,13 +193,13 @@ describe "String#%" do
end
it "always interprets an array argument as a list of argument parameters" do
- lambda { "%p" % [] }.should raise_error(ArgumentError)
+ -> { "%p" % [] }.should raise_error(ArgumentError)
("%p" % [1]).should == "1"
("%p %p" % [1, 2]).should == "1 2"
end
it "always interprets an array subclass argument as a list of argument parameters" do
- lambda { "%p" % StringSpecs::MyArray[] }.should raise_error(ArgumentError)
+ -> { "%p" % StringSpecs::MyArray[] }.should raise_error(ArgumentError)
("%p" % StringSpecs::MyArray[1]).should == "1"
("%p %p" % StringSpecs::MyArray[1, 2]).should == "1 2"
end
@@ -270,7 +270,7 @@ describe "String#%" do
x = mock("string modulo to_ary")
x.should_receive(:to_ary).and_return("x")
- lambda { "%s" % x }.should raise_error(TypeError)
+ -> { "%s" % x }.should raise_error(TypeError)
end
it "tries to convert the argument to Array by calling #to_ary" do
@@ -377,7 +377,7 @@ describe "String#%" do
("%*c" % [10, 3]).should == " \003"
("%c" % 42).should == "*"
- lambda { "%c" % Object }.should raise_error(TypeError)
+ -> { "%c" % Object }.should raise_error(TypeError)
end
it "supports single character strings as argument for %c" do
@@ -385,7 +385,7 @@ describe "String#%" do
end
it "raises an exception for multiple character strings as argument for %c" do
- lambda { "%c" % 'AA' }.should raise_error(ArgumentError)
+ -> { "%c" % 'AA' }.should raise_error(ArgumentError)
end
it "calls to_str on argument for %c formats" do
@@ -619,7 +619,7 @@ describe "String#%" do
# MRI crashes on this one.
# See http://groups.google.com/group/ruby-core-google/t/c285c18cd94c216d
it "raises an ArgumentError for huge precisions for %s" do
- block = lambda { "%.25555555555555555555555555555555555555s" % "hello world" }
+ block = -> { "%.25555555555555555555555555555555555555s" % "hello world" }
block.should raise_error(ArgumentError)
end
@@ -712,19 +712,19 @@ describe "String#%" do
(format % "0b1101").should == (format % Kernel.Integer("0b1101"))
(format % "0b1101_0000").should == (format % Kernel.Integer("0b1101_0000"))
(format % "0777").should == (format % Kernel.Integer("0777"))
- lambda {
+ -> {
# see [ruby-core:14139] for more details
(format % "0777").should == (format % Kernel.Integer("0777"))
}.should_not raise_error(ArgumentError)
- lambda { format % "0__7_7_7" }.should raise_error(ArgumentError)
+ -> { format % "0__7_7_7" }.should raise_error(ArgumentError)
- lambda { format % "" }.should raise_error(ArgumentError)
- lambda { format % "x" }.should raise_error(ArgumentError)
- lambda { format % "5x" }.should raise_error(ArgumentError)
- lambda { format % "08" }.should raise_error(ArgumentError)
- lambda { format % "0b2" }.should raise_error(ArgumentError)
- lambda { format % "123__456" }.should raise_error(ArgumentError)
+ -> { format % "" }.should raise_error(ArgumentError)
+ -> { format % "x" }.should raise_error(ArgumentError)
+ -> { format % "5x" }.should raise_error(ArgumentError)
+ -> { format % "08" }.should raise_error(ArgumentError)
+ -> { format % "0b2" }.should raise_error(ArgumentError)
+ -> { format % "123__456" }.should raise_error(ArgumentError)
obj = mock('5')
obj.should_receive(:to_i).and_return(5)
@@ -757,15 +757,15 @@ describe "String#%" do
(format % "0777").should == (format % 777)
- lambda { format % "" }.should raise_error(ArgumentError)
- lambda { format % "x" }.should raise_error(ArgumentError)
- lambda { format % "." }.should raise_error(ArgumentError)
- lambda { format % "10." }.should raise_error(ArgumentError)
- lambda { format % "5x" }.should raise_error(ArgumentError)
- lambda { format % "0b1" }.should raise_error(ArgumentError)
- lambda { format % "10e10.5" }.should raise_error(ArgumentError)
- lambda { format % "10__10" }.should raise_error(ArgumentError)
- lambda { format % "10.10__10" }.should raise_error(ArgumentError)
+ -> { format % "" }.should raise_error(ArgumentError)
+ -> { format % "x" }.should raise_error(ArgumentError)
+ -> { format % "." }.should raise_error(ArgumentError)
+ -> { format % "10." }.should raise_error(ArgumentError)
+ -> { format % "5x" }.should raise_error(ArgumentError)
+ -> { format % "0b1" }.should raise_error(ArgumentError)
+ -> { format % "10e10.5" }.should raise_error(ArgumentError)
+ -> { format % "10__10" }.should raise_error(ArgumentError)
+ -> { format % "10.10__10" }.should raise_error(ArgumentError)
obj = mock('5.0')
obj.should_receive(:to_f).and_return(5.0)
@@ -787,7 +787,7 @@ describe "String#%" do
end
it "should raise ArgumentError if no hash given" do
- lambda {"%{foo}" % []}.should raise_error(ArgumentError)
+ -> {"%{foo}" % []}.should raise_error(ArgumentError)
end
end
@@ -797,11 +797,11 @@ describe "String#%" do
end
it "raises KeyError if key is missing from passed-in hash" do
- lambda {"%<foo>d" % {}}.should raise_error(KeyError)
+ -> {"%<foo>d" % {}}.should raise_error(KeyError)
end
it "should raise ArgumentError if no hash given" do
- lambda {"%<foo>" % []}.should raise_error(ArgumentError)
+ -> {"%<foo>" % []}.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/core/string/multiply_spec.rb b/spec/ruby/core/string/multiply_spec.rb
index 7d887fd93a..c15f670c46 100644
--- a/spec/ruby/core/string/multiply_spec.rb
+++ b/spec/ruby/core/string/multiply_spec.rb
@@ -3,5 +3,5 @@ require_relative 'fixtures/classes'
require_relative '../../shared/string/times'
describe "String#*" do
- it_behaves_like :string_times, :*, ->(str, times) { str * times }
+ it_behaves_like :string_times, :*, -> str, times { str * times }
end
diff --git a/spec/ruby/core/string/new_spec.rb b/spec/ruby/core/string/new_spec.rb
index f65daf2dd2..ca678f5323 100644
--- a/spec/ruby/core/string/new_spec.rb
+++ b/spec/ruby/core/string/new_spec.rb
@@ -51,8 +51,8 @@ describe "String.new" do
end
it "raises TypeError on inconvertible object" do
- lambda { String.new 5 }.should raise_error(TypeError)
- lambda { String.new nil }.should raise_error(TypeError)
+ -> { String.new 5 }.should raise_error(TypeError)
+ -> { String.new nil }.should raise_error(TypeError)
end
it "returns a binary String" do
diff --git a/spec/ruby/core/string/ord_spec.rb b/spec/ruby/core/string/ord_spec.rb
index 63f9815ea9..0f5a3f6a37 100644
--- a/spec/ruby/core/string/ord_spec.rb
+++ b/spec/ruby/core/string/ord_spec.rb
@@ -23,6 +23,6 @@ describe "String#ord" do
end
it "raises an ArgumentError if called on an empty String" do
- lambda { ''.ord }.should raise_error(ArgumentError)
+ -> { ''.ord }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/string/partition_spec.rb b/spec/ruby/core/string/partition_spec.rb
index f7ab5f85aa..996368d6a4 100644
--- a/spec/ruby/core/string/partition_spec.rb
+++ b/spec/ruby/core/string/partition_spec.rb
@@ -28,8 +28,8 @@ describe "String#partition with String" do
end
it "raises an error if not convertible to string" do
- lambda{ "hello".partition(5) }.should raise_error(TypeError)
- lambda{ "hello".partition(nil) }.should raise_error(TypeError)
+ ->{ "hello".partition(5) }.should raise_error(TypeError)
+ ->{ "hello".partition(nil) }.should raise_error(TypeError)
end
it "takes precedence over a given block" do
diff --git a/spec/ruby/core/string/percent_spec.rb b/spec/ruby/core/string/percent_spec.rb
index e701def344..e3460522b1 100644
--- a/spec/ruby/core/string/percent_spec.rb
+++ b/spec/ruby/core/string/percent_spec.rb
@@ -3,11 +3,11 @@ require_relative '../kernel/shared/sprintf'
require_relative '../kernel/shared/sprintf_encoding'
describe "String#%" do
- it_behaves_like :kernel_sprintf, -> (format, *args) {
+ it_behaves_like :kernel_sprintf, -> format, *args {
format % args
}
- it_behaves_like :kernel_sprintf_encoding, -> (format, *args) {
+ it_behaves_like :kernel_sprintf_encoding, -> format, *args {
format % args
}
end
diff --git a/spec/ruby/core/string/plus_spec.rb b/spec/ruby/core/string/plus_spec.rb
index a9f287a82b..b8e3bf0a4b 100644
--- a/spec/ruby/core/string/plus_spec.rb
+++ b/spec/ruby/core/string/plus_spec.rb
@@ -18,8 +18,8 @@ describe "String#+" do
end
it "raises a TypeError when given any object that fails #to_str" do
- lambda { "" + Object.new }.should raise_error(TypeError)
- lambda { "" + 65 }.should raise_error(TypeError)
+ -> { "" + Object.new }.should raise_error(TypeError)
+ -> { "" + 65 }.should raise_error(TypeError)
end
it "doesn't return subclass instances" do
diff --git a/spec/ruby/core/string/prepend_spec.rb b/spec/ruby/core/string/prepend_spec.rb
index e2c29de836..485c578e2d 100644
--- a/spec/ruby/core/string/prepend_spec.rb
+++ b/spec/ruby/core/string/prepend_spec.rb
@@ -16,16 +16,16 @@ describe "String#prepend" do
end
it "raises a TypeError if the given argument can't be converted to a String" do
- lambda { "hello ".prepend [] }.should raise_error(TypeError)
- lambda { 'hello '.prepend mock('x') }.should raise_error(TypeError)
+ -> { "hello ".prepend [] }.should raise_error(TypeError)
+ -> { 'hello '.prepend mock('x') }.should raise_error(TypeError)
end
it "raises a #{frozen_error_class} when self is frozen" do
a = "hello"
a.freeze
- lambda { a.prepend "" }.should raise_error(frozen_error_class)
- lambda { a.prepend "test" }.should raise_error(frozen_error_class)
+ -> { a.prepend "" }.should raise_error(frozen_error_class)
+ -> { a.prepend "test" }.should raise_error(frozen_error_class)
end
it "works when given a subclass instance" do
diff --git a/spec/ruby/core/string/reverse_spec.rb b/spec/ruby/core/string/reverse_spec.rb
index f2a8b64d47..3941ea0521 100644
--- a/spec/ruby/core/string/reverse_spec.rb
+++ b/spec/ruby/core/string/reverse_spec.rb
@@ -31,13 +31,13 @@ describe "String#reverse!" do
end
it "raises a #{frozen_error_class} on a frozen instance that is modified" do
- lambda { "anna".freeze.reverse! }.should raise_error(frozen_error_class)
- lambda { "hello".freeze.reverse! }.should raise_error(frozen_error_class)
+ -> { "anna".freeze.reverse! }.should raise_error(frozen_error_class)
+ -> { "hello".freeze.reverse! }.should raise_error(frozen_error_class)
end
# see [ruby-core:23666]
it "raises a #{frozen_error_class} on a frozen instance that would not be modified" do
- lambda { "".freeze.reverse! }.should raise_error(frozen_error_class)
+ -> { "".freeze.reverse! }.should raise_error(frozen_error_class)
end
it "reverses a string with multi byte characters" do
diff --git a/spec/ruby/core/string/rindex_spec.rb b/spec/ruby/core/string/rindex_spec.rb
index f74c0115cc..e021486bc2 100644
--- a/spec/ruby/core/string/rindex_spec.rb
+++ b/spec/ruby/core/string/rindex_spec.rb
@@ -6,15 +6,15 @@ require_relative 'fixtures/utf-8-encoding'
describe "String#rindex with object" do
it "raises a TypeError if obj isn't a String, Fixnum or Regexp" do
not_supported_on :opal do
- lambda { "hello".rindex(:sym) }.should raise_error(TypeError)
+ -> { "hello".rindex(:sym) }.should raise_error(TypeError)
end
- lambda { "hello".rindex(mock('x')) }.should raise_error(TypeError)
+ -> { "hello".rindex(mock('x')) }.should raise_error(TypeError)
end
it "doesn't try to convert obj to an integer via to_int" do
obj = mock('x')
obj.should_not_receive(:to_int)
- lambda { "hello".rindex(obj) }.should raise_error(TypeError)
+ -> { "hello".rindex(obj) }.should raise_error(TypeError)
end
it "tries to convert obj to a string via to_str" do
@@ -190,7 +190,7 @@ describe "String#rindex with String" do
end
it "raises a TypeError when given offset is nil" do
- lambda { "str".rindex("st", nil) }.should raise_error(TypeError)
+ -> { "str".rindex("st", nil) }.should raise_error(TypeError)
end
end
@@ -344,7 +344,7 @@ describe "String#rindex with Regexp" do
end
it "raises a TypeError when given offset is nil" do
- lambda { "str".rindex(/../, nil) }.should raise_error(TypeError)
+ -> { "str".rindex(/../, nil) }.should raise_error(TypeError)
end
it "returns the reverse character index of a multibyte character" do
@@ -359,7 +359,7 @@ describe "String#rindex with Regexp" do
it "raises an Encoding::CompatibilityError if the encodings are incompatible" do
re = Regexp.new "れ".encode(Encoding::EUC_JP)
- lambda do
+ -> do
"あれ".rindex re
end.should raise_error(Encoding::CompatibilityError)
end
diff --git a/spec/ruby/core/string/rjust_spec.rb b/spec/ruby/core/string/rjust_spec.rb
index 2821b018e8..1ba298e8f3 100644
--- a/spec/ruby/core/string/rjust_spec.rb
+++ b/spec/ruby/core/string/rjust_spec.rb
@@ -49,10 +49,10 @@ describe "String#rjust with length, padding" do
end
it "raises a TypeError when length can't be converted to an integer" do
- lambda { "hello".rjust("x") }.should raise_error(TypeError)
- lambda { "hello".rjust("x", "y") }.should raise_error(TypeError)
- lambda { "hello".rjust([]) }.should raise_error(TypeError)
- lambda { "hello".rjust(mock('x')) }.should raise_error(TypeError)
+ -> { "hello".rjust("x") }.should raise_error(TypeError)
+ -> { "hello".rjust("x", "y") }.should raise_error(TypeError)
+ -> { "hello".rjust([]) }.should raise_error(TypeError)
+ -> { "hello".rjust(mock('x')) }.should raise_error(TypeError)
end
it "tries to convert padstr to a string using to_str" do
@@ -63,13 +63,13 @@ describe "String#rjust with length, padding" do
end
it "raises a TypeError when padstr can't be converted" do
- lambda { "hello".rjust(20, []) }.should raise_error(TypeError)
- lambda { "hello".rjust(20, Object.new)}.should raise_error(TypeError)
- lambda { "hello".rjust(20, mock('x')) }.should raise_error(TypeError)
+ -> { "hello".rjust(20, []) }.should raise_error(TypeError)
+ -> { "hello".rjust(20, Object.new)}.should raise_error(TypeError)
+ -> { "hello".rjust(20, mock('x')) }.should raise_error(TypeError)
end
it "raises an ArgumentError when padstr is empty" do
- lambda { "hello".rjust(10, '') }.should raise_error(ArgumentError)
+ -> { "hello".rjust(10, '') }.should raise_error(ArgumentError)
end
it "returns subclass instances when called on subclasses" do
@@ -106,7 +106,7 @@ describe "String#rjust with length, padding" do
it "raises an Encoding::CompatibilityError if the encodings are incompatible" do
pat = "ア".encode Encoding::EUC_JP
- lambda do
+ -> do
"あれ".rjust 5, pat
end.should raise_error(Encoding::CompatibilityError)
end
diff --git a/spec/ruby/core/string/rpartition_spec.rb b/spec/ruby/core/string/rpartition_spec.rb
index a5222e0a2a..c6428636f6 100644
--- a/spec/ruby/core/string/rpartition_spec.rb
+++ b/spec/ruby/core/string/rpartition_spec.rb
@@ -27,7 +27,7 @@ describe "String#rpartition with String" do
end
it "raises an error if not convertible to string" do
- lambda{ "hello".rpartition(5) }.should raise_error(TypeError)
- lambda{ "hello".rpartition(nil) }.should raise_error(TypeError)
+ ->{ "hello".rpartition(5) }.should raise_error(TypeError)
+ ->{ "hello".rpartition(nil) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/string/rstrip_spec.rb b/spec/ruby/core/string/rstrip_spec.rb
index 6376e5df33..2f32836e54 100644
--- a/spec/ruby/core/string/rstrip_spec.rb
+++ b/spec/ruby/core/string/rstrip_spec.rb
@@ -41,12 +41,12 @@ describe "String#rstrip!" do
end
it "raises a #{frozen_error_class} on a frozen instance that is modified" do
- lambda { " hello ".freeze.rstrip! }.should raise_error(frozen_error_class)
+ -> { " hello ".freeze.rstrip! }.should raise_error(frozen_error_class)
end
# see [ruby-core:23666]
it "raises a #{frozen_error_class} on a frozen instance that would not be modified" do
- lambda { "hello".freeze.rstrip! }.should raise_error(frozen_error_class)
- lambda { "".freeze.rstrip! }.should raise_error(frozen_error_class)
+ -> { "hello".freeze.rstrip! }.should raise_error(frozen_error_class)
+ -> { "".freeze.rstrip! }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/string/scan_spec.rb b/spec/ruby/core/string/scan_spec.rb
index ac82f5e236..06400fc745 100644
--- a/spec/ruby/core/string/scan_spec.rb
+++ b/spec/ruby/core/string/scan_spec.rb
@@ -58,11 +58,11 @@ describe "String#scan" do
end
it "raises a TypeError if pattern isn't a Regexp and can't be converted to a String" do
- lambda { "cruel world".scan(5) }.should raise_error(TypeError)
+ -> { "cruel world".scan(5) }.should raise_error(TypeError)
not_supported_on :opal do
- lambda { "cruel world".scan(:test) }.should raise_error(TypeError)
+ -> { "cruel world".scan(:test) }.should raise_error(TypeError)
end
- lambda { "cruel world".scan(mock('x')) }.should raise_error(TypeError)
+ -> { "cruel world".scan(mock('x')) }.should raise_error(TypeError)
end
it "taints the results if the String argument is tainted" do
diff --git a/spec/ruby/core/string/scrub_spec.rb b/spec/ruby/core/string/scrub_spec.rb
index 92e7641f0b..390035ef30 100644
--- a/spec/ruby/core/string/scrub_spec.rb
+++ b/spec/ruby/core/string/scrub_spec.rb
@@ -47,14 +47,14 @@ describe "String#scrub with a custom replacement" do
it "raises ArgumentError for replacements with an invalid encoding" do
x81 = [0x81].pack('C').force_encoding('utf-8')
xE4 = [0xE4].pack('C').force_encoding('utf-8')
- block = lambda { "foo#{x81}".scrub(xE4) }
+ block = -> { "foo#{x81}".scrub(xE4) }
block.should raise_error(ArgumentError)
end
it "raises TypeError when a non String replacement is given" do
x81 = [0x81].pack('C').force_encoding('utf-8')
- block = lambda { "foo#{x81}".scrub(1) }
+ block = -> { "foo#{x81}".scrub(1) }
block.should raise_error(TypeError)
end
diff --git a/spec/ruby/core/string/setbyte_spec.rb b/spec/ruby/core/string/setbyte_spec.rb
index 3f2e03f8a8..6912b1b66f 100644
--- a/spec/ruby/core/string/setbyte_spec.rb
+++ b/spec/ruby/core/string/setbyte_spec.rb
@@ -51,11 +51,11 @@ describe "String#setbyte" do
end
it "raises an IndexError if the index is greater than the String bytesize" do
- lambda { "?".setbyte(1, 97) }.should raise_error(IndexError)
+ -> { "?".setbyte(1, 97) }.should raise_error(IndexError)
end
it "raises an IndexError if the negative index is greater magnitude than the String bytesize" do
- lambda { "???".setbyte(-5, 97) }.should raise_error(IndexError)
+ -> { "???".setbyte(-5, 97) }.should raise_error(IndexError)
end
it "sets a byte at an index greater than String size" do
@@ -78,11 +78,11 @@ describe "String#setbyte" do
it "raises a #{frozen_error_class} if self is frozen" do
str = "cold".freeze
str.frozen?.should be_true
- lambda { str.setbyte(3,96) }.should raise_error(frozen_error_class)
+ -> { str.setbyte(3,96) }.should raise_error(frozen_error_class)
end
it "raises a TypeError unless the second argument is an Integer" do
- lambda { "a".setbyte(0,'a') }.should raise_error(TypeError)
+ -> { "a".setbyte(0,'a') }.should raise_error(TypeError)
end
it "calls #to_int to convert the index" do
diff --git a/spec/ruby/core/string/shared/codepoints.rb b/spec/ruby/core/string/shared/codepoints.rb
index 84a0e3ae39..e94a57f48e 100644
--- a/spec/ruby/core/string/shared/codepoints.rb
+++ b/spec/ruby/core/string/shared/codepoints.rb
@@ -9,7 +9,7 @@ describe :string_codepoints, shared: true do
it "raises an ArgumentError when self has an invalid encoding and a method is called on the returned Enumerator" do
s = "\xDF".force_encoding(Encoding::UTF_8)
s.valid_encoding?.should be_false
- lambda { s.send(@method).to_a }.should raise_error(ArgumentError)
+ -> { s.send(@method).to_a }.should raise_error(ArgumentError)
end
it "yields each codepoint to the block if one is given" do
@@ -23,7 +23,7 @@ describe :string_codepoints, shared: true do
it "raises an ArgumentError if self's encoding is invalid and a block is given" do
s = "\xDF".force_encoding(Encoding::UTF_8)
s.valid_encoding?.should be_false
- lambda { s.send(@method) { } }.should raise_error(ArgumentError)
+ -> { s.send(@method) { } }.should raise_error(ArgumentError)
end
it "yields codepoints as Fixnums" do
diff --git a/spec/ruby/core/string/shared/concat.rb b/spec/ruby/core/string/shared/concat.rb
index 0a87410f2f..53a8bc23fb 100644
--- a/spec/ruby/core/string/shared/concat.rb
+++ b/spec/ruby/core/string/shared/concat.rb
@@ -13,16 +13,16 @@ describe :string_concat, shared: true do
end
it "raises a TypeError if the given argument can't be converted to a String" do
- lambda { 'hello '.send(@method, []) }.should raise_error(TypeError)
- lambda { 'hello '.send(@method, mock('x')) }.should raise_error(TypeError)
+ -> { 'hello '.send(@method, []) }.should raise_error(TypeError)
+ -> { 'hello '.send(@method, mock('x')) }.should raise_error(TypeError)
end
it "raises a #{frozen_error_class} when self is frozen" do
a = "hello"
a.freeze
- lambda { a.send(@method, "") }.should raise_error(frozen_error_class)
- lambda { a.send(@method, "test") }.should raise_error(frozen_error_class)
+ -> { a.send(@method, "") }.should raise_error(frozen_error_class)
+ -> { a.send(@method, "test") }.should raise_error(frozen_error_class)
end
it "returns a String when given a subclass instance" do
@@ -71,28 +71,28 @@ describe :string_concat, shared: true do
end
it "raises RangeError if the argument is an invalid codepoint for self's encoding" do
- lambda { "".encode(Encoding::US_ASCII).send(@method, 256) }.should raise_error(RangeError)
- lambda { "".encode(Encoding::EUC_JP).send(@method, 0x81) }.should raise_error(RangeError)
+ -> { "".encode(Encoding::US_ASCII).send(@method, 256) }.should raise_error(RangeError)
+ -> { "".encode(Encoding::EUC_JP).send(@method, 0x81) }.should raise_error(RangeError)
end
it "raises RangeError if the argument is negative" do
- lambda { "".send(@method, -200) }.should raise_error(RangeError)
- lambda { "".send(@method, -bignum_value) }.should raise_error(RangeError)
+ -> { "".send(@method, -200) }.should raise_error(RangeError)
+ -> { "".send(@method, -bignum_value) }.should raise_error(RangeError)
end
it "doesn't call to_int on its argument" do
x = mock('x')
x.should_not_receive(:to_int)
- lambda { "".send(@method, x) }.should raise_error(TypeError)
+ -> { "".send(@method, x) }.should raise_error(TypeError)
end
it "raises a #{frozen_error_class} when self is frozen" do
a = "hello"
a.freeze
- lambda { a.send(@method, 0) }.should raise_error(frozen_error_class)
- lambda { a.send(@method, 33) }.should raise_error(frozen_error_class)
+ -> { a.send(@method, 0) }.should raise_error(frozen_error_class)
+ -> { a.send(@method, 33) }.should raise_error(frozen_error_class)
end
end
end
@@ -112,7 +112,7 @@ describe :string_concat_encoding, shared: true do
end
it "raises Encoding::CompatibilityError if neither are empty" do
- lambda { "x".encode("UTF-16LE").send(@method, "y".encode("UTF-8")) }.should raise_error(Encoding::CompatibilityError)
+ -> { "x".encode("UTF-16LE").send(@method, "y".encode("UTF-8")) }.should raise_error(Encoding::CompatibilityError)
end
end
@@ -130,7 +130,7 @@ describe :string_concat_encoding, shared: true do
end
it "raises Encoding::CompatibilityError if neither are empty" do
- lambda { "x".encode("UTF-8").send(@method, "y".encode("UTF-16LE")) }.should raise_error(Encoding::CompatibilityError)
+ -> { "x".encode("UTF-8").send(@method, "y".encode("UTF-16LE")) }.should raise_error(Encoding::CompatibilityError)
end
end
@@ -148,7 +148,7 @@ describe :string_concat_encoding, shared: true do
end
it "raises Encoding::CompatibilityError if neither are ASCII-only" do
- lambda { "\u00E9".encode("UTF-8").send(@method, "\u00E9".encode("ISO-8859-1")) }.should raise_error(Encoding::CompatibilityError)
+ -> { "\u00E9".encode("UTF-8").send(@method, "\u00E9".encode("ISO-8859-1")) }.should raise_error(Encoding::CompatibilityError)
end
end
diff --git a/spec/ruby/core/string/shared/each_line.rb b/spec/ruby/core/string/shared/each_line.rb
index 86c966e50b..241a90eee3 100644
--- a/spec/ruby/core/string/shared/each_line.rb
+++ b/spec/ruby/core/string/shared/each_line.rb
@@ -133,8 +133,8 @@ describe :string_each_line, shared: true do
end
it "raises a TypeError when the separator can't be converted to a string" do
- lambda { "hello world".send(@method, false) {} }.should raise_error(TypeError)
- lambda { "hello world".send(@method, mock('x')) {} }.should raise_error(TypeError)
+ -> { "hello world".send(@method, false) {} }.should raise_error(TypeError)
+ -> { "hello world".send(@method, mock('x')) {} }.should raise_error(TypeError)
end
it "accepts a string separator" do
@@ -142,7 +142,7 @@ describe :string_each_line, shared: true do
end
it "raises a TypeError when the separator is a symbol" do
- lambda { "hello world".send(@method, :o).to_a }.should raise_error(TypeError)
+ -> { "hello world".send(@method, :o).to_a }.should raise_error(TypeError)
end
context "when `chomp` keyword argument is passed" do
diff --git a/spec/ruby/core/string/shared/encode.rb b/spec/ruby/core/string/shared/encode.rb
index d13db1945e..b5a8bf9b72 100644
--- a/spec/ruby/core/string/shared/encode.rb
+++ b/spec/ruby/core/string/shared/encode.rb
@@ -8,7 +8,7 @@ describe :string_encode, shared: true do
end
it "transcodes a 7-bit String despite no generic converting being available" do
- lambda do
+ -> do
Encoding::Converter.new Encoding::Emacs_Mule, Encoding::BINARY
end.should raise_error(Encoding::ConverterNotFoundError)
@@ -21,7 +21,7 @@ describe :string_encode, shared: true do
it "raises an Encoding::ConverterNotFoundError when no conversion is possible" do
Encoding.default_internal = Encoding::Emacs_Mule
str = [0x80].pack('C').force_encoding Encoding::BINARY
- lambda { str.send(@method) }.should raise_error(Encoding::ConverterNotFoundError)
+ -> { str.send(@method) }.should raise_error(Encoding::ConverterNotFoundError)
end
end
@@ -51,7 +51,7 @@ describe :string_encode, shared: true do
end
it "transcodes a 7-bit String despite no generic converting being available" do
- lambda do
+ -> do
Encoding::Converter.new Encoding::Emacs_Mule, Encoding::BINARY
end.should raise_error(Encoding::ConverterNotFoundError)
@@ -61,13 +61,13 @@ describe :string_encode, shared: true do
it "raises an Encoding::ConverterNotFoundError when no conversion is possible" do
str = [0x80].pack('C').force_encoding Encoding::BINARY
- lambda do
+ -> do
str.send(@method, Encoding::Emacs_Mule)
end.should raise_error(Encoding::ConverterNotFoundError)
end
it "raises an Encoding::ConverterNotFoundError for an invalid encoding" do
- lambda do
+ -> do
"abc".send(@method, "xyz")
end.should raise_error(Encoding::ConverterNotFoundError)
end
@@ -96,7 +96,7 @@ describe :string_encode, shared: true do
it "raises an Encoding::ConverterNotFoundError when no conversion is possible despite 'invalid: :replace, undef: :replace'" do
Encoding.default_internal = Encoding::Emacs_Mule
str = [0x80].pack('C').force_encoding Encoding::BINARY
- lambda do
+ -> do
str.send(@method, invalid: :replace, undef: :replace)
end.should raise_error(Encoding::ConverterNotFoundError)
end
@@ -242,6 +242,6 @@ describe :string_encode, shared: true do
end
it "raises ArgumentError if the value of the :xml option is not :text or :attr" do
- lambda { ''.send(@method, "UTF-8", xml: :other) }.should raise_error(ArgumentError)
+ -> { ''.send(@method, "UTF-8", xml: :other) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/string/shared/replace.rb b/spec/ruby/core/string/shared/replace.rb
index a583b88b5a..f13afb3f95 100644
--- a/spec/ruby/core/string/shared/replace.rb
+++ b/spec/ruby/core/string/shared/replace.rb
@@ -57,19 +57,19 @@ describe :string_replace, shared: true do
end
it "raises a TypeError if other can't be converted to string" do
- lambda { "hello".send(@method, 123) }.should raise_error(TypeError)
- lambda { "hello".send(@method, []) }.should raise_error(TypeError)
- lambda { "hello".send(@method, mock('x')) }.should raise_error(TypeError)
+ -> { "hello".send(@method, 123) }.should raise_error(TypeError)
+ -> { "hello".send(@method, []) }.should raise_error(TypeError)
+ -> { "hello".send(@method, mock('x')) }.should raise_error(TypeError)
end
it "raises a #{frozen_error_class} on a frozen instance that is modified" do
a = "hello".freeze
- lambda { a.send(@method, "world") }.should raise_error(frozen_error_class)
+ -> { a.send(@method, "world") }.should raise_error(frozen_error_class)
end
# see [ruby-core:23666]
it "raises a #{frozen_error_class} on a frozen instance when self-replacing" do
a = "hello".freeze
- lambda { a.send(@method, a) }.should raise_error(frozen_error_class)
+ -> { a.send(@method, a) }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/string/shared/slice.rb b/spec/ruby/core/string/shared/slice.rb
index 697fa2e530..ef7a8787ce 100644
--- a/spec/ruby/core/string/shared/slice.rb
+++ b/spec/ruby/core/string/shared/slice.rb
@@ -21,17 +21,17 @@ describe :string_slice, shared: true do
end
it "raises a TypeError if the given index is nil" do
- lambda { "hello".send(@method, nil) }.should raise_error(TypeError)
+ -> { "hello".send(@method, nil) }.should raise_error(TypeError)
end
it "raises a TypeError if the given index can't be converted to an Integer" do
- lambda { "hello".send(@method, mock('x')) }.should raise_error(TypeError)
- lambda { "hello".send(@method, {}) }.should raise_error(TypeError)
- lambda { "hello".send(@method, []) }.should raise_error(TypeError)
+ -> { "hello".send(@method, mock('x')) }.should raise_error(TypeError)
+ -> { "hello".send(@method, {}) }.should raise_error(TypeError)
+ -> { "hello".send(@method, []) }.should raise_error(TypeError)
end
it "raises a RangeError if the index is too big" do
- lambda { "hello".send(@method, bignum_value) }.should raise_error(RangeError)
+ -> { "hello".send(@method, bignum_value) }.should raise_error(RangeError)
end
end
@@ -140,23 +140,23 @@ describe :string_slice_index_length, shared: true do
end
it "raises a TypeError when idx or length can't be converted to an integer" do
- lambda { "hello".send(@method, mock('x'), 0) }.should raise_error(TypeError)
- lambda { "hello".send(@method, 0, mock('x')) }.should raise_error(TypeError)
+ -> { "hello".send(@method, mock('x'), 0) }.should raise_error(TypeError)
+ -> { "hello".send(@method, 0, mock('x')) }.should raise_error(TypeError)
# I'm deliberately including this here.
# It means that str.send(@method, other, idx) isn't supported.
- lambda { "hello".send(@method, "", 0) }.should raise_error(TypeError)
+ -> { "hello".send(@method, "", 0) }.should raise_error(TypeError)
end
it "raises a TypeError when the given index or the given length is nil" do
- lambda { "hello".send(@method, 1, nil) }.should raise_error(TypeError)
- lambda { "hello".send(@method, nil, 1) }.should raise_error(TypeError)
- lambda { "hello".send(@method, nil, nil) }.should raise_error(TypeError)
+ -> { "hello".send(@method, 1, nil) }.should raise_error(TypeError)
+ -> { "hello".send(@method, nil, 1) }.should raise_error(TypeError)
+ -> { "hello".send(@method, nil, nil) }.should raise_error(TypeError)
end
it "raises a RangeError if the index or length is too big" do
- lambda { "hello".send(@method, bignum_value, 1) }.should raise_error(RangeError)
- lambda { "hello".send(@method, 0, bignum_value) }.should raise_error(RangeError)
+ -> { "hello".send(@method, bignum_value, 1) }.should raise_error(RangeError)
+ -> { "hello".send(@method, 0, bignum_value) }.should raise_error(RangeError)
end
it "returns subclass instances" do
@@ -399,13 +399,13 @@ describe :string_slice_regexp_index, shared: true do
end
it "raises a TypeError when the given index can't be converted to Integer" do
- lambda { "hello".send(@method, /(.)(.)(.)/, mock('x')) }.should raise_error(TypeError)
- lambda { "hello".send(@method, /(.)(.)(.)/, {}) }.should raise_error(TypeError)
- lambda { "hello".send(@method, /(.)(.)(.)/, []) }.should raise_error(TypeError)
+ -> { "hello".send(@method, /(.)(.)(.)/, mock('x')) }.should raise_error(TypeError)
+ -> { "hello".send(@method, /(.)(.)(.)/, {}) }.should raise_error(TypeError)
+ -> { "hello".send(@method, /(.)(.)(.)/, []) }.should raise_error(TypeError)
end
it "raises a TypeError when the given index is nil" do
- lambda { "hello".send(@method, /(.)(.)(.)/, nil) }.should raise_error(TypeError)
+ -> { "hello".send(@method, /(.)(.)(.)/, nil) }.should raise_error(TypeError)
end
it "returns subclass instances" do
@@ -460,7 +460,7 @@ describe :string_slice_string, shared: true do
o = mock('x')
o.should_not_receive(:to_str)
- lambda { "hello".send(@method, o) }.should raise_error(TypeError)
+ -> { "hello".send(@method, o) }.should raise_error(TypeError)
end
it "returns a subclass instance when given a subclass instance" do
@@ -520,19 +520,19 @@ describe :string_slice_regexp_group, shared: true do
end
it "raises an IndexError if there is no capture for the given name" do
- lambda do
+ -> do
"hello there".send(@method, /[aeiou](.)\1/, 'non')
end.should raise_error(IndexError)
end
it "raises a TypeError when the given name is not a String" do
- lambda { "hello".send(@method, /(?<q>.)/, mock('x')) }.should raise_error(TypeError)
- lambda { "hello".send(@method, /(?<q>.)/, {}) }.should raise_error(TypeError)
- lambda { "hello".send(@method, /(?<q>.)/, []) }.should raise_error(TypeError)
+ -> { "hello".send(@method, /(?<q>.)/, mock('x')) }.should raise_error(TypeError)
+ -> { "hello".send(@method, /(?<q>.)/, {}) }.should raise_error(TypeError)
+ -> { "hello".send(@method, /(?<q>.)/, []) }.should raise_error(TypeError)
end
it "raises an IndexError when given the empty String as a group name" do
- lambda { "hello".send(@method, /(?<q>)/, '') }.should raise_error(IndexError)
+ -> { "hello".send(@method, /(?<q>)/, '') }.should raise_error(IndexError)
end
it "returns subclass instances" do
@@ -552,6 +552,6 @@ end
describe :string_slice_symbol, shared: true do
it "raises TypeError" do
- lambda { 'hello'.send(@method, :hello) }.should raise_error(TypeError)
+ -> { 'hello'.send(@method, :hello) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/string/shared/succ.rb b/spec/ruby/core/string/shared/succ.rb
index 0ab659864d..31b4a8b5dd 100644
--- a/spec/ruby/core/string/shared/succ.rb
+++ b/spec/ruby/core/string/shared/succ.rb
@@ -82,7 +82,7 @@ describe :string_succ_bang, shared: true do
end
it "raises a #{frozen_error_class} if self is frozen" do
- lambda { "".freeze.send(@method) }.should raise_error(frozen_error_class)
- lambda { "abcd".freeze.send(@method) }.should raise_error(frozen_error_class)
+ -> { "".freeze.send(@method) }.should raise_error(frozen_error_class)
+ -> { "abcd".freeze.send(@method) }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/string/slice_spec.rb b/spec/ruby/core/string/slice_spec.rb
index e969f85937..2af663117c 100644
--- a/spec/ruby/core/string/slice_spec.rb
+++ b/spec/ruby/core/string/slice_spec.rb
@@ -54,9 +54,9 @@ describe "String#slice! with index" do
end
it "raises a #{frozen_error_class} if self is frozen" do
- lambda { "hello".freeze.slice!(1) }.should raise_error(frozen_error_class)
- lambda { "hello".freeze.slice!(10) }.should raise_error(frozen_error_class)
- lambda { "".freeze.slice!(0) }.should raise_error(frozen_error_class)
+ -> { "hello".freeze.slice!(1) }.should raise_error(frozen_error_class)
+ -> { "hello".freeze.slice!(10) }.should raise_error(frozen_error_class)
+ -> { "".freeze.slice!(0) }.should raise_error(frozen_error_class)
end
it "calls to_int on index" do
@@ -118,13 +118,13 @@ describe "String#slice! with index, length" do
end
it "raises a #{frozen_error_class} if self is frozen" do
- lambda { "hello".freeze.slice!(1, 2) }.should raise_error(frozen_error_class)
- lambda { "hello".freeze.slice!(10, 3) }.should raise_error(frozen_error_class)
- lambda { "hello".freeze.slice!(-10, 3)}.should raise_error(frozen_error_class)
- lambda { "hello".freeze.slice!(4, -3) }.should raise_error(frozen_error_class)
- lambda { "hello".freeze.slice!(10, 3) }.should raise_error(frozen_error_class)
- lambda { "hello".freeze.slice!(-10, 3)}.should raise_error(frozen_error_class)
- lambda { "hello".freeze.slice!(4, -3) }.should raise_error(frozen_error_class)
+ -> { "hello".freeze.slice!(1, 2) }.should raise_error(frozen_error_class)
+ -> { "hello".freeze.slice!(10, 3) }.should raise_error(frozen_error_class)
+ -> { "hello".freeze.slice!(-10, 3)}.should raise_error(frozen_error_class)
+ -> { "hello".freeze.slice!(4, -3) }.should raise_error(frozen_error_class)
+ -> { "hello".freeze.slice!(10, 3) }.should raise_error(frozen_error_class)
+ -> { "hello".freeze.slice!(-10, 3)}.should raise_error(frozen_error_class)
+ -> { "hello".freeze.slice!(4, -3) }.should raise_error(frozen_error_class)
end
it "calls to_int on idx and length" do
@@ -245,12 +245,12 @@ describe "String#slice! Range" do
it "raises a #{frozen_error_class} on a frozen instance that is modified" do
- lambda { "hello".freeze.slice!(1..3) }.should raise_error(frozen_error_class)
+ -> { "hello".freeze.slice!(1..3) }.should raise_error(frozen_error_class)
end
# see redmine #1551
it "raises a #{frozen_error_class} on a frozen instance that would not be modified" do
- lambda { "hello".freeze.slice!(10..20)}.should raise_error(frozen_error_class)
+ -> { "hello".freeze.slice!(10..20)}.should raise_error(frozen_error_class)
end
end
@@ -313,11 +313,11 @@ describe "String#slice! with Regexp" do
end
it "raises a #{frozen_error_class} on a frozen instance that is modified" do
- lambda { "this is a string".freeze.slice!(/s.*t/) }.should raise_error(frozen_error_class)
+ -> { "this is a string".freeze.slice!(/s.*t/) }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} on a frozen instance that would not be modified" do
- lambda { "this is a string".freeze.slice!(/zzz/) }.should raise_error(frozen_error_class)
+ -> { "this is a string".freeze.slice!(/zzz/) }.should raise_error(frozen_error_class)
end
end
@@ -403,9 +403,9 @@ describe "String#slice! with Regexp, index" do
end
it "raises a #{frozen_error_class} if self is frozen" do
- lambda { "this is a string".freeze.slice!(/s.*t/) }.should raise_error(frozen_error_class)
- lambda { "this is a string".freeze.slice!(/zzz/, 0)}.should raise_error(frozen_error_class)
- lambda { "this is a string".freeze.slice!(/(.)/, 2)}.should raise_error(frozen_error_class)
+ -> { "this is a string".freeze.slice!(/s.*t/) }.should raise_error(frozen_error_class)
+ -> { "this is a string".freeze.slice!(/zzz/, 0)}.should raise_error(frozen_error_class)
+ -> { "this is a string".freeze.slice!(/(.)/, 2)}.should raise_error(frozen_error_class)
end
end
@@ -448,7 +448,7 @@ describe "String#slice! with String" do
o = mock('x')
o.should_not_receive(:to_str)
- lambda { "hello".slice!(o) }.should raise_error(TypeError)
+ -> { "hello".slice!(o) }.should raise_error(TypeError)
end
it "returns a subclass instance when given a subclass instance" do
@@ -459,8 +459,8 @@ describe "String#slice! with String" do
end
it "raises a #{frozen_error_class} if self is frozen" do
- lambda { "hello hello".freeze.slice!('llo') }.should raise_error(frozen_error_class)
- lambda { "this is a string".freeze.slice!('zzz')}.should raise_error(frozen_error_class)
- lambda { "this is a string".freeze.slice!('zzz')}.should raise_error(frozen_error_class)
+ -> { "hello hello".freeze.slice!('llo') }.should raise_error(frozen_error_class)
+ -> { "this is a string".freeze.slice!('zzz')}.should raise_error(frozen_error_class)
+ -> { "this is a string".freeze.slice!('zzz')}.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/string/split_spec.rb b/spec/ruby/core/string/split_spec.rb
index 6c666deb6c..655f0dae76 100644
--- a/spec/ruby/core/string/split_spec.rb
+++ b/spec/ruby/core/string/split_spec.rb
@@ -9,7 +9,7 @@ describe "String#split with String" do
broken_str.force_encoding('binary')
broken_str.chop!
broken_str.force_encoding('utf-8')
- lambda { str.split(broken_str) }.should raise_error(ArgumentError)
+ -> { str.split(broken_str) }.should raise_error(ArgumentError)
end
it "splits on multibyte characters" do
@@ -316,8 +316,8 @@ describe "String#split with Regexp" do
end
it "returns a type error if limit can't be converted to an integer" do
- lambda {"1.2.3.4".split(".", "three")}.should raise_error(TypeError)
- lambda {"1.2.3.4".split(".", nil) }.should raise_error(TypeError)
+ -> {"1.2.3.4".split(".", "three")}.should raise_error(TypeError)
+ -> {"1.2.3.4".split(".", nil) }.should raise_error(TypeError)
end
it "doesn't set $~" do
@@ -400,7 +400,7 @@ describe "String#split with Regexp" do
broken_str.force_encoding('binary')
broken_str.chop!
broken_str.force_encoding('utf-8')
- lambda{ broken_str.split(/\r\n|\r|\n/) }.should raise_error(ArgumentError)
+ ->{ broken_str.split(/\r\n|\r|\n/) }.should raise_error(ArgumentError)
end
ruby_version_is "2.6" do
diff --git a/spec/ruby/core/string/squeeze_spec.rb b/spec/ruby/core/string/squeeze_spec.rb
index 391b356227..bcc320bb5b 100644
--- a/spec/ruby/core/string/squeeze_spec.rb
+++ b/spec/ruby/core/string/squeeze_spec.rb
@@ -50,8 +50,8 @@ describe "String#squeeze" do
it "raises an ArgumentError when the parameter is out of sequence" do
s = "--subbookkeeper--"
- lambda { s.squeeze("e-b") }.should raise_error(ArgumentError)
- lambda { s.squeeze("^e-b") }.should raise_error(ArgumentError)
+ -> { s.squeeze("e-b") }.should raise_error(ArgumentError)
+ -> { s.squeeze("^e-b") }.should raise_error(ArgumentError)
end
it "taints the result when self is tainted" do
@@ -73,9 +73,9 @@ describe "String#squeeze" do
end
it "raises a TypeError when one set arg can't be converted to a string" do
- lambda { "hello world".squeeze([]) }.should raise_error(TypeError)
- lambda { "hello world".squeeze(Object.new)}.should raise_error(TypeError)
- lambda { "hello world".squeeze(mock('x')) }.should raise_error(TypeError)
+ -> { "hello world".squeeze([]) }.should raise_error(TypeError)
+ -> { "hello world".squeeze(Object.new)}.should raise_error(TypeError)
+ -> { "hello world".squeeze(mock('x')) }.should raise_error(TypeError)
end
it "returns subclass instances when called on a subclass" do
@@ -99,15 +99,15 @@ describe "String#squeeze!" do
it "raises an ArgumentError when the parameter is out of sequence" do
s = "--subbookkeeper--"
- lambda { s.squeeze!("e-b") }.should raise_error(ArgumentError)
- lambda { s.squeeze!("^e-b") }.should raise_error(ArgumentError)
+ -> { s.squeeze!("e-b") }.should raise_error(ArgumentError)
+ -> { s.squeeze!("^e-b") }.should raise_error(ArgumentError)
end
it "raises a #{frozen_error_class} when self is frozen" do
a = "yellow moon"
a.freeze
- lambda { a.squeeze!("") }.should raise_error(frozen_error_class)
- lambda { a.squeeze! }.should raise_error(frozen_error_class)
+ -> { a.squeeze!("") }.should raise_error(frozen_error_class)
+ -> { a.squeeze! }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/string/start_with_spec.rb b/spec/ruby/core/string/start_with_spec.rb
index 4e12c1a445..f66ec55266 100644
--- a/spec/ruby/core/string/start_with_spec.rb
+++ b/spec/ruby/core/string/start_with_spec.rb
@@ -28,9 +28,9 @@ describe "String#start_with?" do
it "ignores arguments not convertible to string" do
"hello".start_with?().should be_false
- lambda { "hello".start_with?(1) }.should raise_error(TypeError)
- lambda { "hello".start_with?(["h"]) }.should raise_error(TypeError)
- lambda { "hello".start_with?(1, nil, "h") }.should raise_error(TypeError)
+ -> { "hello".start_with?(1) }.should raise_error(TypeError)
+ -> { "hello".start_with?(["h"]) }.should raise_error(TypeError)
+ -> { "hello".start_with?(1, nil, "h") }.should raise_error(TypeError)
end
it "uses only the needed arguments" do
diff --git a/spec/ruby/core/string/strip_spec.rb b/spec/ruby/core/string/strip_spec.rb
index 54dec794fa..c205746483 100644
--- a/spec/ruby/core/string/strip_spec.rb
+++ b/spec/ruby/core/string/strip_spec.rb
@@ -49,12 +49,12 @@ describe "String#strip!" do
end
it "raises a #{frozen_error_class} on a frozen instance that is modified" do
- lambda { " hello ".freeze.strip! }.should raise_error(frozen_error_class)
+ -> { " hello ".freeze.strip! }.should raise_error(frozen_error_class)
end
# see #1552
it "raises a #{frozen_error_class} on a frozen instance that would not be modified" do
- lambda {"hello".freeze.strip! }.should raise_error(frozen_error_class)
- lambda {"".freeze.strip! }.should raise_error(frozen_error_class)
+ -> {"hello".freeze.strip! }.should raise_error(frozen_error_class)
+ -> {"".freeze.strip! }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/string/sub_spec.rb b/spec/ruby/core/string/sub_spec.rb
index 901d1596c5..630f0d6b70 100644
--- a/spec/ruby/core/string/sub_spec.rb
+++ b/spec/ruby/core/string/sub_spec.rb
@@ -166,16 +166,16 @@ describe "String#sub with pattern, replacement" do
not_supported_on :opal do
it "raises a TypeError when pattern is a Symbol" do
- lambda { "hello".sub(:woot, "x") }.should raise_error(TypeError)
+ -> { "hello".sub(:woot, "x") }.should raise_error(TypeError)
end
end
it "raises a TypeError when pattern is an Array" do
- lambda { "hello".sub([], "x") }.should raise_error(TypeError)
+ -> { "hello".sub([], "x") }.should raise_error(TypeError)
end
it "raises a TypeError when pattern can't be converted to a string" do
- lambda { "hello".sub(Object.new, nil) }.should raise_error(TypeError)
+ -> { "hello".sub(Object.new, nil) }.should raise_error(TypeError)
end
it "tries to convert replacement to a string using to_str" do
@@ -186,8 +186,8 @@ describe "String#sub with pattern, replacement" do
end
it "raises a TypeError when replacement can't be converted to a string" do
- lambda { "hello".sub(/[aeiou]/, []) }.should raise_error(TypeError)
- lambda { "hello".sub(/[aeiou]/, 99) }.should raise_error(TypeError)
+ -> { "hello".sub(/[aeiou]/, []) }.should raise_error(TypeError)
+ -> { "hello".sub(/[aeiou]/, 99) }.should raise_error(TypeError)
end
it "returns subclass instances when called on a subclass" do
@@ -330,9 +330,9 @@ describe "String#sub! with pattern, replacement" do
s = "hello"
s.freeze
- lambda { s.sub!(/ROAR/, "x") }.should raise_error(frozen_error_class)
- lambda { s.sub!(/e/, "e") }.should raise_error(frozen_error_class)
- lambda { s.sub!(/[aeiou]/, '*') }.should raise_error(frozen_error_class)
+ -> { s.sub!(/ROAR/, "x") }.should raise_error(frozen_error_class)
+ -> { s.sub!(/e/, "e") }.should raise_error(frozen_error_class)
+ -> { s.sub!(/[aeiou]/, '*') }.should raise_error(frozen_error_class)
end
end
@@ -376,16 +376,16 @@ describe "String#sub! with pattern and block" do
it "raises a RuntimeError if the string is modified while substituting" do
str = "hello"
- lambda { str.sub!(//) { str << 'x' } }.should raise_error(RuntimeError)
+ -> { str.sub!(//) { str << 'x' } }.should raise_error(RuntimeError)
end
it "raises a #{frozen_error_class} when self is frozen" do
s = "hello"
s.freeze
- lambda { s.sub!(/ROAR/) { "x" } }.should raise_error(frozen_error_class)
- lambda { s.sub!(/e/) { "e" } }.should raise_error(frozen_error_class)
- lambda { s.sub!(/[aeiou]/) { '*' } }.should raise_error(frozen_error_class)
+ -> { s.sub!(/ROAR/) { "x" } }.should raise_error(frozen_error_class)
+ -> { s.sub!(/e/) { "e" } }.should raise_error(frozen_error_class)
+ -> { s.sub!(/[aeiou]/) { '*' } }.should raise_error(frozen_error_class)
end
end
@@ -428,7 +428,7 @@ describe "String#sub with pattern and Hash" do
it "uses the hash's value set from default_proc for missing keys" do
hsh = {}
- hsh.default_proc = lambda { |k,v| 'lamb' }
+ hsh.default_proc = -> k, v { 'lamb' }
"food!".sub(/./, hsh).should == "lambood!"
end
@@ -513,7 +513,7 @@ describe "String#sub! with pattern and Hash" do
it "uses the hash's value set from default_proc for missing keys" do
hsh = {}
- hsh.default_proc = lambda { |k,v| 'lamb' }
+ hsh.default_proc = -> k, v { 'lamb' }
"food!".sub!(/./, hsh).should == "lambood!"
end
@@ -560,12 +560,12 @@ end
describe "String#sub with pattern and without replacement and block" do
it "raises a ArgumentError" do
- lambda { "abca".sub(/a/) }.should raise_error(ArgumentError)
+ -> { "abca".sub(/a/) }.should raise_error(ArgumentError)
end
end
describe "String#sub! with pattern and without replacement and block" do
it "raises a ArgumentError" do
- lambda { "abca".sub!(/a/) }.should raise_error(ArgumentError)
+ -> { "abca".sub!(/a/) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/string/swapcase_spec.rb b/spec/ruby/core/string/swapcase_spec.rb
index c35751859e..95edcec7d1 100644
--- a/spec/ruby/core/string/swapcase_spec.rb
+++ b/spec/ruby/core/string/swapcase_spec.rb
@@ -45,7 +45,7 @@ describe "String#swapcase" do
end
it "does not allow any other additional option" do
- lambda { "aiS".swapcase(:turkic, :ascii) }.should raise_error(ArgumentError)
+ -> { "aiS".swapcase(:turkic, :ascii) }.should raise_error(ArgumentError)
end
end
@@ -59,16 +59,16 @@ describe "String#swapcase" do
end
it "does not allow any other additional option" do
- lambda { "aiS".swapcase(:lithuanian, :ascii) }.should raise_error(ArgumentError)
+ -> { "aiS".swapcase(:lithuanian, :ascii) }.should raise_error(ArgumentError)
end
end
it "does not allow the :fold option for upcasing" do
- lambda { "abc".swapcase(:fold) }.should raise_error(ArgumentError)
+ -> { "abc".swapcase(:fold) }.should raise_error(ArgumentError)
end
it "does not allow invalid options" do
- lambda { "abc".swapcase(:invalid_option) }.should raise_error(ArgumentError)
+ -> { "abc".swapcase(:invalid_option) }.should raise_error(ArgumentError)
end
it "returns subclass instances when called on a subclass" do
@@ -124,7 +124,7 @@ describe "String#swapcase!" do
end
it "does not allow any other additional option" do
- lambda { a = "aiS"; a.swapcase!(:turkic, :ascii) }.should raise_error(ArgumentError)
+ -> { a = "aiS"; a.swapcase!(:turkic, :ascii) }.should raise_error(ArgumentError)
end
end
@@ -142,16 +142,16 @@ describe "String#swapcase!" do
end
it "does not allow any other additional option" do
- lambda { a = "aiS"; a.swapcase!(:lithuanian, :ascii) }.should raise_error(ArgumentError)
+ -> { a = "aiS"; a.swapcase!(:lithuanian, :ascii) }.should raise_error(ArgumentError)
end
end
it "does not allow the :fold option for upcasing" do
- lambda { a = "abc"; a.swapcase!(:fold) }.should raise_error(ArgumentError)
+ -> { a = "abc"; a.swapcase!(:fold) }.should raise_error(ArgumentError)
end
it "does not allow invalid options" do
- lambda { a = "abc"; a.swapcase!(:invalid_option) }.should raise_error(ArgumentError)
+ -> { a = "abc"; a.swapcase!(:invalid_option) }.should raise_error(ArgumentError)
end
it "returns nil if no modifications were made" do
@@ -165,7 +165,7 @@ describe "String#swapcase!" do
it "raises a #{frozen_error_class} when self is frozen" do
["", "hello"].each do |a|
a.freeze
- lambda { a.swapcase! }.should raise_error(frozen_error_class)
+ -> { a.swapcase! }.should raise_error(frozen_error_class)
end
end
end
diff --git a/spec/ruby/core/string/to_i_spec.rb b/spec/ruby/core/string/to_i_spec.rb
index f86d3a43a7..a37be47778 100644
--- a/spec/ruby/core/string/to_i_spec.rb
+++ b/spec/ruby/core/string/to_i_spec.rb
@@ -126,9 +126,9 @@ describe "String#to_i" do
end
it "raises an ArgumentError for illegal bases (1, < 0 or > 36)" do
- lambda { "".to_i(1) }.should raise_error(ArgumentError)
- lambda { "".to_i(-1) }.should raise_error(ArgumentError)
- lambda { "".to_i(37) }.should raise_error(ArgumentError)
+ -> { "".to_i(1) }.should raise_error(ArgumentError)
+ -> { "".to_i(-1) }.should raise_error(ArgumentError)
+ -> { "".to_i(37) }.should raise_error(ArgumentError)
end
it "returns a Fixnum for long strings with trailing spaces" do
diff --git a/spec/ruby/core/string/tr_s_spec.rb b/spec/ruby/core/string/tr_s_spec.rb
index b05211abc4..4380f2d548 100644
--- a/spec/ruby/core/string/tr_s_spec.rb
+++ b/spec/ruby/core/string/tr_s_spec.rb
@@ -127,8 +127,8 @@ describe "String#tr_s!" do
it "raises a #{frozen_error_class} if self is frozen" do
s = "hello".freeze
- lambda { s.tr_s!("el", "ar") }.should raise_error(frozen_error_class)
- lambda { s.tr_s!("l", "r") }.should raise_error(frozen_error_class)
- lambda { s.tr_s!("", "") }.should raise_error(frozen_error_class)
+ -> { s.tr_s!("el", "ar") }.should raise_error(frozen_error_class)
+ -> { s.tr_s!("l", "r") }.should raise_error(frozen_error_class)
+ -> { s.tr_s!("", "") }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/string/tr_spec.rb b/spec/ruby/core/string/tr_spec.rb
index 8a33dd24f5..721ebab51c 100644
--- a/spec/ruby/core/string/tr_spec.rb
+++ b/spec/ruby/core/string/tr_spec.rb
@@ -22,11 +22,11 @@ describe "String#tr" do
end
it "raises an ArgumentError a descending range in the replacement as containing just the start character" do
- lambda { "hello".tr("a-y", "z-b") }.should raise_error(ArgumentError)
+ -> { "hello".tr("a-y", "z-b") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError a descending range in the source as empty" do
- lambda { "hello".tr("l-a", "z") }.should raise_error(ArgumentError)
+ -> { "hello".tr("l-a", "z") }.should raise_error(ArgumentError)
end
it "translates chars not in from_string when it starts with a ^" do
@@ -122,8 +122,8 @@ describe "String#tr!" do
it "raises a #{frozen_error_class} if self is frozen" do
s = "abcdefghijklmnopqR".freeze
- lambda { s.tr!("cdefg", "12") }.should raise_error(frozen_error_class)
- lambda { s.tr!("R", "S") }.should raise_error(frozen_error_class)
- lambda { s.tr!("", "") }.should raise_error(frozen_error_class)
+ -> { s.tr!("cdefg", "12") }.should raise_error(frozen_error_class)
+ -> { s.tr!("R", "S") }.should raise_error(frozen_error_class)
+ -> { s.tr!("", "") }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/string/try_convert_spec.rb b/spec/ruby/core/string/try_convert_spec.rb
index 629817110e..84415c4a75 100644
--- a/spec/ruby/core/string/try_convert_spec.rb
+++ b/spec/ruby/core/string/try_convert_spec.rb
@@ -39,12 +39,12 @@ describe "String.try_convert" do
it "sends #to_str to the argument and raises TypeError if it's not a kind of String" do
obj = mock("to_str")
obj.should_receive(:to_str).and_return(Object.new)
- lambda { String.try_convert obj }.should raise_error(TypeError)
+ -> { String.try_convert obj }.should raise_error(TypeError)
end
it "does not rescue exceptions raised by #to_str" do
obj = mock("to_str")
obj.should_receive(:to_str).and_raise(RuntimeError)
- lambda { String.try_convert obj }.should raise_error(RuntimeError)
+ -> { String.try_convert obj }.should raise_error(RuntimeError)
end
end
diff --git a/spec/ruby/core/string/unicode_normalize_spec.rb b/spec/ruby/core/string/unicode_normalize_spec.rb
index 7a4662e0b8..6de7533fc7 100644
--- a/spec/ruby/core/string/unicode_normalize_spec.rb
+++ b/spec/ruby/core/string/unicode_normalize_spec.rb
@@ -48,13 +48,13 @@ describe "String#unicode_normalize" do
end
it "raises an Encoding::CompatibilityError if string is not in an unicode encoding" do
- lambda do
+ -> do
[0xE0].pack('C').force_encoding("ISO-8859-1").unicode_normalize(:nfd)
end.should raise_error(Encoding::CompatibilityError)
end
it "raises an ArgumentError if the specified form is invalid" do
- lambda {
+ -> {
@angstrom.unicode_normalize(:invalid_form)
}.should raise_error(ArgumentError)
end
@@ -101,14 +101,14 @@ describe "String#unicode_normalize!" do
end
it "raises an Encoding::CompatibilityError if the string is not in an unicode encoding" do
- lambda {
+ -> {
[0xE0].pack('C').force_encoding("ISO-8859-1").unicode_normalize!
}.should raise_error(Encoding::CompatibilityError)
end
it "raises an ArgumentError if the specified form is invalid" do
ohm = "\u2126"
- lambda {
+ -> {
ohm.unicode_normalize!(:invalid_form)
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/core/string/unicode_normalized_spec.rb b/spec/ruby/core/string/unicode_normalized_spec.rb
index d383c0a91e..25c810a98f 100644
--- a/spec/ruby/core/string/unicode_normalized_spec.rb
+++ b/spec/ruby/core/string/unicode_normalized_spec.rb
@@ -37,11 +37,11 @@ describe "String#unicode_normalized?" do
end
it "raises an Encoding::CompatibilityError if the string is not in an unicode encoding" do
- lambda { @nfc_normalized_str.force_encoding("ISO-8859-1").unicode_normalized? }.should raise_error(Encoding::CompatibilityError)
+ -> { @nfc_normalized_str.force_encoding("ISO-8859-1").unicode_normalized? }.should raise_error(Encoding::CompatibilityError)
end
it "raises an ArgumentError if the specified form is invalid" do
- lambda { @nfc_normalized_str.unicode_normalized?(:invalid_form) }.should raise_error(ArgumentError)
+ -> { @nfc_normalized_str.unicode_normalized?(:invalid_form) }.should raise_error(ArgumentError)
end
it "returns true if str is in Unicode normalization form (nfc)" do
diff --git a/spec/ruby/core/string/unpack/at_spec.rb b/spec/ruby/core/string/unpack/at_spec.rb
index d8e55a1020..70b2389d69 100644
--- a/spec/ruby/core/string/unpack/at_spec.rb
+++ b/spec/ruby/core/string/unpack/at_spec.rb
@@ -24,6 +24,6 @@ describe "String#unpack with format '@'" do
end
it "raises an ArgumentError if the count exceeds the size of the String" do
- lambda { "\x01\x02\x03\x04".unpack("C2@5C") }.should raise_error(ArgumentError)
+ -> { "\x01\x02\x03\x04".unpack("C2@5C") }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/string/unpack/p_spec.rb b/spec/ruby/core/string/unpack/p_spec.rb
index 136e32adfd..a544bc29c1 100644
--- a/spec/ruby/core/string/unpack/p_spec.rb
+++ b/spec/ruby/core/string/unpack/p_spec.rb
@@ -15,7 +15,7 @@ describe "String#unpack with format 'P'" do
packed = ["hello"].pack("P")
packed.unpack("P5").should == ["hello"]
packed.dup.unpack("P5").should == ["hello"]
- lambda { packed.to_sym.to_s.unpack("P5") }.should raise_error(ArgumentError, /no associated pointer/)
+ -> { packed.to_sym.to_s.unpack("P5") }.should raise_error(ArgumentError, /no associated pointer/)
end
it "taints the unpacked string" do
@@ -43,7 +43,7 @@ describe "String#unpack with format 'p'" do
packed = ["hello"].pack("p")
packed.unpack("p").should == ["hello"]
packed.dup.unpack("p").should == ["hello"]
- lambda { packed.to_sym.to_s.unpack("p") }.should raise_error(ArgumentError, /no associated pointer/)
+ -> { packed.to_sym.to_s.unpack("p") }.should raise_error(ArgumentError, /no associated pointer/)
end
it "taints the unpacked string" do
diff --git a/spec/ruby/core/string/unpack/percent_spec.rb b/spec/ruby/core/string/unpack/percent_spec.rb
index f0684d4cbc..0e27663195 100644
--- a/spec/ruby/core/string/unpack/percent_spec.rb
+++ b/spec/ruby/core/string/unpack/percent_spec.rb
@@ -2,6 +2,6 @@ require_relative '../../../spec_helper'
describe "String#unpack with format '%'" do
it "raises an Argument Error" do
- lambda { "abc".unpack("%") }.should raise_error(ArgumentError)
+ -> { "abc".unpack("%") }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/string/unpack/shared/basic.rb b/spec/ruby/core/string/unpack/shared/basic.rb
index 0ecbf615af..332e39d8d1 100644
--- a/spec/ruby/core/string/unpack/shared/basic.rb
+++ b/spec/ruby/core/string/unpack/shared/basic.rb
@@ -10,20 +10,20 @@ describe :string_unpack_basic, shared: true do
end
it "raises a TypeError when passed nil" do
- lambda { "abc".unpack(nil) }.should raise_error(TypeError)
+ -> { "abc".unpack(nil) }.should raise_error(TypeError)
end
it "raises a TypeError when passed an Integer" do
- lambda { "abc".unpack(1) }.should raise_error(TypeError)
+ -> { "abc".unpack(1) }.should raise_error(TypeError)
end
end
describe :string_unpack_no_platform, shared: true do
it "raises an ArgumentError when the format modifier is '_'" do
- lambda { "abcdefgh".unpack(unpack_format("_")) }.should raise_error(ArgumentError)
+ -> { "abcdefgh".unpack(unpack_format("_")) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the format modifier is '!'" do
- lambda { "abcdefgh".unpack(unpack_format("!")) }.should raise_error(ArgumentError)
+ -> { "abcdefgh".unpack(unpack_format("!")) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/string/unpack/u_spec.rb b/spec/ruby/core/string/unpack/u_spec.rb
index 8db6de1ab3..7845e6d5f2 100644
--- a/spec/ruby/core/string/unpack/u_spec.rb
+++ b/spec/ruby/core/string/unpack/u_spec.rb
@@ -12,11 +12,11 @@ describe "String#unpack with format 'U'" do
it_behaves_like :string_unpack_taint, 'U'
it "raises ArgumentError on a malformed byte sequence" do
- lambda { "\xE3".unpack('U') }.should raise_error(ArgumentError)
+ -> { "\xE3".unpack('U') }.should raise_error(ArgumentError)
end
it "raises ArgumentError on a malformed byte sequence and doesn't continue when used with the * modifier" do
- lambda { "\xE3".unpack('U*') }.should raise_error(ArgumentError)
+ -> { "\xE3".unpack('U*') }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/string/unpack/x_spec.rb b/spec/ruby/core/string/unpack/x_spec.rb
index 5adcb720d1..5e248de77e 100644
--- a/spec/ruby/core/string/unpack/x_spec.rb
+++ b/spec/ruby/core/string/unpack/x_spec.rb
@@ -24,11 +24,11 @@ describe "String#unpack with format 'X'" do
end
it "raises an ArgumentError when passed the '*' modifier if the remaining bytes exceed the bytes from the index to the start of the String" do
- lambda { "abcd".unpack("CX*C") }.should raise_error(ArgumentError)
+ -> { "abcd".unpack("CX*C") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if the count exceeds the bytes from current index to the start of the String" do
- lambda { "\x01\x02\x03\x04".unpack("C3X4C") }.should raise_error(ArgumentError)
+ -> { "\x01\x02\x03\x04".unpack("C3X4C") }.should raise_error(ArgumentError)
end
end
@@ -57,6 +57,6 @@ describe "String#unpack with format 'x'" do
end
it "raises an ArgumentError if the count exceeds the size of the String" do
- lambda { "\x01\x02\x03\x04".unpack("C2x3C") }.should raise_error(ArgumentError)
+ -> { "\x01\x02\x03\x04".unpack("C2x3C") }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/string/upcase_spec.rb b/spec/ruby/core/string/upcase_spec.rb
index eb736ebfa1..72aacd88a9 100644
--- a/spec/ruby/core/string/upcase_spec.rb
+++ b/spec/ruby/core/string/upcase_spec.rb
@@ -39,7 +39,7 @@ describe "String#upcase" do
end
it "does not allow any other additional option" do
- lambda { "i".upcase(:turkic, :ascii) }.should raise_error(ArgumentError)
+ -> { "i".upcase(:turkic, :ascii) }.should raise_error(ArgumentError)
end
end
@@ -53,16 +53,16 @@ describe "String#upcase" do
end
it "does not allow any other additional option" do
- lambda { "iß".upcase(:lithuanian, :ascii) }.should raise_error(ArgumentError)
+ -> { "iß".upcase(:lithuanian, :ascii) }.should raise_error(ArgumentError)
end
end
it "does not allow the :fold option for upcasing" do
- lambda { "abc".upcase(:fold) }.should raise_error(ArgumentError)
+ -> { "abc".upcase(:fold) }.should raise_error(ArgumentError)
end
it "does not allow invalid options" do
- lambda { "abc".upcase(:invalid_option) }.should raise_error(ArgumentError)
+ -> { "abc".upcase(:invalid_option) }.should raise_error(ArgumentError)
end
it "taints result when self is tainted" do
@@ -123,7 +123,7 @@ describe "String#upcase!" do
end
it "does not allow any other additional option" do
- lambda { a = "i"; a.upcase!(:turkic, :ascii) }.should raise_error(ArgumentError)
+ -> { a = "i"; a.upcase!(:turkic, :ascii) }.should raise_error(ArgumentError)
end
end
@@ -141,16 +141,16 @@ describe "String#upcase!" do
end
it "does not allow any other additional option" do
- lambda { a = "iß"; a.upcase!(:lithuanian, :ascii) }.should raise_error(ArgumentError)
+ -> { a = "iß"; a.upcase!(:lithuanian, :ascii) }.should raise_error(ArgumentError)
end
end
it "does not allow the :fold option for upcasing" do
- lambda { a = "abc"; a.upcase!(:fold) }.should raise_error(ArgumentError)
+ -> { a = "abc"; a.upcase!(:fold) }.should raise_error(ArgumentError)
end
it "does not allow invalid options" do
- lambda { a = "abc"; a.upcase!(:invalid_option) }.should raise_error(ArgumentError)
+ -> { a = "abc"; a.upcase!(:invalid_option) }.should raise_error(ArgumentError)
end
it "returns nil if no modifications were made" do
@@ -160,7 +160,7 @@ describe "String#upcase!" do
end
it "raises a #{frozen_error_class} when self is frozen" do
- lambda { "HeLlo".freeze.upcase! }.should raise_error(frozen_error_class)
- lambda { "HELLO".freeze.upcase! }.should raise_error(frozen_error_class)
+ -> { "HeLlo".freeze.upcase! }.should raise_error(frozen_error_class)
+ -> { "HELLO".freeze.upcase! }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/string/upto_spec.rb b/spec/ruby/core/string/upto_spec.rb
index 3748a6fdeb..b988613a80 100644
--- a/spec/ruby/core/string/upto_spec.rb
+++ b/spec/ruby/core/string/upto_spec.rb
@@ -53,13 +53,13 @@ describe "String#upto" do
end
it "raises a TypeError if other can't be converted to a string" do
- lambda { "abc".upto(123) { } }.should raise_error(TypeError)
- lambda { "abc".upto(mock('x')){ } }.should raise_error(TypeError)
+ -> { "abc".upto(123) { } }.should raise_error(TypeError)
+ -> { "abc".upto(mock('x')){ } }.should raise_error(TypeError)
end
it "does not work with symbols" do
- lambda { "a".upto(:c).to_a }.should raise_error(TypeError)
+ -> { "a".upto(:c).to_a }.should raise_error(TypeError)
end
it "returns non-alphabetic characters in the ASCII range for single letters" do
diff --git a/spec/ruby/core/struct/dig_spec.rb b/spec/ruby/core/struct/dig_spec.rb
index c7c979fabe..4e39e5a4ef 100644
--- a/spec/ruby/core/struct/dig_spec.rb
+++ b/spec/ruby/core/struct/dig_spec.rb
@@ -20,13 +20,13 @@ describe "Struct#dig" do
it "raises a TypeError if any intermediate step does not respond to #dig" do
instance = @klass.new(1)
- lambda {
+ -> {
instance.dig(:a, 3)
}.should raise_error(TypeError)
end
it "raises an ArgumentError if no arguments provided" do
- lambda { @instance.dig }.should raise_error(ArgumentError)
+ -> { @instance.dig }.should raise_error(ArgumentError)
end
it "calls #dig on any intermediate step with the rest of the sequence as arguments" do
diff --git a/spec/ruby/core/struct/element_reference_spec.rb b/spec/ruby/core/struct/element_reference_spec.rb
index 28706a65aa..0f6d547f66 100644
--- a/spec/ruby/core/struct/element_reference_spec.rb
+++ b/spec/ruby/core/struct/element_reference_spec.rb
@@ -26,20 +26,20 @@ describe "Struct#[]" do
it "fails when it does not know about the requested attribute" do
car = StructClasses::Car.new('Ford', 'Ranger')
- lambda { car[3] }.should raise_error(IndexError)
- lambda { car[-4] }.should raise_error(IndexError)
- lambda { car[:body] }.should raise_error(NameError)
- lambda { car['wheels'] }.should raise_error(NameError)
+ -> { car[3] }.should raise_error(IndexError)
+ -> { car[-4] }.should raise_error(IndexError)
+ -> { car[:body] }.should raise_error(NameError)
+ -> { car['wheels'] }.should raise_error(NameError)
end
it "fails if passed too many arguments" do
car = StructClasses::Car.new('Ford', 'Ranger')
- lambda { car[:make, :model] }.should raise_error(ArgumentError)
+ -> { car[:make, :model] }.should raise_error(ArgumentError)
end
it "fails if not passed a string, symbol, or integer" do
car = StructClasses::Car.new('Ford', 'Ranger')
- lambda { car[Object.new] }.should raise_error(TypeError)
+ -> { car[Object.new] }.should raise_error(TypeError)
end
it "returns attribute names that contain hyphens" do
diff --git a/spec/ruby/core/struct/element_set_spec.rb b/spec/ruby/core/struct/element_set_spec.rb
index 246e7cf3c2..6ba7b081a9 100644
--- a/spec/ruby/core/struct/element_set_spec.rb
+++ b/spec/ruby/core/struct/element_set_spec.rb
@@ -21,9 +21,9 @@ describe "Struct#[]=" do
it "fails when trying to assign attributes which don't exist" do
car = StructClasses::Car.new('Ford', 'Ranger')
- lambda { car[:something] = true }.should raise_error(NameError)
- lambda { car[3] = true }.should raise_error(IndexError)
- lambda { car[-4] = true }.should raise_error(IndexError)
- lambda { car[Object.new] = true }.should raise_error(TypeError)
+ -> { car[:something] = true }.should raise_error(NameError)
+ -> { car[3] = true }.should raise_error(IndexError)
+ -> { car[-4] = true }.should raise_error(IndexError)
+ -> { car[Object.new] = true }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/struct/new_spec.rb b/spec/ruby/core/struct/new_spec.rb
index 01231e85fb..f888106950 100644
--- a/spec/ruby/core/struct/new_spec.rb
+++ b/spec/ruby/core/struct/new_spec.rb
@@ -13,7 +13,7 @@ describe "Struct.new" do
first.should == Struct::Person
second = nil
- lambda {
+ -> {
second = Struct.new('Person', :hair, :sex)
}.should complain(/redefining constant/)
second.should == Struct::Person
@@ -49,35 +49,35 @@ describe "Struct.new" do
it "fails with invalid constant name as first argument" do
- lambda { Struct.new('animal', :name, :legs, :eyeballs) }.should raise_error(NameError)
+ -> { Struct.new('animal', :name, :legs, :eyeballs) }.should raise_error(NameError)
end
it "raises a TypeError if object doesn't respond to to_sym" do
- lambda { Struct.new(:animal, mock('giraffe')) }.should raise_error(TypeError)
- lambda { Struct.new(:animal, 1.0) }.should raise_error(TypeError)
- lambda { Struct.new(:animal, Time.now) }.should raise_error(TypeError)
- lambda { Struct.new(:animal, Class) }.should raise_error(TypeError)
- lambda { Struct.new(:animal, nil) }.should raise_error(TypeError)
- lambda { Struct.new(:animal, true) }.should raise_error(TypeError)
- lambda { Struct.new(:animal, ['chris', 'evan']) }.should raise_error(TypeError)
+ -> { Struct.new(:animal, mock('giraffe')) }.should raise_error(TypeError)
+ -> { Struct.new(:animal, 1.0) }.should raise_error(TypeError)
+ -> { Struct.new(:animal, Time.now) }.should raise_error(TypeError)
+ -> { Struct.new(:animal, Class) }.should raise_error(TypeError)
+ -> { Struct.new(:animal, nil) }.should raise_error(TypeError)
+ -> { Struct.new(:animal, true) }.should raise_error(TypeError)
+ -> { Struct.new(:animal, ['chris', 'evan']) }.should raise_error(TypeError)
end
ruby_version_is ""..."2.5" do
it "raises a TypeError if an argument is a Hash" do
- lambda { Struct.new(:animal, { name: 'chris' }) }.should raise_error(TypeError)
+ -> { Struct.new(:animal, { name: 'chris' }) }.should raise_error(TypeError)
end
end
ruby_version_is "2.5" do
it "raises a ArgumentError if passed a Hash with an unknown key" do
- lambda { Struct.new(:animal, { name: 'chris' }) }.should raise_error(ArgumentError)
+ -> { Struct.new(:animal, { name: 'chris' }) }.should raise_error(ArgumentError)
end
end
it "raises a TypeError if object is not a Symbol" do
obj = mock(':ruby')
def obj.to_sym() :ruby end
- lambda { Struct.new(:animal, obj) }.should raise_error(TypeError)
+ -> { Struct.new(:animal, obj) }.should raise_error(TypeError)
end
it "processes passed block with instance_eval" do
@@ -128,7 +128,7 @@ describe "Struct.new" do
end
it "fails with too many arguments" do
- lambda { StructClasses::Ruby.new('2.0', 'i686', true) }.should raise_error(ArgumentError)
+ -> { StructClasses::Ruby.new('2.0', 'i686', true) }.should raise_error(ArgumentError)
end
it "passes a hash as a normal argument" do
diff --git a/spec/ruby/core/struct/struct_spec.rb b/spec/ruby/core/struct/struct_spec.rb
index 11e619dcde..8817dc1a58 100644
--- a/spec/ruby/core/struct/struct_spec.rb
+++ b/spec/ruby/core/struct/struct_spec.rb
@@ -21,7 +21,7 @@ describe "Struct anonymous class instance methods" do
it "reader method should not interfere with undefined methods" do
car = StructClasses::Car.new('Ford', 'Ranger')
- lambda { car.something_weird }.should raise_error(NoMethodError)
+ -> { car.something_weird }.should raise_error(NoMethodError)
end
it "writer method be a synonym for []=" do
diff --git a/spec/ruby/core/struct/values_at_spec.rb b/spec/ruby/core/struct/values_at_spec.rb
index f9602d53f7..7e517cdb4b 100644
--- a/spec/ruby/core/struct/values_at_spec.rb
+++ b/spec/ruby/core/struct/values_at_spec.rb
@@ -11,6 +11,6 @@ describe "Struct#values_at" do
it "fails when passed unsupported types" do
car = StructClasses::Car.new('Ford', 'Ranger')
- lambda { car.values_at('make') }.should raise_error(TypeError)
+ -> { car.values_at('make') }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/symbol/shared/slice.rb b/spec/ruby/core/symbol/shared/slice.rb
index 80e1fd3ddc..478e0d80ae 100644
--- a/spec/ruby/core/symbol/shared/slice.rb
+++ b/spec/ruby/core/symbol/shared/slice.rb
@@ -74,21 +74,21 @@ describe :symbol_slice, shared: true do
describe "and a nil length" do
it "raises a TypeError" do
- lambda { :symbol.send(@method, 1,nil) }.should raise_error(TypeError)
+ -> { :symbol.send(@method, 1,nil) }.should raise_error(TypeError)
end
end
describe "and a length that cannot be converted into an Integer" do
it "raises a TypeError when given an Array" do
- lambda { :symbol.send(@method, 1,Array.new) }.should raise_error(TypeError)
+ -> { :symbol.send(@method, 1,Array.new) }.should raise_error(TypeError)
end
it "raises a TypeError when given an Hash" do
- lambda { :symbol.send(@method, 1,Hash.new) }.should raise_error(TypeError)
+ -> { :symbol.send(@method, 1,Hash.new) }.should raise_error(TypeError)
end
it "raises a TypeError when given an Object" do
- lambda { :symbol.send(@method, 1,Object.new) }.should raise_error(TypeError)
+ -> { :symbol.send(@method, 1,Object.new) }.should raise_error(TypeError)
end
end
end
@@ -101,21 +101,21 @@ describe :symbol_slice, shared: true do
describe "with a nil index" do
it "raises a TypeError" do
- lambda { :symbol.send(@method, nil) }.should raise_error(TypeError)
+ -> { :symbol.send(@method, nil) }.should raise_error(TypeError)
end
end
describe "with an index that cannot be converted into an Integer" do
it "raises a TypeError when given an Array" do
- lambda { :symbol.send(@method, Array.new) }.should raise_error(TypeError)
+ -> { :symbol.send(@method, Array.new) }.should raise_error(TypeError)
end
it "raises a TypeError when given an Hash" do
- lambda { :symbol.send(@method, Hash.new) }.should raise_error(TypeError)
+ -> { :symbol.send(@method, Hash.new) }.should raise_error(TypeError)
end
it "raises a TypeError when given an Object" do
- lambda { :symbol.send(@method, Object.new) }.should raise_error(TypeError)
+ -> { :symbol.send(@method, Object.new) }.should raise_error(TypeError)
end
end
@@ -229,20 +229,20 @@ describe :symbol_slice, shared: true do
describe "and an index that cannot be converted to an Integer" do
it "raises a TypeError when given an Hash" do
- lambda { :symbol.send(@method, /(sy)(mb)(ol)/, Hash.new) }.should raise_error(TypeError)
+ -> { :symbol.send(@method, /(sy)(mb)(ol)/, Hash.new) }.should raise_error(TypeError)
end
it "raises a TypeError when given an Array" do
- lambda { :symbol.send(@method, /(sy)(mb)(ol)/, Array.new) }.should raise_error(TypeError)
+ -> { :symbol.send(@method, /(sy)(mb)(ol)/, Array.new) }.should raise_error(TypeError)
end
it "raises a TypeError when given an Object" do
- lambda { :symbol.send(@method, /(sy)(mb)(ol)/, Object.new) }.should raise_error(TypeError)
+ -> { :symbol.send(@method, /(sy)(mb)(ol)/, Object.new) }.should raise_error(TypeError)
end
end
it "raises a TypeError if the index is nil" do
- lambda { :symbol.send(@method, /(sy)(mb)(ol)/, nil) }.should raise_error(TypeError)
+ -> { :symbol.send(@method, /(sy)(mb)(ol)/, nil) }.should raise_error(TypeError)
end
it "sets $~ to the MatchData if there is a match" do
diff --git a/spec/ruby/core/symbol/symbol_spec.rb b/spec/ruby/core/symbol/symbol_spec.rb
index 56ce6f4a42..cefe70bc99 100644
--- a/spec/ruby/core/symbol/symbol_spec.rb
+++ b/spec/ruby/core/symbol/symbol_spec.rb
@@ -6,13 +6,13 @@ describe "Symbol" do
end
it ".allocate raises a TypeError" do
- lambda do
+ -> do
Symbol.allocate
end.should raise_error(TypeError)
end
it ".new is undefined" do
- lambda do
+ -> do
Symbol.new
end.should raise_error(NoMethodError)
end
diff --git a/spec/ruby/core/symbol/to_proc_spec.rb b/spec/ruby/core/symbol/to_proc_spec.rb
index 65f6e27be4..60e33d7cb8 100644
--- a/spec/ruby/core/symbol/to_proc_spec.rb
+++ b/spec/ruby/core/symbol/to_proc_spec.rb
@@ -18,7 +18,7 @@ describe "Symbol#to_proc" do
end
it "raises an ArgumentError when calling #call on the Proc without receiver" do
- lambda { :object_id.to_proc.call }.should raise_error(ArgumentError, "no receiver given")
+ -> { :object_id.to_proc.call }.should raise_error(ArgumentError, "no receiver given")
end
it "produces a proc that always returns [[:rest]] for #parameters" do
diff --git a/spec/ruby/core/thread/abort_on_exception_spec.rb b/spec/ruby/core/thread/abort_on_exception_spec.rb
index 88de77b1a8..34b648ca0f 100644
--- a/spec/ruby/core/thread/abort_on_exception_spec.rb
+++ b/spec/ruby/core/thread/abort_on_exception_spec.rb
@@ -35,7 +35,7 @@ describe :thread_abort_on_exception, shared: true do
ScratchPad << :before
@thread.abort_on_exception = true if @object
- lambda do
+ -> do
ThreadSpecs.state = :run
# Wait for the main thread to be interrupted
sleep
diff --git a/spec/ruby/core/thread/allocate_spec.rb b/spec/ruby/core/thread/allocate_spec.rb
index cd9aa1ee43..cfd556812f 100644
--- a/spec/ruby/core/thread/allocate_spec.rb
+++ b/spec/ruby/core/thread/allocate_spec.rb
@@ -2,7 +2,7 @@ require_relative '../../spec_helper'
describe "Thread.allocate" do
it "raises a TypeError" do
- lambda {
+ -> {
Thread.allocate
}.should raise_error(TypeError)
end
diff --git a/spec/ruby/core/thread/backtrace/location/fixtures/main.rb b/spec/ruby/core/thread/backtrace/location/fixtures/main.rb
index d2d14ac957..bde208a059 100644
--- a/spec/ruby/core/thread/backtrace/location/fixtures/main.rb
+++ b/spec/ruby/core/thread/backtrace/location/fixtures/main.rb
@@ -1,5 +1,5 @@
-def example
+def backtrace_location_example
caller_locations[0].path
end
-print example
+print backtrace_location_example
diff --git a/spec/ruby/core/thread/element_reference_spec.rb b/spec/ruby/core/thread/element_reference_spec.rb
index 4de33e1456..85280cb287 100644
--- a/spec/ruby/core/thread/element_reference_spec.rb
+++ b/spec/ruby/core/thread/element_reference_spec.rb
@@ -38,7 +38,7 @@ describe "Thread#[]" do
end
it "raises exceptions on the wrong type of keys" do
- lambda { Thread.current[nil] }.should raise_error(TypeError)
- lambda { Thread.current[5] }.should raise_error(TypeError)
+ -> { Thread.current[nil] }.should raise_error(TypeError)
+ -> { Thread.current[5] }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/thread/element_set_spec.rb b/spec/ruby/core/thread/element_set_spec.rb
index c109468a5e..d974b5e1c7 100644
--- a/spec/ruby/core/thread/element_set_spec.rb
+++ b/spec/ruby/core/thread/element_set_spec.rb
@@ -17,8 +17,8 @@ describe "Thread#[]=" do
end
it "raises exceptions on the wrong type of keys" do
- lambda { Thread.current[nil] = true }.should raise_error(TypeError)
- lambda { Thread.current[5] = true }.should raise_error(TypeError)
+ -> { Thread.current[nil] = true }.should raise_error(TypeError)
+ -> { Thread.current[5] = true }.should raise_error(TypeError)
end
it "is not shared across fibers" do
diff --git a/spec/ruby/core/thread/exclusive_spec.rb b/spec/ruby/core/thread/exclusive_spec.rb
index 9de427fb52..a96ebe749d 100644
--- a/spec/ruby/core/thread/exclusive_spec.rb
+++ b/spec/ruby/core/thread/exclusive_spec.rb
@@ -28,7 +28,7 @@ describe "Thread.exclusive" do
q1.pop.should == :ready
- lambda { Thread.exclusive { } }.should block_caller
+ -> { Thread.exclusive { } }.should block_caller
q2.push :done
t.join
@@ -36,7 +36,7 @@ describe "Thread.exclusive" do
it "is not recursive" do
Thread.exclusive do
- lambda { Thread.exclusive { } }.should raise_error(ThreadError)
+ -> { Thread.exclusive { } }.should raise_error(ThreadError)
end
end
end
diff --git a/spec/ruby/core/thread/fixtures/classes.rb b/spec/ruby/core/thread/fixtures/classes.rb
index 601e515e3e..c1f15935ee 100644
--- a/spec/ruby/core/thread/fixtures/classes.rb
+++ b/spec/ruby/core/thread/fixtures/classes.rb
@@ -1,10 +1,3 @@
-unless defined? Channel
- require 'thread'
- class Channel < Queue
- alias receive shift
- end
-end
-
module ThreadSpecs
class SubThread < Thread
@@ -188,7 +181,7 @@ module ThreadSpecs
def self.join_dying_thread_with_outer_ensure(kill_method_name=:kill)
t = dying_thread_with_outer_ensure(kill_method_name) { yield }
- lambda { t.join }.should raise_error(RuntimeError, "In dying thread")
+ -> { t.join }.should raise_error(RuntimeError, "In dying thread")
return t
end
diff --git a/spec/ruby/core/thread/initialize_spec.rb b/spec/ruby/core/thread/initialize_spec.rb
index 80e058a120..4fca900cd8 100644
--- a/spec/ruby/core/thread/initialize_spec.rb
+++ b/spec/ruby/core/thread/initialize_spec.rb
@@ -15,7 +15,7 @@ describe "Thread#initialize" do
end
it "raises a ThreadError" do
- lambda {
+ -> {
@t.instance_eval do
initialize {}
end
diff --git a/spec/ruby/core/thread/join_spec.rb b/spec/ruby/core/thread/join_spec.rb
index f60f91e436..f3c5cdc1ed 100644
--- a/spec/ruby/core/thread/join_spec.rb
+++ b/spec/ruby/core/thread/join_spec.rb
@@ -19,28 +19,28 @@ describe "Thread#join" do
t.join(0).should equal(t)
t.join(0.0).should equal(t)
t.join(nil).should equal(t)
- lambda { t.join(:foo) }.should raise_error TypeError
- lambda { t.join("bar") }.should raise_error TypeError
+ -> { t.join(:foo) }.should raise_error TypeError
+ -> { t.join("bar") }.should raise_error TypeError
end
it "returns nil if it is not finished when given a timeout" do
- c = Channel.new
- t = Thread.new { c.receive }
+ q = Queue.new
+ t = Thread.new { q.pop }
begin
t.join(0).should == nil
ensure
- c << true
+ q << true
end
t.join.should == t
end
it "accepts a floating point timeout length" do
- c = Channel.new
- t = Thread.new { c.receive }
+ q = Queue.new
+ t = Thread.new { q.pop }
begin
t.join(0.01).should == nil
ensure
- c << true
+ q << true
end
t.join.should == t
end
@@ -50,7 +50,7 @@ describe "Thread#join" do
Thread.current.report_on_exception = false
raise NotImplementedError.new("Just kidding")
}
- lambda { t.join }.should raise_error(NotImplementedError)
+ -> { t.join }.should raise_error(NotImplementedError)
end
it "returns the dead thread" do
@@ -60,6 +60,6 @@ describe "Thread#join" do
it "raises any uncaught exception encountered in ensure block" do
t = ThreadSpecs.dying_thread_ensures { raise NotImplementedError.new("Just kidding") }
- lambda { t.join }.should raise_error(NotImplementedError)
+ -> { t.join }.should raise_error(NotImplementedError)
end
end
diff --git a/spec/ruby/core/thread/key_spec.rb b/spec/ruby/core/thread/key_spec.rb
index c4ed0f9c0d..6940cf5f28 100644
--- a/spec/ruby/core/thread/key_spec.rb
+++ b/spec/ruby/core/thread/key_spec.rb
@@ -17,8 +17,8 @@ describe "Thread#key?" do
end
it "raises exceptions on the wrong type of keys" do
- lambda { Thread.current.key? nil }.should raise_error(TypeError)
- lambda { Thread.current.key? 5 }.should raise_error(TypeError)
+ -> { Thread.current.key? nil }.should raise_error(TypeError)
+ -> { Thread.current.key? 5 }.should raise_error(TypeError)
end
it "is not shared across fibers" do
diff --git a/spec/ruby/core/thread/list_spec.rb b/spec/ruby/core/thread/list_spec.rb
index 80dd15c6ca..a0bf831856 100644
--- a/spec/ruby/core/thread/list_spec.rb
+++ b/spec/ruby/core/thread/list_spec.rb
@@ -25,13 +25,13 @@ describe "Thread.list" do
end
it "includes waiting threads" do
- c = Channel.new
- t = Thread.new { c.receive }
+ q = Queue.new
+ t = Thread.new { q.pop }
begin
Thread.pass while t.status and t.status != 'sleep'
Thread.list.should include(t)
ensure
- c << nil
+ q << nil
t.join
end
end
diff --git a/spec/ruby/core/thread/name_spec.rb b/spec/ruby/core/thread/name_spec.rb
index adb2d08fae..9b3d2f4b09 100644
--- a/spec/ruby/core/thread/name_spec.rb
+++ b/spec/ruby/core/thread/name_spec.rb
@@ -34,7 +34,7 @@ describe "Thread#name=" do
end
it "raises an ArgumentError if the name includes a null byte" do
- lambda {
+ -> {
@thread.name = "new thread\0name"
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/core/thread/new_spec.rb b/spec/ruby/core/thread/new_spec.rb
index 80929035c7..3a57149381 100644
--- a/spec/ruby/core/thread/new_spec.rb
+++ b/spec/ruby/core/thread/new_spec.rb
@@ -3,10 +3,10 @@ require_relative 'fixtures/classes'
describe "Thread.new" do
it "creates a thread executing the given block" do
- c = Channel.new
- Thread.new { c << true }.join
- c << false
- c.receive.should == true
+ q = Queue.new
+ Thread.new { q << true }.join
+ q << false
+ q.pop.should == true
end
it "can pass arguments to the thread block" do
@@ -18,7 +18,7 @@ describe "Thread.new" do
end
it "raises an exception when not given a block" do
- lambda { Thread.new }.should raise_error(ThreadError)
+ -> { Thread.new }.should raise_error(ThreadError)
end
it "creates a subclass of thread calls super with a block in initialize" do
@@ -34,7 +34,7 @@ describe "Thread.new" do
end
end
- lambda {
+ -> {
c.new
}.should raise_error(ThreadError)
end
diff --git a/spec/ruby/core/thread/priority_spec.rb b/spec/ruby/core/thread/priority_spec.rb
index 5da6216b53..e13ad478b5 100644
--- a/spec/ruby/core/thread/priority_spec.rb
+++ b/spec/ruby/core/thread/priority_spec.rb
@@ -59,7 +59,7 @@ describe "Thread#priority=" do
describe "when set with a non-integer" do
it "raises a type error" do
- lambda{ @thread.priority = Object.new }.should raise_error(TypeError)
+ ->{ @thread.priority = Object.new }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/thread/shared/exit.rb b/spec/ruby/core/thread/shared/exit.rb
index 4686b7b28b..40dc478947 100644
--- a/spec/ruby/core/thread/shared/exit.rb
+++ b/spec/ruby/core/thread/shared/exit.rb
@@ -116,7 +116,7 @@ describe :thread_exit, shared: true do
it "propagates inner exception to Thread.join if there is an outer ensure clause" do
thread = ThreadSpecs.dying_thread_with_outer_ensure(@method) { }
- lambda { thread.join }.should raise_error(RuntimeError, "In dying thread")
+ -> { thread.join }.should raise_error(RuntimeError, "In dying thread")
end
it "runs all outer ensure clauses even if inner ensure clause raises exception" do
diff --git a/spec/ruby/core/thread/shared/start.rb b/spec/ruby/core/thread/shared/start.rb
index 80ce063a0e..2ba926bf00 100644
--- a/spec/ruby/core/thread/shared/start.rb
+++ b/spec/ruby/core/thread/shared/start.rb
@@ -4,7 +4,7 @@ describe :thread_start, shared: true do
end
it "raises an ArgumentError if not passed a block" do
- lambda {
+ -> {
Thread.send(@method)
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/core/thread/shared/wakeup.rb b/spec/ruby/core/thread/shared/wakeup.rb
index 71838d88e5..f111edf0fd 100644
--- a/spec/ruby/core/thread/shared/wakeup.rb
+++ b/spec/ruby/core/thread/shared/wakeup.rb
@@ -56,6 +56,6 @@ describe :thread_wakeup, shared: true do
it "raises a ThreadError when trying to wake up a dead thread" do
t = Thread.new { 1 }
t.join
- lambda { t.send @method }.should raise_error(ThreadError)
+ -> { t.send @method }.should raise_error(ThreadError)
end
end
diff --git a/spec/ruby/core/thread/value_spec.rb b/spec/ruby/core/thread/value_spec.rb
index 30b12db125..30e43abd1a 100644
--- a/spec/ruby/core/thread/value_spec.rb
+++ b/spec/ruby/core/thread/value_spec.rb
@@ -11,11 +11,21 @@ describe "Thread#value" do
Thread.current.report_on_exception = false
raise "Hello"
}
- lambda { t.value }.should raise_error(RuntimeError, "Hello")
+ -> { t.value }.should raise_error(RuntimeError, "Hello")
end
it "is nil for a killed thread" do
t = Thread.new { Thread.current.exit }
t.value.should == nil
end
+
+ it "returns when the thread finished" do
+ q = Queue.new
+ t = Thread.new {
+ q.pop
+ }
+ -> { t.value }.should block_caller
+ q.push :result
+ t.value.should == :result
+ end
end
diff --git a/spec/ruby/core/threadgroup/add_spec.rb b/spec/ruby/core/threadgroup/add_spec.rb
index 5d1354e65f..2921c1ab22 100644
--- a/spec/ruby/core/threadgroup/add_spec.rb
+++ b/spec/ruby/core/threadgroup/add_spec.rb
@@ -1,15 +1,14 @@
require_relative '../../spec_helper'
-require_relative 'fixtures/classes'
describe "ThreadGroup#add" do
before :each do
- @chan1,@chan2 = Channel.new,Channel.new
- @thread = Thread.new { @chan1 << :go; @chan2.receive }
- @chan1.receive
+ @q1, @q2 = Queue.new, Queue.new
+ @thread = Thread.new { @q1 << :go; @q2.pop }
+ @q1.pop
end
after :each do
- @chan2 << :done
+ @q2 << :done
@thread.join
end
diff --git a/spec/ruby/core/threadgroup/enclose_spec.rb b/spec/ruby/core/threadgroup/enclose_spec.rb
index d4a4359c66..dd9a7a362d 100644
--- a/spec/ruby/core/threadgroup/enclose_spec.rb
+++ b/spec/ruby/core/threadgroup/enclose_spec.rb
@@ -1,15 +1,14 @@
require_relative '../../spec_helper'
-require_relative 'fixtures/classes'
describe "ThreadGroup#enclose" do
before :each do
- @chan1,@chan2 = Channel.new,Channel.new
- @thread = Thread.new { @chan1 << :go; @chan2.receive }
- @chan1.receive
+ @q1, @q2 = Queue.new, Queue.new
+ @thread = Thread.new { @q1 << :go; @q2.pop }
+ @q1.pop
end
after :each do
- @chan2 << :done
+ @q2 << :done
@thread.join
end
@@ -18,7 +17,7 @@ describe "ThreadGroup#enclose" do
default_group = @thread.group
thread_group.add(@thread)
thread_group.enclose
- lambda do
+ -> do
default_group.add(@thread)
end.should raise_error(ThreadError)
end
diff --git a/spec/ruby/core/threadgroup/fixtures/classes.rb b/spec/ruby/core/threadgroup/fixtures/classes.rb
deleted file mode 100644
index 7dfe5e92d1..0000000000
--- a/spec/ruby/core/threadgroup/fixtures/classes.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-unless defined? Channel
- require 'thread'
- class Channel < Queue
- alias receive shift
- end
-end
diff --git a/spec/ruby/core/threadgroup/list_spec.rb b/spec/ruby/core/threadgroup/list_spec.rb
index 5f2281af8d..b2ac64324a 100644
--- a/spec/ruby/core/threadgroup/list_spec.rb
+++ b/spec/ruby/core/threadgroup/list_spec.rb
@@ -1,17 +1,16 @@
require_relative '../../spec_helper'
-require_relative 'fixtures/classes'
describe "ThreadGroup#list" do
it "returns the list of threads in the group" do
- chan = Channel.new
- th1 = Thread.new { chan << :go; sleep }
- chan.receive.should == :go
+ q = Queue.new
+ th1 = Thread.new { q << :go; sleep }
+ q.pop.should == :go
tg = ThreadGroup.new
tg.add(th1)
tg.list.should include(th1)
- th2 = Thread.new { chan << :go; sleep }
- chan.receive.should == :go
+ th2 = Thread.new { q << :go; sleep }
+ q.pop.should == :go
tg.add(th2)
(tg.list & [th1, th2]).should include(th1, th2)
diff --git a/spec/ruby/core/time/at_spec.rb b/spec/ruby/core/time/at_spec.rb
index 1493012676..592b331a28 100644
--- a/spec/ruby/core/time/at_spec.rb
+++ b/spec/ruby/core/time/at_spec.rb
@@ -71,11 +71,11 @@ describe "Time.at" do
describe "passed non-Time, non-Numeric" do
it "raises a TypeError with a String argument" do
- lambda { Time.at("0") }.should raise_error(TypeError)
+ -> { Time.at("0") }.should raise_error(TypeError)
end
it "raises a TypeError with a nil argument" do
- lambda { Time.at(nil) }.should raise_error(TypeError)
+ -> { Time.at(nil) }.should raise_error(TypeError)
end
describe "with an argument that responds to #to_int" do
@@ -127,20 +127,20 @@ describe "Time.at" do
describe "passed [Integer, nil]" do
it "raises a TypeError" do
- lambda { Time.at(0, nil) }.should raise_error(TypeError)
+ -> { Time.at(0, nil) }.should raise_error(TypeError)
end
end
describe "passed [Integer, String]" do
it "raises a TypeError" do
- lambda { Time.at(0, "0") }.should raise_error(TypeError)
+ -> { Time.at(0, "0") }.should raise_error(TypeError)
end
end
describe "passed [Time, Integer]" do
# #8173
it "raises a TypeError" do
- lambda { Time.at(Time.now, 500000) }.should raise_error(TypeError)
+ -> { Time.at(Time.now, 500000) }.should raise_error(TypeError)
end
end
@@ -178,15 +178,15 @@ describe "Time.at" do
context "not supported format" do
it "raises ArgumentError" do
- ->() { Time.at(0, 123456, 2) }.should raise_error(ArgumentError)
- ->() { Time.at(0, 123456, nil) }.should raise_error(ArgumentError)
- ->() { Time.at(0, 123456, :invalid) }.should raise_error(ArgumentError)
+ -> { Time.at(0, 123456, 2) }.should raise_error(ArgumentError)
+ -> { Time.at(0, 123456, nil) }.should raise_error(ArgumentError)
+ -> { Time.at(0, 123456, :invalid) }.should raise_error(ArgumentError)
end
it "does not try to convert format to Symbol with #to_sym" do
format = "usec"
format.should_not_receive(:to_sym)
- -> () { Time.at(0, 123456, format) }.should raise_error(ArgumentError)
+ -> { Time.at(0, 123456, format) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/time/getlocal_spec.rb b/spec/ruby/core/time/getlocal_spec.rb
index 8b6a21bb58..7196577dab 100644
--- a/spec/ruby/core/time/getlocal_spec.rb
+++ b/spec/ruby/core/time/getlocal_spec.rb
@@ -77,24 +77,24 @@ describe "Time#getlocal" do
it "raises ArgumentError if the String argument is not of the form (+|-)HH:MM" do
t = Time.now
- lambda { t.getlocal("3600") }.should raise_error(ArgumentError)
+ -> { t.getlocal("3600") }.should raise_error(ArgumentError)
end
it "raises ArgumentError if the String argument is not in an ASCII-compatible encoding" do
t = Time.now
- lambda { t.getlocal("-01:00".encode("UTF-16LE")) }.should raise_error(ArgumentError)
+ -> { t.getlocal("-01:00".encode("UTF-16LE")) }.should raise_error(ArgumentError)
end
it "raises ArgumentError if the argument represents a value less than or equal to -86400 seconds" do
t = Time.new
t.getlocal(-86400 + 1).utc_offset.should == (-86400 + 1)
- lambda { t.getlocal(-86400) }.should raise_error(ArgumentError)
+ -> { t.getlocal(-86400) }.should raise_error(ArgumentError)
end
it "raises ArgumentError if the argument represents a value greater than or equal to 86400 seconds" do
t = Time.new
t.getlocal(86400 - 1).utc_offset.should == (86400 - 1)
- lambda { t.getlocal(86400) }.should raise_error(ArgumentError)
+ -> { t.getlocal(86400) }.should raise_error(ArgumentError)
end
ruby_version_is "2.6" do
@@ -116,7 +116,7 @@ describe "Time#getlocal" do
time
end
- lambda {
+ -> {
Time.utc(2000, 1, 1, 12, 0, 0).getlocal(zone).should be_kind_of(Time)
}.should_not raise_error
end
@@ -127,7 +127,7 @@ describe "Time#getlocal" do
time
end
- lambda {
+ -> {
Time.utc(2000, 1, 1, 12, 0, 0).getlocal(zone)
}.should raise_error(TypeError, /can't convert \w+ into an exact number/)
end
@@ -138,7 +138,7 @@ describe "Time#getlocal" do
time
end
- lambda {
+ -> {
Time.utc(2000, 1, 1, 12, 0, 0).getlocal(zone).should be_kind_of(Time)
}.should_not raise_error
end
@@ -158,7 +158,7 @@ describe "Time#getlocal" do
[Object.new, [], {}, :"some zone"].each do |zone|
time = TimeSpecs::TimeWithFindTimezone.utc(2000, 1, 1, 12, 0, 0)
- lambda {
+ -> {
time.getlocal(zone)
}.should raise_error(TypeError, /can't convert \w+ into an exact number/)
end
diff --git a/spec/ruby/core/time/localtime_spec.rb b/spec/ruby/core/time/localtime_spec.rb
index 7942653c78..2975e112d0 100644
--- a/spec/ruby/core/time/localtime_spec.rb
+++ b/spec/ruby/core/time/localtime_spec.rb
@@ -32,7 +32,7 @@ describe "Time#localtime" do
it "raises a RuntimeError if the time has a different time zone" do
time = Time.gm(2007, 1, 9, 12, 0, 0)
time.freeze
- lambda { time.localtime }.should raise_error(RuntimeError)
+ -> { time.localtime }.should raise_error(RuntimeError)
end
end
@@ -118,23 +118,23 @@ describe "Time#localtime" do
it "raises ArgumentError if the String argument is not of the form (+|-)HH:MM" do
t = Time.now
- lambda { t.localtime("3600") }.should raise_error(ArgumentError)
+ -> { t.localtime("3600") }.should raise_error(ArgumentError)
end
it "raises ArgumentError if the String argument is not in an ASCII-compatible encoding" do
t = Time.now
- lambda { t.localtime("-01:00".encode("UTF-16LE")) }.should raise_error(ArgumentError)
+ -> { t.localtime("-01:00".encode("UTF-16LE")) }.should raise_error(ArgumentError)
end
it "raises ArgumentError if the argument represents a value less than or equal to -86400 seconds" do
t = Time.new
t.localtime(-86400 + 1).utc_offset.should == (-86400 + 1)
- lambda { t.localtime(-86400) }.should raise_error(ArgumentError)
+ -> { t.localtime(-86400) }.should raise_error(ArgumentError)
end
it "raises ArgumentError if the argument represents a value greater than or equal to 86400 seconds" do
t = Time.new
t.localtime(86400 - 1).utc_offset.should == (86400 - 1)
- lambda { t.localtime(86400) }.should raise_error(ArgumentError)
+ -> { t.localtime(86400) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/time/minus_spec.rb b/spec/ruby/core/time/minus_spec.rb
index a47e726196..e0fbf94cb0 100644
--- a/spec/ruby/core/time/minus_spec.rb
+++ b/spec/ruby/core/time/minus_spec.rb
@@ -20,18 +20,18 @@ describe "Time#-" do
end
it "raises a TypeError if given argument is a coercible String" do
- lambda { Time.now - "1" }.should raise_error(TypeError)
- lambda { Time.now - "0.1" }.should raise_error(TypeError)
- lambda { Time.now - "1/3" }.should raise_error(TypeError)
+ -> { Time.now - "1" }.should raise_error(TypeError)
+ -> { Time.now - "0.1" }.should raise_error(TypeError)
+ -> { Time.now - "1/3" }.should raise_error(TypeError)
end
it "raises TypeError on argument that can't be coerced" do
- lambda { Time.now - Object.new }.should raise_error(TypeError)
- lambda { Time.now - "stuff" }.should raise_error(TypeError)
+ -> { Time.now - Object.new }.should raise_error(TypeError)
+ -> { Time.now - "stuff" }.should raise_error(TypeError)
end
it "raises TypeError on nil argument" do
- lambda { Time.now - nil }.should raise_error(TypeError)
+ -> { Time.now - nil }.should raise_error(TypeError)
end
it "tracks microseconds" do
diff --git a/spec/ruby/core/time/new_spec.rb b/spec/ruby/core/time/new_spec.rb
index fe0e1aea31..84e97f8082 100644
--- a/spec/ruby/core/time/new_spec.rb
+++ b/spec/ruby/core/time/new_spec.rb
@@ -76,42 +76,42 @@ describe "Time.new with a utc_offset argument" do
# [Bug #8679], r47676
it "disallows a value for minutes greater than 59" do
- lambda {
+ -> {
Time.new(2000, 1, 1, 0, 0, 0, "+01:60")
}.should raise_error(ArgumentError)
- lambda {
+ -> {
Time.new(2000, 1, 1, 0, 0, 0, "+01:99")
}.should raise_error(ArgumentError)
end
it "raises ArgumentError if the String argument is not of the form (+|-)HH:MM" do
- lambda { Time.new(2000, 1, 1, 0, 0, 0, "3600") }.should raise_error(ArgumentError)
+ -> { Time.new(2000, 1, 1, 0, 0, 0, "3600") }.should raise_error(ArgumentError)
end
it "raises ArgumentError if the hour value is greater than 23" do
- lambda { Time.new(2000, 1, 1, 0, 0, 0, "+24:00") }.should raise_error(ArgumentError)
+ -> { Time.new(2000, 1, 1, 0, 0, 0, "+24:00") }.should raise_error(ArgumentError)
end
it "raises ArgumentError if the String argument is not in an ASCII-compatible encoding" do
- lambda { Time.new(2000, 1, 1, 0, 0, 0, "-04:10".encode("UTF-16LE")) }.should raise_error(ArgumentError)
+ -> { Time.new(2000, 1, 1, 0, 0, 0, "-04:10".encode("UTF-16LE")) }.should raise_error(ArgumentError)
end
it "raises ArgumentError if the argument represents a value less than or equal to -86400 seconds" do
Time.new(2000, 1, 1, 0, 0, 0, -86400 + 1).utc_offset.should == (-86400 + 1)
- lambda { Time.new(2000, 1, 1, 0, 0, 0, -86400) }.should raise_error(ArgumentError)
+ -> { Time.new(2000, 1, 1, 0, 0, 0, -86400) }.should raise_error(ArgumentError)
end
it "raises ArgumentError if the argument represents a value greater than or equal to 86400 seconds" do
Time.new(2000, 1, 1, 0, 0, 0, 86400 - 1).utc_offset.should == (86400 - 1)
- lambda { Time.new(2000, 1, 1, 0, 0, 0, 86400) }.should raise_error(ArgumentError)
+ -> { Time.new(2000, 1, 1, 0, 0, 0, 86400) }.should raise_error(ArgumentError)
end
it "raises ArgumentError if the seconds argument is negative" do
- lambda { Time.new(2000, 1, 1, 0, 0, -1) }.should raise_error(ArgumentError)
+ -> { Time.new(2000, 1, 1, 0, 0, -1) }.should raise_error(ArgumentError)
end
it "raises ArgumentError if the utc_offset argument is greater than or equal to 10e9" do
- lambda { Time.new(2000, 1, 1, 0, 0, 0, 1000000000) }.should raise_error(ArgumentError)
+ -> { Time.new(2000, 1, 1, 0, 0, 0, 1000000000) }.should raise_error(ArgumentError)
end
end
@@ -134,7 +134,7 @@ ruby_version_is "2.6" do
time
end
- lambda {
+ -> {
Time.new(2000, 1, 1, 12, 0, 0, zone).should be_kind_of(Time)
}.should_not raise_error
end
@@ -145,7 +145,7 @@ ruby_version_is "2.6" do
time
end
- lambda {
+ -> {
Time.new(2000, 1, 1, 12, 0, 0, zone)
}.should raise_error(TypeError, /can't convert \w+ into an exact number/)
end
@@ -156,7 +156,7 @@ ruby_version_is "2.6" do
time
end
- lambda {
+ -> {
Time.new(2000, 1, 1, 12, 0, 0, zone).should be_kind_of(Time)
}.should_not raise_error
end
@@ -170,7 +170,7 @@ ruby_version_is "2.6" do
Time.utc(t.year, t.mon, t.day, t.hour - 1, t.min, t.sec)
end
- lambda {
+ -> {
Time.new(2000, 1, 1, 12, 0, 0, zone).should be_kind_of(Time)
Time.new(2000, 1, 1, 12, 0, 0, zone).utc_offset.should == 60*60
}.should_not raise_error
@@ -182,7 +182,7 @@ ruby_version_is "2.6" do
Class.new(Time).utc(t.year, t.mon, t.day, t.hour - 1, t.min, t.sec)
end
- lambda {
+ -> {
Time.new(2000, 1, 1, 12, 0, 0, zone).should be_kind_of(Time)
Time.new(2000, 1, 1, 12, 0, 0, zone).utc_offset.should == 60*60
}.should_not raise_error
@@ -194,7 +194,7 @@ ruby_version_is "2.6" do
Struct.new(:to_i).new(time.to_i - 60*60)
end
- lambda {
+ -> {
Time.new(2000, 1, 1, 12, 0, 0, zone).should be_kind_of(Time)
Time.new(2000, 1, 1, 12, 0, 0, zone).utc_offset.should == 60*60
}.should_not raise_error
@@ -220,7 +220,7 @@ ruby_version_is "2.6" do
Time.utc(t.year, t.mon, t.day + 1, t.hour, t.min, t.sec)
end
- lambda {
+ -> {
Time.new(2000, 1, 1, 12, 0, 0, zone)
}.should raise_error(ArgumentError, "utc_offset out of range")
end
@@ -277,7 +277,7 @@ ruby_version_is "2.6" do
zone = TimeSpecs::Timezone.new(offset: (5*3600+30*60))
time = Time.new(2000, 1, 1, 12, 0, 0, zone)
- lambda {
+ -> {
Marshal.dump(time)
}.should raise_error(NoMethodError, /undefined method `name' for/)
end
@@ -317,7 +317,7 @@ ruby_version_is "2.6" do
it "does not call .find_timezone if passed any not string/numeric/timezone timezone argument" do
[Object.new, [], {}, :"some zone"].each do |zone|
- lambda {
+ -> {
TimeSpecs::TimeWithFindTimezone.new(2000, 1, 1, 12, 0, 0, zone)
}.should raise_error(TypeError, /can't convert \w+ into an exact number/)
end
diff --git a/spec/ruby/core/time/plus_spec.rb b/spec/ruby/core/time/plus_spec.rb
index 91713b84b3..0a9984f180 100644
--- a/spec/ruby/core/time/plus_spec.rb
+++ b/spec/ruby/core/time/plus_spec.rb
@@ -17,9 +17,9 @@ describe "Time#+" do
end
it "raises a TypeError if given argument is a coercible String" do
- lambda { Time.now + "1" }.should raise_error(TypeError)
- lambda { Time.now + "0.1" }.should raise_error(TypeError)
- lambda { Time.now + "1/3" }.should raise_error(TypeError)
+ -> { Time.now + "1" }.should raise_error(TypeError)
+ -> { Time.now + "0.1" }.should raise_error(TypeError)
+ -> { Time.now + "1/3" }.should raise_error(TypeError)
end
it "increments the time by the specified amount as rational numbers" do
@@ -32,8 +32,8 @@ describe "Time#+" do
end
it "raises TypeError on argument that can't be coerced into Rational" do
- lambda { Time.now + Object.new }.should raise_error(TypeError)
- lambda { Time.now + "stuff" }.should raise_error(TypeError)
+ -> { Time.now + Object.new }.should raise_error(TypeError)
+ -> { Time.now + "stuff" }.should raise_error(TypeError)
end
it "returns a UTC time if self is UTC" do
@@ -74,11 +74,11 @@ describe "Time#+" do
end
it "raises TypeError on Time argument" do
- lambda { Time.now + Time.now }.should raise_error(TypeError)
+ -> { Time.now + Time.now }.should raise_error(TypeError)
end
it "raises TypeError on nil argument" do
- lambda { Time.now + nil }.should raise_error(TypeError)
+ -> { Time.now + nil }.should raise_error(TypeError)
end
#see [ruby-dev:38446]
diff --git a/spec/ruby/core/time/shared/gmtime.rb b/spec/ruby/core/time/shared/gmtime.rb
index e684a1fd95..5ed64c2ab6 100644
--- a/spec/ruby/core/time/shared/gmtime.rb
+++ b/spec/ruby/core/time/shared/gmtime.rb
@@ -26,7 +26,7 @@ describe :time_gmtime, shared: true do
with_timezone("CST", -6) do
time = Time.now
time.freeze
- lambda { time.send(@method) }.should raise_error(RuntimeError)
+ -> { time.send(@method) }.should raise_error(RuntimeError)
end
end
end
diff --git a/spec/ruby/core/time/shared/time_params.rb b/spec/ruby/core/time/shared/time_params.rb
index 39245116b0..63d0dbc120 100644
--- a/spec/ruby/core/time/shared/time_params.rb
+++ b/spec/ruby/core/time/shared/time_params.rb
@@ -30,7 +30,7 @@ describe :time_params, shared: true do
end
it "raises a TypeError if the year is nil" do
- lambda { Time.send(@method, nil) }.should raise_error(TypeError)
+ -> { Time.send(@method, nil) }.should raise_error(TypeError)
end
it "accepts nil month, day, hour, minute, and second" do
@@ -145,41 +145,41 @@ describe :time_params, shared: true do
end
it "raises an ArgumentError for out of range month" do
- lambda {
+ -> {
Time.send(@method, 2008, 13, 31, 23, 59, 59)
}.should raise_error(ArgumentError)
end
it "raises an ArgumentError for out of range day" do
- lambda {
+ -> {
Time.send(@method, 2008, 12, 32, 23, 59, 59)
}.should raise_error(ArgumentError)
end
it "raises an ArgumentError for out of range hour" do
- lambda {
+ -> {
Time.send(@method, 2008, 12, 31, 25, 59, 59)
}.should raise_error(ArgumentError)
end
it "raises an ArgumentError for out of range minute" do
- lambda {
+ -> {
Time.send(@method, 2008, 12, 31, 23, 61, 59)
}.should raise_error(ArgumentError)
end
it "raises an ArgumentError for out of range second" do
- lambda {
+ -> {
Time.send(@method, 2008, 12, 31, 23, 59, 61)
}.should raise_error(ArgumentError)
end
it "raises ArgumentError when given 9 arguments" do
- lambda { Time.send(@method, *[0]*9) }.should raise_error(ArgumentError)
+ -> { Time.send(@method, *[0]*9) }.should raise_error(ArgumentError)
end
it "raises ArgumentError when given 11 arguments" do
- lambda { Time.send(@method, *[0]*11) }.should raise_error(ArgumentError)
+ -> { Time.send(@method, *[0]*11) }.should raise_error(ArgumentError)
end
it "returns subclass instances" do
@@ -202,23 +202,23 @@ describe :time_params_10_arg, shared: true do
end
it "raises an ArgumentError for out of range values" do
- lambda {
+ -> {
Time.send(@method, 61, 59, 23, 31, 12, 2008, :ignored, :ignored, :ignored, :ignored)
}.should raise_error(ArgumentError) # sec
- lambda {
+ -> {
Time.send(@method, 59, 61, 23, 31, 12, 2008, :ignored, :ignored, :ignored, :ignored)
}.should raise_error(ArgumentError) # min
- lambda {
+ -> {
Time.send(@method, 59, 59, 25, 31, 12, 2008, :ignored, :ignored, :ignored, :ignored)
}.should raise_error(ArgumentError) # hour
- lambda {
+ -> {
Time.send(@method, 59, 59, 23, 32, 12, 2008, :ignored, :ignored, :ignored, :ignored)
}.should raise_error(ArgumentError) # day
- lambda {
+ -> {
Time.send(@method, 59, 59, 23, 31, 13, 2008, :ignored, :ignored, :ignored, :ignored)
}.should raise_error(ArgumentError) # month
end
@@ -231,7 +231,7 @@ describe :time_params_microseconds, shared: true do
end
it "raises an ArgumentError for out of range microsecond" do
- lambda { Time.send(@method, 2000, 1, 1, 20, 15, 1, 1000000) }.should raise_error(ArgumentError)
+ -> { Time.send(@method, 2000, 1, 1, 20, 15, 1, 1000000) }.should raise_error(ArgumentError)
end
it "handles fractional microseconds as a Float" do
diff --git a/spec/ruby/core/time/strftime_spec.rb b/spec/ruby/core/time/strftime_spec.rb
index 62f9272f32..1bd24b0538 100644
--- a/spec/ruby/core/time/strftime_spec.rb
+++ b/spec/ruby/core/time/strftime_spec.rb
@@ -6,14 +6,14 @@ require_relative '../../shared/time/strftime_for_time'
describe "Time#strftime" do
before :all do
- @new_date = lambda { |y,m,d| Time.gm(y,m,d) }
- @new_time = lambda { |*args| Time.gm(*args) }
- @new_time_in_zone = lambda { |zone,offset,*args|
+ @new_date = -> y, m, d { Time.gm(y,m,d) }
+ @new_time = -> *args { Time.gm(*args) }
+ @new_time_in_zone = -> zone, offset, *args {
with_timezone(zone, offset) do
Time.new(*args)
end
}
- @new_time_with_offset = lambda { |y,m,d,h,min,s,offset|
+ @new_time_with_offset = -> y, m, d, h, min, s, offset {
Time.new(y,m,d,h,min,s,offset)
}
@@ -25,7 +25,7 @@ describe "Time#strftime" do
# Differences with date
it "requires an argument" do
- lambda { @time.strftime }.should raise_error(ArgumentError)
+ -> { @time.strftime }.should raise_error(ArgumentError)
end
# %Z is zone name or empty for Time
diff --git a/spec/ruby/core/time/succ_spec.rb b/spec/ruby/core/time/succ_spec.rb
index 395ed67064..e68e64b0cc 100644
--- a/spec/ruby/core/time/succ_spec.rb
+++ b/spec/ruby/core/time/succ_spec.rb
@@ -21,7 +21,7 @@ describe "Time#succ" do
end
it "is obsolete" do
- lambda {
+ -> {
Time.at(100).succ
}.should complain(/Time#succ is obsolete/)
end
diff --git a/spec/ruby/core/time/zone_spec.rb b/spec/ruby/core/time/zone_spec.rb
index 45c9e852ea..907ccf9f4b 100644
--- a/spec/ruby/core/time/zone_spec.rb
+++ b/spec/ruby/core/time/zone_spec.rb
@@ -52,7 +52,7 @@ describe "Time#zone" do
end
it "doesn't raise errors for a Time with a fixed offset" do
- lambda {
+ -> {
Time.new(2001, 1, 1, 0, 0, 0, "+05:00").zone
}.should_not raise_error
end
diff --git a/spec/ruby/core/tracepoint/enable_spec.rb b/spec/ruby/core/tracepoint/enable_spec.rb
index 6eeec1d5db..b0fe38c559 100644
--- a/spec/ruby/core/tracepoint/enable_spec.rb
+++ b/spec/ruby/core/tracepoint/enable_spec.rb
@@ -247,7 +247,7 @@ describe 'TracePoint#enable' do
block = proc {}
- lambda {
+ -> {
trace.enable(target: block) do
block.call # triggers :b_call and :b_return events
end
@@ -258,7 +258,7 @@ describe 'TracePoint#enable' do
trace = TracePoint.new(:call) do |tp|
end
- lambda {
+ -> {
trace.enable(target: Object.new) do
end
}.should raise_error(ArgumentError, /specified target is not supported/)
@@ -269,7 +269,7 @@ describe 'TracePoint#enable' do
trace = TracePoint.new(:b_call) do
end
- lambda {
+ -> {
trace.enable(target: -> {}) do
trace.enable(target: -> {}) do
end
@@ -281,7 +281,7 @@ describe 'TracePoint#enable' do
trace = TracePoint.new(:b_call) do
end
- lambda {
+ -> {
trace.enable do
trace.enable(target: -> {}) do
end
@@ -293,7 +293,7 @@ describe 'TracePoint#enable' do
trace = TracePoint.new(:b_call) do
end
- lambda {
+ -> {
trace.enable(target: -> {}) do
trace.enable do
end
@@ -305,7 +305,7 @@ describe 'TracePoint#enable' do
trace = TracePoint.new(:b_call) do
end
- lambda {
+ -> {
trace.enable(target: -> {}) do
trace.disable do
end
@@ -404,7 +404,7 @@ describe 'TracePoint#enable' do
trace = TracePoint.new(:line) do |tp|
end
- lambda {
+ -> {
trace.enable(target_line: 67) do
end
}.should raise_error(ArgumentError, /only target_line is specified/)
@@ -422,7 +422,7 @@ describe 'TracePoint#enable' do
_, lineno = target.source_location
target_line = lineno + 2
- lambda {
+ -> {
trace.enable(target_line: target_line, target: target) do
end
}.should raise_error(ArgumentError, /target_line is specified, but line event is not specified/)
@@ -432,7 +432,7 @@ describe 'TracePoint#enable' do
trace = TracePoint.new(:line) do |tp|
end
- lambda {
+ -> {
trace.enable(target_line: 1, target: -> { }) do
end
}.should raise_error(ArgumentError, /can not enable any hooks/)
@@ -442,7 +442,7 @@ describe 'TracePoint#enable' do
trace = TracePoint.new(:line) do |tp|
end
- lambda {
+ -> {
trace.enable(target_line: Object.new, target: -> { }) do
end
}.should raise_error(TypeError, /no implicit conversion of \w+? into Integer/)
@@ -452,7 +452,7 @@ describe 'TracePoint#enable' do
trace = TracePoint.new(:line) do |tp|
end
- lambda {
+ -> {
trace.enable(target_line: -2, target: -> { }) do
end
}.should raise_error(ArgumentError, /can not enable any hooks/)
diff --git a/spec/ruby/core/tracepoint/parameters_spec.rb b/spec/ruby/core/tracepoint/parameters_spec.rb
index 550b9572c0..f901c184f4 100644
--- a/spec/ruby/core/tracepoint/parameters_spec.rb
+++ b/spec/ruby/core/tracepoint/parameters_spec.rb
@@ -12,7 +12,7 @@ ruby_version_is "2.6" do
end
it 'returns the parameters of lambda block' do
- f = lambda {|x, y, z| }
+ f = -> x, y, z { }
parameters = nil
TracePoint.new(:b_call) {|tp| parameters = tp.parameters }.enable do
f.call(1, 2, 3)
diff --git a/spec/ruby/core/true/trueclass_spec.rb b/spec/ruby/core/true/trueclass_spec.rb
index 8f3c311548..02af649d09 100644
--- a/spec/ruby/core/true/trueclass_spec.rb
+++ b/spec/ruby/core/true/trueclass_spec.rb
@@ -2,13 +2,13 @@ require_relative '../../spec_helper'
describe "TrueClass" do
it ".allocate raises a TypeError" do
- lambda do
+ -> do
TrueClass.allocate
end.should raise_error(TypeError)
end
it ".new is undefined" do
- lambda do
+ -> do
TrueClass.new
end.should raise_error(NoMethodError)
end
diff --git a/spec/ruby/core/unboundmethod/bind_spec.rb b/spec/ruby/core/unboundmethod/bind_spec.rb
index 328c356906..03aaa22e74 100644
--- a/spec/ruby/core/unboundmethod/bind_spec.rb
+++ b/spec/ruby/core/unboundmethod/bind_spec.rb
@@ -10,7 +10,7 @@ describe "UnboundMethod#bind" do
end
it "raises TypeError if object is not kind_of? the Module the method defined in" do
- lambda { @normal_um.bind(UnboundMethodSpecs::B.new) }.should raise_error(TypeError)
+ -> { @normal_um.bind(UnboundMethodSpecs::B.new) }.should raise_error(TypeError)
end
it "returns Method for any object that is kind_of? the Module method was extracted from" do
@@ -21,11 +21,21 @@ describe "UnboundMethod#bind" do
UnboundMethodSpecs::Mod.instance_method(:from_mod).bind(Object.new).should be_kind_of(Method)
end
- it "returns Method returned for obj is equal to one directly returned by obj.method" do
+ it "the returned Method is equal to the one directly returned by obj.method" do
obj = UnboundMethodSpecs::Methods.new
@normal_um.bind(obj).should == obj.method(:foo)
end
+ it "returns Method for any object kind_of? the Module the method is defined in" do
+ @parent_um.bind(UnboundMethodSpecs::Child1.new).should be_kind_of(Method)
+ @child1_um.bind(UnboundMethodSpecs::Parent.new).should be_kind_of(Method)
+ @child2_um.bind(UnboundMethodSpecs::Child1.new).should be_kind_of(Method)
+ end
+
+ it "allows binding a Kernel method retrieved from Object on BasicObject" do
+ Object.instance_method(:instance_of?).bind(BasicObject.new).call(BasicObject).should == true
+ end
+
it "returns a callable method" do
obj = UnboundMethodSpecs::Methods.new
@normal_um.bind(obj).call.should == obj.foo
@@ -46,6 +56,6 @@ describe "UnboundMethod#bind" do
end
end
um = p.method(:singleton_method).unbind
- lambda{ um.bind(other) }.should raise_error(TypeError)
+ ->{ um.bind(other) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/fixtures/class.rb b/spec/ruby/fixtures/class.rb
index d2ae14ecb7..68fbca7ba7 100644
--- a/spec/ruby/fixtures/class.rb
+++ b/spec/ruby/fixtures/class.rb
@@ -112,7 +112,7 @@ module ClassSpecs
class M < L; end
# Can't use a method here because of class definition in method body error
- ANON_CLASS_FOR_NEW = lambda do
+ ANON_CLASS_FOR_NEW = -> do
Class.new do
class NamedInModule
end
diff --git a/spec/ruby/language/BEGIN_spec.rb b/spec/ruby/language/BEGIN_spec.rb
index bd7112a0f0..58cc2bebfb 100644
--- a/spec/ruby/language/BEGIN_spec.rb
+++ b/spec/ruby/language/BEGIN_spec.rb
@@ -15,7 +15,7 @@ describe "The BEGIN keyword" do
end
it "must appear in a top-level context" do
- lambda { eval "1.times { BEGIN { 1 } }" }.should raise_error(SyntaxError)
+ -> { eval "1.times { BEGIN { 1 } }" }.should raise_error(SyntaxError)
end
it "runs first in a given code unit" do
diff --git a/spec/ruby/language/alias_spec.rb b/spec/ruby/language/alias_spec.rb
index a7f34146d1..79348f70c3 100644
--- a/spec/ruby/language/alias_spec.rb
+++ b/spec/ruby/language/alias_spec.rb
@@ -122,7 +122,7 @@ describe "The alias keyword" do
end
@obj.__value.should == 5
- lambda { AliasObject.new.__value }.should raise_error(NoMethodError)
+ -> { AliasObject.new.__value }.should raise_error(NoMethodError)
end
it "operates on the class/module metaclass when used in instance_eval" do
@@ -131,7 +131,7 @@ describe "The alias keyword" do
end
AliasObject.__klass_method.should == 7
- lambda { Object.__klass_method }.should raise_error(NoMethodError)
+ -> { Object.__klass_method }.should raise_error(NoMethodError)
end
it "operates on the class/module metaclass when used in instance_exec" do
@@ -140,7 +140,7 @@ describe "The alias keyword" do
end
AliasObject.__klass_method2.should == 7
- lambda { Object.__klass_method2 }.should raise_error(NoMethodError)
+ -> { Object.__klass_method2 }.should raise_error(NoMethodError)
end
it "operates on methods defined via attr, attr_reader, and attr_accessor" do
@@ -219,13 +219,13 @@ describe "The alias keyword" do
end
it "is not allowed against Fixnum or String instances" do
- lambda do
+ -> do
1.instance_eval do
alias :foo :to_s
end
end.should raise_error(TypeError)
- lambda do
+ -> do
:blah.instance_eval do
alias :foo :to_s
end
@@ -238,7 +238,7 @@ describe "The alias keyword" do
end
it "raises a NameError when passed a missing name" do
- lambda { @meta.class_eval { alias undef_method not_exist } }.should raise_error(NameError) { |e|
+ -> { @meta.class_eval { alias undef_method not_exist } }.should raise_error(NameError) { |e|
# a NameError and not a NoMethodError
e.class.should == NameError
}
diff --git a/spec/ruby/language/block_spec.rb b/spec/ruby/language/block_spec.rb
index bf613433e7..9230740d07 100644
--- a/spec/ruby/language/block_spec.rb
+++ b/spec/ruby/language/block_spec.rb
@@ -110,7 +110,7 @@ describe "A block yielded a single" do
obj = mock("destructure block keyword arguments")
obj.should_receive(:to_hash).and_return(1)
- lambda { m([1, 2, 3, obj]) { |a, *b, c, **k| } }.should raise_error(TypeError)
+ -> { m([1, 2, 3, obj]) { |a, *b, c, **k| } }.should raise_error(TypeError)
end
it "raises the error raised inside #to_hash" do
@@ -118,7 +118,7 @@ describe "A block yielded a single" do
error = RuntimeError.new("error while converting to a hash")
obj.should_receive(:to_hash).and_raise(error)
- lambda { m([1, 2, 3, obj]) { |a, *b, c, **k| } }.should raise_error(error)
+ -> { m([1, 2, 3, obj]) { |a, *b, c, **k| } }.should raise_error(error)
end
it "does not call #to_ary on the Array" do
@@ -169,7 +169,7 @@ describe "A block yielded a single" do
obj = mock("destructure block arguments")
obj.should_receive(:to_ary).and_return(1)
- lambda { m(obj) { |a, b| } }.should raise_error(TypeError)
+ -> { m(obj) { |a, b| } }.should raise_error(TypeError)
end
end
end
@@ -332,14 +332,14 @@ describe "A block" do
obj = mock("block yield to_ary invalid")
obj.should_receive(:to_ary).and_return(1)
- lambda { @y.s(obj) { |a, b| } }.should raise_error(TypeError)
+ -> { @y.s(obj) { |a, b| } }.should raise_error(TypeError)
end
it "raises the original exception if #to_ary raises an exception" do
obj = mock("block yield to_ary raising an exception")
obj.should_receive(:to_ary).and_raise(ZeroDivisionError)
- lambda { @y.s(obj) { |a, b| } }.should raise_error(ZeroDivisionError)
+ -> { @y.s(obj) { |a, b| } }.should raise_error(ZeroDivisionError)
end
end
@@ -396,7 +396,7 @@ describe "A block" do
obj = mock("block yield to_ary invalid")
obj.should_receive(:to_ary).and_return(1)
- lambda { @y.s(obj) { |a, *b| } }.should raise_error(TypeError)
+ -> { @y.s(obj) { |a, *b| } }.should raise_error(TypeError)
end
end
@@ -521,7 +521,7 @@ describe "A block" do
obj = mock("block yield to_ary invalid")
obj.should_receive(:to_ary).and_return(1)
- lambda { @y.s(obj) { |a, | } }.should raise_error(TypeError)
+ -> { @y.s(obj) { |a, | } }.should raise_error(TypeError)
end
end
@@ -563,7 +563,7 @@ describe "A block" do
obj = mock("block yield to_ary invalid")
obj.should_receive(:to_ary).and_return(1)
- lambda { @y.s(obj) { |(a, b)| } }.should raise_error(TypeError)
+ -> { @y.s(obj) { |(a, b)| } }.should raise_error(TypeError)
end
end
@@ -604,7 +604,7 @@ describe "A block" do
obj = mock("block yield to_ary invalid")
obj.should_receive(:to_ary).and_return(1)
- lambda { @y.s(obj) { |(a, b), c| } }.should raise_error(TypeError)
+ -> { @y.s(obj) { |(a, b), c| } }.should raise_error(TypeError)
end
end
@@ -663,9 +663,9 @@ describe "A block" do
describe "taking identically-named arguments" do
it "raises a SyntaxError for standard arguments" do
- lambda { eval "lambda { |x,x| }" }.should raise_error(SyntaxError)
- lambda { eval "->(x,x) {}" }.should raise_error(SyntaxError)
- lambda { eval "Proc.new { |x,x| }" }.should raise_error(SyntaxError)
+ -> { eval "lambda { |x,x| }" }.should raise_error(SyntaxError)
+ -> { eval "->(x,x) {}" }.should raise_error(SyntaxError)
+ -> { eval "Proc.new { |x,x| }" }.should raise_error(SyntaxError)
end
it "accepts unnamed arguments" do
@@ -686,27 +686,27 @@ describe "Block-local variables" do
end
it "can not have the same name as one of the standard parameters" do
- lambda { eval "[1].each {|foo; foo| }" }.should raise_error(SyntaxError)
- lambda { eval "[1].each {|foo, bar; glark, bar| }" }.should raise_error(SyntaxError)
+ -> { eval "[1].each {|foo; foo| }" }.should raise_error(SyntaxError)
+ -> { eval "[1].each {|foo, bar; glark, bar| }" }.should raise_error(SyntaxError)
end
it "can not be prefixed with an asterisk" do
- lambda { eval "[1].each {|foo; *bar| }" }.should raise_error(SyntaxError)
- lambda do
+ -> { eval "[1].each {|foo; *bar| }" }.should raise_error(SyntaxError)
+ -> do
eval "[1].each {|foo, bar; glark, *fnord| }"
end.should raise_error(SyntaxError)
end
it "can not be prefixed with an ampersand" do
- lambda { eval "[1].each {|foo; &bar| }" }.should raise_error(SyntaxError)
- lambda do
+ -> { eval "[1].each {|foo; &bar| }" }.should raise_error(SyntaxError)
+ -> do
eval "[1].each {|foo, bar; glark, &fnord| }"
end.should raise_error(SyntaxError)
end
it "can not be assigned default values" do
- lambda { eval "[1].each {|foo; bar=1| }" }.should raise_error(SyntaxError)
- lambda do
+ -> { eval "[1].each {|foo; bar=1| }" }.should raise_error(SyntaxError)
+ -> do
eval "[1].each {|foo, bar; glark, fnord=:fnord| }"
end.should raise_error(SyntaxError)
end
@@ -717,8 +717,8 @@ describe "Block-local variables" do
end
it "only allow a single semi-colon in the parameter list" do
- lambda { eval "[1].each {|foo; bar; glark| }" }.should raise_error(SyntaxError)
- lambda { eval "[1].each {|; bar; glark| }" }.should raise_error(SyntaxError)
+ -> { eval "[1].each {|foo; bar; glark| }" }.should raise_error(SyntaxError)
+ -> { eval "[1].each {|; bar; glark| }" }.should raise_error(SyntaxError)
end
it "override shadowed variables from the outer scope" do
@@ -781,8 +781,8 @@ describe "Post-args" do
end
it "are required" do
- lambda {
- lambda do |*a, b|
+ -> {
+ -> *a, b do
[a, b]
end.call
}.should raise_error(ArgumentError)
diff --git a/spec/ruby/language/break_spec.rb b/spec/ruby/language/break_spec.rb
index 8fd6cc6f05..754d5d3c49 100644
--- a/spec/ruby/language/break_spec.rb
+++ b/spec/ruby/language/break_spec.rb
@@ -52,29 +52,29 @@ describe "The break statement in a captured block" do
describe "when the invocation of the scope creating the block is still active" do
it "raises a LocalJumpError when invoking the block from the scope creating the block" do
- lambda { @program.break_in_method }.should raise_error(LocalJumpError)
+ -> { @program.break_in_method }.should raise_error(LocalJumpError)
ScratchPad.recorded.should == [:a, :xa, :d, :b]
end
it "raises a LocalJumpError when invoking the block from a method" do
- lambda { @program.break_in_nested_method }.should raise_error(LocalJumpError)
+ -> { @program.break_in_nested_method }.should raise_error(LocalJumpError)
ScratchPad.recorded.should == [:a, :xa, :cc, :aa, :b]
end
it "raises a LocalJumpError when yielding to the block" do
- lambda { @program.break_in_yielding_method }.should raise_error(LocalJumpError)
+ -> { @program.break_in_yielding_method }.should raise_error(LocalJumpError)
ScratchPad.recorded.should == [:a, :xa, :cc, :aa, :b]
end
end
describe "from a scope that has returned" do
it "raises a LocalJumpError when calling the block from a method" do
- lambda { @program.break_in_method_captured }.should raise_error(LocalJumpError)
+ -> { @program.break_in_method_captured }.should raise_error(LocalJumpError)
ScratchPad.recorded.should == [:a, :za, :xa, :zd, :zb]
end
it "raises a LocalJumpError when yielding to the block" do
- lambda { @program.break_in_yield_captured }.should raise_error(LocalJumpError)
+ -> { @program.break_in_yield_captured }.should raise_error(LocalJumpError)
ScratchPad.recorded.should == [:a, :za, :xa, :zd, :aa, :zb]
end
end
@@ -100,7 +100,7 @@ describe "The break statement in a lambda" do
end
it "returns from the lambda" do
- l = lambda {
+ l = -> {
ScratchPad << :before
break :foo
ScratchPad << :after
@@ -111,7 +111,7 @@ describe "The break statement in a lambda" do
it "returns from the call site if the lambda is passed as a block" do
def mid(&b)
- lambda {
+ -> {
ScratchPad << :before
b.call
ScratchPad << :unreachable1
@@ -208,7 +208,7 @@ describe "Break inside a while loop" do
it "passes the value returned by a method with omitted parenthesis and passed block" do
obj = BreakSpecs::Block.new
- lambda { break obj.method :value do |x| x end }.call.should == :value
+ -> { break obj.method :value do |x| x end }.call.should == :value
end
end
diff --git a/spec/ruby/language/case_spec.rb b/spec/ruby/language/case_spec.rb
index 0b74efa257..1475e20f75 100644
--- a/spec/ruby/language/case_spec.rb
+++ b/spec/ruby/language/case_spec.rb
@@ -252,7 +252,7 @@ describe "The 'case'-construct" do
end
it "raises a SyntaxError when 'else' is used when no 'when' is given" do
- lambda {
+ -> {
eval <<-CODE
case 4
else
@@ -263,7 +263,7 @@ describe "The 'case'-construct" do
end
it "raises a SyntaxError when 'else' is used before a 'when' was given" do
- lambda {
+ -> {
eval <<-CODE
case 4
else
diff --git a/spec/ruby/language/class_spec.rb b/spec/ruby/language/class_spec.rb
index d07454a3a7..88b7a6a74f 100644
--- a/spec/ruby/language/class_spec.rb
+++ b/spec/ruby/language/class_spec.rb
@@ -30,7 +30,7 @@ describe "A class definition" do
end
it "raises TypeError if constant given as class name exists and is not a Module" do
- lambda {
+ -> {
class ClassSpecsNumber
end
}.should raise_error(TypeError)
@@ -38,19 +38,19 @@ describe "A class definition" do
# test case known to be detecting bugs (JRuby, MRI)
it "raises TypeError if the constant qualifying the class is nil" do
- lambda {
+ -> {
class nil::Foo
end
}.should raise_error(TypeError)
end
it "raises TypeError if any constant qualifying the class is not a Module" do
- lambda {
+ -> {
class ClassSpecs::Number::MyClass
end
}.should raise_error(TypeError)
- lambda {
+ -> {
class ClassSpecsNumber::MyClass
end
}.should raise_error(TypeError)
@@ -64,7 +64,7 @@ describe "A class definition" do
module ClassSpecs
class SuperclassResetToSubclass < L
end
- lambda {
+ -> {
class SuperclassResetToSubclass < M
end
}.should raise_error(TypeError, /superclass mismatch/)
@@ -77,7 +77,7 @@ describe "A class definition" do
end
SuperclassReopenedBasicObject.superclass.should == A
- lambda {
+ -> {
class SuperclassReopenedBasicObject < BasicObject
end
}.should raise_error(TypeError, /superclass mismatch/)
@@ -92,7 +92,7 @@ describe "A class definition" do
end
SuperclassReopenedObject.superclass.should == A
- lambda {
+ -> {
class SuperclassReopenedObject < Object
end
}.should raise_error(TypeError, /superclass mismatch/)
@@ -117,7 +117,7 @@ describe "A class definition" do
class NoSuperclassSet
end
- lambda {
+ -> {
class NoSuperclassSet < String
end
}.should raise_error(TypeError, /superclass mismatch/)
@@ -127,7 +127,7 @@ describe "A class definition" do
it "allows using self as the superclass if self is a class" do
ClassSpecs::I::J.superclass.should == ClassSpecs::I
- lambda {
+ -> {
class ShouldNotWork < self; end
}.should raise_error(TypeError)
end
@@ -148,7 +148,7 @@ describe "A class definition" do
it "raises a TypeError if inheriting from a metaclass" do
obj = mock("metaclass super")
meta = obj.singleton_class
- lambda { class ClassSpecs::MetaclassSuper < meta; end }.should raise_error(TypeError)
+ -> { class ClassSpecs::MetaclassSuper < meta; end }.should raise_error(TypeError)
end
it "allows the declaration of class variables in the body" do
@@ -274,7 +274,7 @@ describe "A class definition extending an object (sclass)" do
end
it "raises a TypeError when trying to extend numbers" do
- lambda {
+ -> {
eval <<-CODE
class << 1
def xyz
@@ -310,11 +310,11 @@ describe "Reopening a class" do
end
it "raises a TypeError when superclasses mismatch" do
- lambda { class ClassSpecs::A < Array; end }.should raise_error(TypeError)
+ -> { class ClassSpecs::A < Array; end }.should raise_error(TypeError)
end
it "adds new methods to subclasses" do
- lambda { ClassSpecs::M.m }.should raise_error(NoMethodError)
+ -> { ClassSpecs::M.m }.should raise_error(NoMethodError)
class ClassSpecs::L
def self.m
1
diff --git a/spec/ruby/language/class_variable_spec.rb b/spec/ruby/language/class_variable_spec.rb
index 98954023a2..dffab47a6b 100644
--- a/spec/ruby/language/class_variable_spec.rb
+++ b/spec/ruby/language/class_variable_spec.rb
@@ -70,14 +70,14 @@ describe 'A class variable definition' do
c = Class.new(b)
b.class_variable_set(:@@cv, :value)
- lambda { a.class_variable_get(:@@cv) }.should raise_error(NameError)
+ -> { a.class_variable_get(:@@cv) }.should raise_error(NameError)
b.class_variable_get(:@@cv).should == :value
c.class_variable_get(:@@cv).should == :value
# updates the same variable
c.class_variable_set(:@@cv, :next)
- lambda { a.class_variable_get(:@@cv) }.should raise_error(NameError)
+ -> { a.class_variable_get(:@@cv) }.should raise_error(NameError)
b.class_variable_get(:@@cv).should == :next
c.class_variable_get(:@@cv).should == :next
end
diff --git a/spec/ruby/language/constants_spec.rb b/spec/ruby/language/constants_spec.rb
index 4d848ae889..c4cf940cba 100644
--- a/spec/ruby/language/constants_spec.rb
+++ b/spec/ruby/language/constants_spec.rb
@@ -49,10 +49,10 @@ describe "Literal (A::X) constant resolution" do
end
it "does not search the singleton class of the class or module" do
- lambda do
+ -> do
ConstantSpecs::ContainerA::ChildA::CS_CONST14
end.should raise_error(NameError)
- lambda { ConstantSpecs::CS_CONST14 }.should raise_error(NameError)
+ -> { ConstantSpecs::CS_CONST14 }.should raise_error(NameError)
end
end
@@ -112,7 +112,7 @@ describe "Literal (A::X) constant resolution" do
CS_CONST108 = :const108_1
end
- lambda do
+ -> do
ConstantSpecs::ContainerB::ChildB::CS_CONST108
end.should raise_error(NameError)
@@ -122,7 +122,7 @@ describe "Literal (A::X) constant resolution" do
end
end
- lambda { ConstantSpecs::CS_CONST108 }.should raise_error(NameError)
+ -> { ConstantSpecs::CS_CONST108 }.should raise_error(NameError)
end
it "returns the updated value when a constant is reassigned" do
@@ -151,7 +151,7 @@ describe "Literal (A::X) constant resolution" do
end
it "raises a NameError if no constant is defined in the search path" do
- lambda { ConstantSpecs::ParentA::CS_CONSTX }.should raise_error(NameError)
+ -> { ConstantSpecs::ParentA::CS_CONSTX }.should raise_error(NameError)
end
it "sends #const_missing to the original class or module scope" do
@@ -163,10 +163,10 @@ describe "Literal (A::X) constant resolution" do
end
it "raises a TypeError if a non-class or non-module qualifier is given" do
- lambda { CS_CONST1::CS_CONST }.should raise_error(TypeError)
- lambda { 1::CS_CONST }.should raise_error(TypeError)
- lambda { "mod"::CS_CONST }.should raise_error(TypeError)
- lambda { false::CS_CONST }.should raise_error(TypeError)
+ -> { CS_CONST1::CS_CONST }.should raise_error(TypeError)
+ -> { 1::CS_CONST }.should raise_error(TypeError)
+ -> { "mod"::CS_CONST }.should raise_error(TypeError)
+ -> { false::CS_CONST }.should raise_error(TypeError)
end
end
@@ -212,7 +212,7 @@ describe "Constant resolution within methods" do
end
it "does not search the lexical scope of the caller" do
- lambda { ConstantSpecs::ClassA.const16 }.should raise_error(NameError)
+ -> { ConstantSpecs::ClassA.const16 }.should raise_error(NameError)
end
it "searches the lexical scope of a block" do
@@ -225,7 +225,7 @@ describe "Constant resolution within methods" do
end
it "does not search the lexical scope of qualifying modules" do
- lambda do
+ -> do
ConstantSpecs::ContainerA::ChildA.const23
end.should raise_error(NameError)
end
@@ -302,7 +302,7 @@ describe "Constant resolution within methods" do
it "does not search the lexical scope of the caller" do
ConstantSpecs::ClassB::CS_CONST209 = :const209
- lambda { ConstantSpecs::ClassB.const209 }.should raise_error(NameError)
+ -> { ConstantSpecs::ClassB.const209 }.should raise_error(NameError)
end
it "searches the lexical scope of a block" do
@@ -337,14 +337,14 @@ describe "Constant resolution within methods" do
it "does not search the lexical scope of qualifying modules" do
ConstantSpecs::ContainerB::CS_CONST214 = :const214
- lambda do
+ -> do
ConstantSpecs::ContainerB::ChildB.const214
end.should raise_error(NameError)
end
end
it "raises a NameError if no constant is defined in the search path" do
- lambda { ConstantSpecs::ParentA.constx }.should raise_error(NameError)
+ -> { ConstantSpecs::ParentA.constx }.should raise_error(NameError)
end
it "sends #const_missing to the original class or module scope" do
@@ -427,7 +427,7 @@ describe "top-level constant lookup" do
context "on a class" do
ruby_version_is "" ... "2.5" do
it "searches Object successfully after searching other scopes" do
- ->() {
+ -> {
String::Hash.should == Hash
}.should complain(/toplevel constant Hash referenced by/)
end
@@ -435,13 +435,13 @@ describe "top-level constant lookup" do
ruby_version_is "2.5" do
it "does not search Object after searching other scopes" do
- ->() { String::Hash }.should raise_error(NameError)
+ -> { String::Hash }.should raise_error(NameError)
end
end
end
it "searches Object unsuccessfully when searches on a module" do
- ->() { Enumerable::Hash }.should raise_error(NameError)
+ -> { Enumerable::Hash }.should raise_error(NameError)
end
end
@@ -455,7 +455,7 @@ describe "Module#private_constant marked constants" do
mod.const_set :Foo, false
}.should complain(/already initialized constant/)
- lambda {mod::Foo}.should raise_error(NameError)
+ -> {mod::Foo}.should raise_error(NameError)
end
ruby_version_is "2.6" do
@@ -473,19 +473,19 @@ describe "Module#private_constant marked constants" do
describe "in a module" do
it "cannot be accessed from outside the module" do
- lambda do
+ -> do
ConstantVisibility::PrivConstModule::PRIVATE_CONSTANT_MODULE
end.should raise_error(NameError)
end
it "cannot be reopened as a module from scope where constant would be private" do
- lambda do
+ -> do
module ConstantVisibility::ModuleContainer::PrivateModule; end
end.should raise_error(NameError)
end
it "cannot be reopened as a class from scope where constant would be private" do
- lambda do
+ -> do
class ConstantVisibility::ModuleContainer::PrivateClass; end
end.should raise_error(NameError)
end
@@ -541,19 +541,19 @@ describe "Module#private_constant marked constants" do
describe "in a class" do
it "cannot be accessed from outside the class" do
- lambda do
+ -> do
ConstantVisibility::PrivConstClass::PRIVATE_CONSTANT_CLASS
end.should raise_error(NameError)
end
it "cannot be reopened as a module" do
- lambda do
+ -> do
module ConstantVisibility::ClassContainer::PrivateModule; end
end.should raise_error(NameError)
end
it "cannot be reopened as a class" do
- lambda do
+ -> do
class ConstantVisibility::ClassContainer::PrivateClass; end
end.should raise_error(NameError)
end
@@ -609,7 +609,7 @@ describe "Module#private_constant marked constants" do
describe "in Object" do
it "cannot be accessed using ::Const form" do
- lambda do
+ -> do
::PRIVATE_CONSTANT_IN_OBJECT
end.should raise_error(NameError)
end
@@ -629,14 +629,14 @@ describe "Module#private_constant marked constants" do
describe "NameError by #private_constant" do
it "has :receiver and :name attributes" do
- lambda do
+ -> do
ConstantVisibility::PrivConstClass::PRIVATE_CONSTANT_CLASS
end.should raise_error(NameError) {|e|
e.receiver.should == ConstantVisibility::PrivConstClass
e.name.should == :PRIVATE_CONSTANT_CLASS
}
- lambda do
+ -> do
ConstantVisibility::PrivConstModule::PRIVATE_CONSTANT_MODULE
end.should raise_error(NameError) {|e|
e.receiver.should == ConstantVisibility::PrivConstModule
@@ -645,14 +645,14 @@ describe "Module#private_constant marked constants" do
end
it "has the defined class as the :name attribute" do
- lambda do
+ -> do
ConstantVisibility::PrivConstClassChild::PRIVATE_CONSTANT_CLASS
end.should raise_error(NameError) {|e|
e.receiver.should == ConstantVisibility::PrivConstClass
e.name.should == :PRIVATE_CONSTANT_CLASS
}
- lambda do
+ -> do
ConstantVisibility::PrivConstModuleChild::PRIVATE_CONSTANT_MODULE
end.should raise_error(NameError) {|e|
e.receiver.should == ConstantVisibility::PrivConstModule
diff --git a/spec/ruby/language/def_spec.rb b/spec/ruby/language/def_spec.rb
index dee60c9adf..82813bd36c 100644
--- a/spec/ruby/language/def_spec.rb
+++ b/spec/ruby/language/def_spec.rb
@@ -82,12 +82,12 @@ end
describe "An instance method" do
it "raises an error with too few arguments" do
def foo(a, b); end
- lambda { foo 1 }.should raise_error(ArgumentError, 'wrong number of arguments (given 1, expected 2)')
+ -> { foo 1 }.should raise_error(ArgumentError, 'wrong number of arguments (given 1, expected 2)')
end
it "raises an error with too many arguments" do
def foo(a); end
- lambda { foo 1, 2 }.should raise_error(ArgumentError, 'wrong number of arguments (given 2, expected 1)')
+ -> { foo 1, 2 }.should raise_error(ArgumentError, 'wrong number of arguments (given 2, expected 1)')
end
end
@@ -113,12 +113,12 @@ describe "An instance method definition with a splat" do
end
it "allows only a single * argument" do
- lambda { eval 'def foo(a, *b, *c); end' }.should raise_error(SyntaxError)
+ -> { eval 'def foo(a, *b, *c); end' }.should raise_error(SyntaxError)
end
it "requires the presence of any arguments that precede the *" do
def foo(a, b, *c); end
- lambda { foo 1 }.should raise_error(ArgumentError, 'wrong number of arguments (given 1, expected 2+)')
+ -> { foo 1 }.should raise_error(ArgumentError, 'wrong number of arguments (given 1, expected 2+)')
end
end
@@ -151,7 +151,7 @@ describe "An instance method with a default argument" do
def foo(a, b = 2)
[a,b]
end
- lambda { foo }.should raise_error(ArgumentError, 'wrong number of arguments (given 0, expected 1..2)')
+ -> { foo }.should raise_error(ArgumentError, 'wrong number of arguments (given 0, expected 1..2)')
foo(1).should == [1, 2]
end
@@ -159,7 +159,7 @@ describe "An instance method with a default argument" do
def foo(a, b = 2, *c)
[a,b,c]
end
- lambda { foo }.should raise_error(ArgumentError, 'wrong number of arguments (given 0, expected 1+)')
+ -> { foo }.should raise_error(ArgumentError, 'wrong number of arguments (given 0, expected 1+)')
foo(1).should == [1,2,[]]
end
@@ -249,7 +249,7 @@ describe "A singleton method definition" do
it "raises #{frozen_error_class} if frozen" do
obj = Object.new
obj.freeze
- lambda { def obj.foo; end }.should raise_error(frozen_error_class)
+ -> { def obj.foo; end }.should raise_error(frozen_error_class)
end
end
@@ -322,7 +322,7 @@ describe "A method defined with extreme default arguments" do
end
it "may use a lambda as a default" do
- def foo(output = 'a', prc = lambda {|n| output * n})
+ def foo(output = 'a', prc = -> n { output * n })
prc.call(5)
end
foo.should == 'aaaaa'
@@ -368,7 +368,7 @@ describe "A singleton method defined with extreme default arguments" do
it "may use a lambda as a default" do
a = Object.new
- def a.foo(output = 'a', prc = lambda {|n| output * n})
+ def a.foo(output = 'a', prc = -> n { output * n })
prc.call(5)
end
a.foo.should == 'aaaaa'
@@ -384,7 +384,7 @@ describe "A method definition inside a metaclass scope" do
end
DefSpecSingleton.a_class_method.should == DefSpecSingleton
- lambda { Object.a_class_method }.should raise_error(NoMethodError)
+ -> { Object.a_class_method }.should raise_error(NoMethodError)
end
it "can create a singleton method" do
@@ -394,7 +394,7 @@ describe "A method definition inside a metaclass scope" do
end
obj.a_singleton_method.should == obj
- lambda { Object.new.a_singleton_method }.should raise_error(NoMethodError)
+ -> { Object.new.a_singleton_method }.should raise_error(NoMethodError)
end
it "raises #{frozen_error_class} if frozen" do
@@ -402,7 +402,7 @@ describe "A method definition inside a metaclass scope" do
obj.freeze
class << obj
- lambda { def foo; end }.should raise_error(frozen_error_class)
+ -> { def foo; end }.should raise_error(frozen_error_class)
end
end
end
@@ -438,11 +438,11 @@ describe "A nested method definition" do
end
end
- lambda { DefSpecNested.a_class_method }.should raise_error(NoMethodError)
+ -> { DefSpecNested.a_class_method }.should raise_error(NoMethodError)
DefSpecNested.create_class_method.should == DefSpecNested
DefSpecNested.a_class_method.should == DefSpecNested
- lambda { Object.a_class_method }.should raise_error(NoMethodError)
- lambda { DefSpecNested.new.a_class_method }.should raise_error(NoMethodError)
+ -> { Object.a_class_method }.should raise_error(NoMethodError)
+ -> { DefSpecNested.new.a_class_method }.should raise_error(NoMethodError)
end
it "creates a singleton method when evaluated in the metaclass of an instance" do
@@ -460,7 +460,7 @@ describe "A nested method definition" do
obj.a_singleton_method.should == obj
other = DefSpecNested.new
- lambda { other.a_singleton_method }.should raise_error(NoMethodError)
+ -> { other.a_singleton_method }.should raise_error(NoMethodError)
end
it "creates a method in the surrounding context when evaluated in a def expr.method" do
@@ -559,7 +559,7 @@ describe "A method definition inside an instance_eval" do
obj.an_instance_eval_method.should == obj
other = Object.new
- lambda { other.an_instance_eval_method }.should raise_error(NoMethodError)
+ -> { other.an_instance_eval_method }.should raise_error(NoMethodError)
end
it "creates a singleton method when evaluated inside a metaclass" do
@@ -572,7 +572,7 @@ describe "A method definition inside an instance_eval" do
obj.a_metaclass_eval_method.should == obj
other = Object.new
- lambda { other.a_metaclass_eval_method }.should raise_error(NoMethodError)
+ -> { other.a_metaclass_eval_method }.should raise_error(NoMethodError)
end
it "creates a class method when the receiver is a class" do
@@ -581,7 +581,7 @@ describe "A method definition inside an instance_eval" do
end
DefSpecNested.an_instance_eval_class_method.should == DefSpecNested
- lambda { Object.an_instance_eval_class_method }.should raise_error(NoMethodError)
+ -> { Object.an_instance_eval_class_method }.should raise_error(NoMethodError)
end
it "creates a class method when the receiver is an anonymous class" do
@@ -593,7 +593,7 @@ describe "A method definition inside an instance_eval" do
end
m.klass_method.should == :test
- lambda { Object.klass_method }.should raise_error(NoMethodError)
+ -> { Object.klass_method }.should raise_error(NoMethodError)
end
it "creates a class method when instance_eval is within class" do
@@ -606,7 +606,7 @@ describe "A method definition inside an instance_eval" do
end
m.klass_method.should == :test
- lambda { Object.klass_method }.should raise_error(NoMethodError)
+ -> { Object.klass_method }.should raise_error(NoMethodError)
end
end
@@ -619,7 +619,7 @@ describe "A method definition inside an instance_exec" do
end
DefSpecNested.an_instance_exec_class_method.should == 1
- lambda { Object.an_instance_exec_class_method }.should raise_error(NoMethodError)
+ -> { Object.an_instance_exec_class_method }.should raise_error(NoMethodError)
end
it "creates a class method when the receiver is an anonymous class" do
@@ -633,7 +633,7 @@ describe "A method definition inside an instance_exec" do
end
m.klass_method.should == 1
- lambda { Object.klass_method }.should raise_error(NoMethodError)
+ -> { Object.klass_method }.should raise_error(NoMethodError)
end
it "creates a class method when instance_exec is within class" do
@@ -648,7 +648,7 @@ describe "A method definition inside an instance_exec" do
end
m.klass_method.should == 2
- lambda { Object.klass_method }.should raise_error(NoMethodError)
+ -> { Object.klass_method }.should raise_error(NoMethodError)
end
end
@@ -668,7 +668,7 @@ describe "A method definition in an eval" do
other = DefSpecNested.new
other.an_eval_instance_method.should == other
- lambda { Object.new.an_eval_instance_method }.should raise_error(NoMethodError)
+ -> { Object.new.an_eval_instance_method }.should raise_error(NoMethodError)
end
it "creates a class method" do
@@ -684,8 +684,8 @@ describe "A method definition in an eval" do
DefSpecNestedB.eval_class_method.should == DefSpecNestedB
DefSpecNestedB.an_eval_class_method.should == DefSpecNestedB
- lambda { Object.an_eval_class_method }.should raise_error(NoMethodError)
- lambda { DefSpecNestedB.new.an_eval_class_method}.should raise_error(NoMethodError)
+ -> { Object.an_eval_class_method }.should raise_error(NoMethodError)
+ -> { DefSpecNestedB.new.an_eval_class_method}.should raise_error(NoMethodError)
end
it "creates a singleton method" do
@@ -703,7 +703,7 @@ describe "A method definition in an eval" do
obj.an_eval_singleton_method.should == obj
other = DefSpecNested.new
- lambda { other.an_eval_singleton_method }.should raise_error(NoMethodError)
+ -> { other.an_eval_singleton_method }.should raise_error(NoMethodError)
end
end
@@ -729,7 +729,7 @@ describe "a method definition that sets more than one default parameter all to t
end
it "only allows overriding the default value of the first such parameter in each set" do
- lambda { foo(1,2) }.should raise_error(ArgumentError, 'wrong number of arguments (given 2, expected 0..1)')
+ -> { foo(1,2) }.should raise_error(ArgumentError, 'wrong number of arguments (given 2, expected 0..1)')
end
def bar(a=b=c=1,d=2)
@@ -740,7 +740,7 @@ describe "a method definition that sets more than one default parameter all to t
bar.should == [1,1,1,2]
bar(3).should == [3,nil,nil,2]
bar(3,4).should == [3,nil,nil,4]
- lambda { bar(3,4,5) }.should raise_error(ArgumentError, 'wrong number of arguments (given 3, expected 0..2)')
+ -> { bar(3,4,5) }.should raise_error(ArgumentError, 'wrong number of arguments (given 3, expected 0..2)')
end
end
@@ -750,7 +750,7 @@ describe "The def keyword" do
module DefSpecsLambdaVisibility
private
- lambda {
+ -> {
def some_method; end
}.call
end
diff --git a/spec/ruby/language/encoding_spec.rb b/spec/ruby/language/encoding_spec.rb
index fb36a9618e..5430c9cb98 100644
--- a/spec/ruby/language/encoding_spec.rb
+++ b/spec/ruby/language/encoding_spec.rb
@@ -31,6 +31,6 @@ describe "The __ENCODING__ pseudo-variable" do
end
it "raises a SyntaxError if assigned to" do
- lambda { eval("__ENCODING__ = 1") }.should raise_error(SyntaxError)
+ -> { eval("__ENCODING__ = 1") }.should raise_error(SyntaxError)
end
end
diff --git a/spec/ruby/language/ensure_spec.rb b/spec/ruby/language/ensure_spec.rb
index 064627b2f7..a930bda36b 100644
--- a/spec/ruby/language/ensure_spec.rb
+++ b/spec/ruby/language/ensure_spec.rb
@@ -7,7 +7,7 @@ describe "An ensure block inside a begin block" do
end
it "is executed when an exception is raised in it's corresponding begin block" do
- lambda {
+ -> {
begin
ScratchPad << :begin
raise EnsureSpec::Error
@@ -108,7 +108,7 @@ describe "An ensure block inside a method" do
end
it "is executed when an exception is raised in the method" do
- lambda { @obj.raise_in_method_with_ensure }.should raise_error(EnsureSpec::Error)
+ -> { @obj.raise_in_method_with_ensure }.should raise_error(EnsureSpec::Error)
@obj.executed.should == [:method, :ensure]
end
@@ -165,7 +165,7 @@ describe "An ensure block inside a class" do
end
it "is executed when an exception is raised" do
- lambda {
+ -> {
eval <<-ruby
class EnsureInClassExample
ScratchPad << :class
@@ -240,7 +240,7 @@ end
describe "An ensure block inside {} block" do
it "is not allowed" do
- lambda {
+ -> {
eval <<-ruby
lambda {
raise
@@ -258,7 +258,7 @@ ruby_version_is "2.5" do
end
it "is executed when an exception is raised in it's corresponding begin block" do
- lambda {
+ -> {
eval(<<-ruby).call
lambda do
ScratchPad << :begin
diff --git a/spec/ruby/language/file_spec.rb b/spec/ruby/language/file_spec.rb
index bf7175a9bc..729dee1008 100644
--- a/spec/ruby/language/file_spec.rb
+++ b/spec/ruby/language/file_spec.rb
@@ -4,7 +4,7 @@ require_relative 'shared/__FILE__'
describe "The __FILE__ pseudo-variable" do
it "raises a SyntaxError if assigned to" do
- lambda { eval("__FILE__ = 1") }.should raise_error(SyntaxError)
+ -> { eval("__FILE__ = 1") }.should raise_error(SyntaxError)
end
it "equals (eval) inside an eval" do
diff --git a/spec/ruby/language/fixtures/break.rb b/spec/ruby/language/fixtures/break.rb
index 2d07cc3d48..217c20a2c0 100644
--- a/spec/ruby/language/fixtures/break.rb
+++ b/spec/ruby/language/fixtures/break.rb
@@ -163,7 +163,7 @@ module BreakSpecs
# on the call stack when the lambda is invoked.
def break_in_defining_scope(value=true)
note :a
- note lambda {
+ note -> {
note :b
if value
break :break
@@ -177,7 +177,7 @@ module BreakSpecs
def break_in_nested_scope
note :a
- l = lambda do
+ l = -> do
note :b
break :break
note :c
@@ -197,7 +197,7 @@ module BreakSpecs
def break_in_nested_scope_yield
note :a
- l = lambda do
+ l = -> do
note :b
break :break
note :c
@@ -217,7 +217,7 @@ module BreakSpecs
def break_in_nested_scope_block
note :a
- l = lambda do
+ l = -> do
note :b
break :break
note :c
@@ -251,7 +251,7 @@ module BreakSpecs
# active on the call stack when the lambda is invoked.
def create_lambda
note :la
- l = lambda do
+ l = -> do
note :lb
break :break
note :lc
diff --git a/spec/ruby/language/fixtures/break_lambda_toplevel.rb b/spec/ruby/language/fixtures/break_lambda_toplevel.rb
index 05af1d3fdc..da5abbaf00 100644
--- a/spec/ruby/language/fixtures/break_lambda_toplevel.rb
+++ b/spec/ruby/language/fixtures/break_lambda_toplevel.rb
@@ -1,6 +1,6 @@
print "a,"
-print lambda {
+print -> {
print "b,"
break "break,"
print "c,"
diff --git a/spec/ruby/language/fixtures/break_lambda_toplevel_block.rb b/spec/ruby/language/fixtures/break_lambda_toplevel_block.rb
index a35cb8a8a1..3dcee62424 100644
--- a/spec/ruby/language/fixtures/break_lambda_toplevel_block.rb
+++ b/spec/ruby/language/fixtures/break_lambda_toplevel_block.rb
@@ -1,6 +1,6 @@
print "a,"
-l = lambda {
+l = -> {
print "b,"
break "break,"
print "c,"
diff --git a/spec/ruby/language/fixtures/break_lambda_toplevel_method.rb b/spec/ruby/language/fixtures/break_lambda_toplevel_method.rb
index 200040d614..a5936a3d70 100644
--- a/spec/ruby/language/fixtures/break_lambda_toplevel_method.rb
+++ b/spec/ruby/language/fixtures/break_lambda_toplevel_method.rb
@@ -1,6 +1,6 @@
print "a,"
-l = lambda {
+l = -> {
print "b,"
break "break,"
print "c,"
diff --git a/spec/ruby/language/fixtures/super.rb b/spec/ruby/language/fixtures/super.rb
index 93cb9f13b7..6a024cae23 100644
--- a/spec/ruby/language/fixtures/super.rb
+++ b/spec/ruby/language/fixtures/super.rb
@@ -282,7 +282,7 @@ module SuperSpecs
#
# When name3 is called then, Alias2 (NOT Alias3) is presented as the
# current module to Alias2#name, so that when super is called,
- # Alias2->superclass is next.
+ # Alias2's superclass is next.
#
# Otherwise, Alias2 is next, which is where name was to begin with,
# causing the wrong #name method to be called.
@@ -377,12 +377,12 @@ module SuperSpecs
end
def b
- block_ref = lambda { 15 }
+ block_ref = -> { 15 }
[super { 14 }, super(&block_ref)]
end
def c
- block_ref = lambda { 16 }
+ block_ref = -> { 16 }
super(&block_ref)
end
end
diff --git a/spec/ruby/language/hash_spec.rb b/spec/ruby/language/hash_spec.rb
index 3d29f4bc72..4bce241e76 100644
--- a/spec/ruby/language/hash_spec.rb
+++ b/spec/ruby/language/hash_spec.rb
@@ -63,7 +63,7 @@ describe "Hash literal" do
end
it "with '==>' in the middle raises SyntaxError" do
- lambda { eval("{:a ==> 1}") }.should raise_error(SyntaxError)
+ -> { eval("{:a ==> 1}") }.should raise_error(SyntaxError)
end
it "constructs a new hash with the given elements" do
@@ -130,14 +130,14 @@ describe "Hash literal" do
it "raises a TypeError if any splatted elements keys are not symbols" do
h = {1 => 2, b: 3}
- lambda { {a: 1, **h} }.should raise_error(TypeError)
+ -> { {a: 1, **h} }.should raise_error(TypeError)
end
it "raises a TypeError if #to_hash does not return a Hash" do
obj = mock("hash splat")
obj.should_receive(:to_hash).and_return(obj)
- lambda { {**obj} }.should raise_error(TypeError)
+ -> { {**obj} }.should raise_error(TypeError)
end
it "does not change encoding of literal string keys during creation" do
diff --git a/spec/ruby/language/lambda_spec.rb b/spec/ruby/language/lambda_spec.rb
index a1140552bf..a4c265d80c 100644
--- a/spec/ruby/language/lambda_spec.rb
+++ b/spec/ruby/language/lambda_spec.rb
@@ -7,7 +7,7 @@ describe "A lambda literal -> () { }" do
it "returns a Proc object when used in a BasicObject method" do
klass = Class.new(BasicObject) do
def create_lambda
- -> () { }
+ -> { }
end
end
@@ -15,11 +15,11 @@ describe "A lambda literal -> () { }" do
end
it "does not execute the block" do
- ->() { fail }.should be_an_instance_of(Proc)
+ -> { fail }.should be_an_instance_of(Proc)
end
it "returns a lambda" do
- -> () { }.lambda?.should be_true
+ -> { }.lambda?.should be_true
end
ruby_version_is "2.6" do
@@ -111,7 +111,7 @@ describe "A lambda literal -> () { }" do
@a = -> (a:) { a }
ruby
- lambda { @a.() }.should raise_error(ArgumentError)
+ -> { @a.() }.should raise_error(ArgumentError)
@a.(a: 1).should == 1
end
@@ -129,7 +129,7 @@ describe "A lambda literal -> () { }" do
@a.().should be_nil
@a.(a: 1, b: 2).should be_nil
- lambda { @a.(1) }.should raise_error(ArgumentError)
+ -> { @a.(1) }.should raise_error(ArgumentError)
end
evaluate <<-ruby do
@@ -153,8 +153,8 @@ describe "A lambda literal -> () { }" do
ruby
@a.(1, 2).should == [1, 2]
- lambda { @a.() }.should raise_error(ArgumentError)
- lambda { @a.(1) }.should raise_error(ArgumentError)
+ -> { @a.() }.should raise_error(ArgumentError)
+ -> { @a.(1) }.should raise_error(ArgumentError)
end
evaluate <<-ruby do
@@ -283,7 +283,7 @@ describe "A lambda literal -> () { }" do
it "calls an existing method with the same name as the argument if explicitly using ()" do
def a; 1; end
- -> (a=a()) { a }.call.should == 1
+ -> a=a() { a }.call.should == 1
end
end
end
diff --git a/spec/ruby/language/line_spec.rb b/spec/ruby/language/line_spec.rb
index aac039a941..fcadaa71d7 100644
--- a/spec/ruby/language/line_spec.rb
+++ b/spec/ruby/language/line_spec.rb
@@ -4,7 +4,7 @@ require_relative 'shared/__LINE__'
describe "The __LINE__ pseudo-variable" do
it "raises a SyntaxError if assigned to" do
- lambda { eval("__LINE__ = 1") }.should raise_error(SyntaxError)
+ -> { eval("__LINE__ = 1") }.should raise_error(SyntaxError)
end
before :each do
diff --git a/spec/ruby/language/loop_spec.rb b/spec/ruby/language/loop_spec.rb
index 121872a104..fd17b53910 100644
--- a/spec/ruby/language/loop_spec.rb
+++ b/spec/ruby/language/loop_spec.rb
@@ -15,7 +15,7 @@ describe "The loop expression" do
inner_loop = 123
break
end
- lambda { inner_loop }.should raise_error(NameError)
+ -> { inner_loop }.should raise_error(NameError)
end
it "returns the value passed to break if interrupted by break" do
diff --git a/spec/ruby/language/metaclass_spec.rb b/spec/ruby/language/metaclass_spec.rb
index a6525a3ef2..fc83067977 100644
--- a/spec/ruby/language/metaclass_spec.rb
+++ b/spec/ruby/language/metaclass_spec.rb
@@ -16,11 +16,11 @@ describe "self in a metaclass body (class << obj)" do
end
it "raises a TypeError for numbers" do
- lambda { class << 1; self; end }.should raise_error(TypeError)
+ -> { class << 1; self; end }.should raise_error(TypeError)
end
it "raises a TypeError for symbols" do
- lambda { class << :symbol; self; end }.should raise_error(TypeError)
+ -> { class << :symbol; self; end }.should raise_error(TypeError)
end
it "is a singleton Class instance" do
@@ -64,11 +64,11 @@ describe "A constant on a metaclass" do
class << @object
CONST
end
- lambda { CONST }.should raise_error(NameError)
+ -> { CONST }.should raise_error(NameError)
end
it "cannot be accessed via object::CONST" do
- lambda do
+ -> do
@object::CONST
end.should raise_error(TypeError)
end
@@ -79,7 +79,7 @@ describe "A constant on a metaclass" do
CONST = 100
end
- lambda do
+ -> do
@object::CONST
end.should raise_error(NameError)
end
@@ -96,7 +96,7 @@ describe "A constant on a metaclass" do
it "is not preserved when the object is duped" do
@object = @object.dup
- lambda do
+ -> do
class << @object; CONST; end
end.should raise_error(NameError)
end
diff --git a/spec/ruby/language/method_spec.rb b/spec/ruby/language/method_spec.rb
index b0fc521d69..3e5ff3fbb5 100644
--- a/spec/ruby/language/method_spec.rb
+++ b/spec/ruby/language/method_spec.rb
@@ -40,7 +40,7 @@ describe "A method send" do
x = mock("splat argument")
x.should_receive(:to_a).and_return(1)
- lambda { m(*x) }.should raise_error(TypeError)
+ -> { m(*x) }.should raise_error(TypeError)
end
end
@@ -74,7 +74,7 @@ describe "A method send" do
x = mock("splat argument")
x.should_receive(:to_a).and_return(1)
- lambda { m(*x, 2, 3) }.should raise_error(TypeError)
+ -> { m(*x, 2, 3) }.should raise_error(TypeError)
end
end
@@ -108,7 +108,7 @@ describe "A method send" do
x = mock("splat argument")
x.should_receive(:to_a).and_return(1)
- lambda { m(1, *x, 2, 3) }.should raise_error(TypeError)
+ -> { m(1, *x, 2, 3) }.should raise_error(TypeError)
end
it "copies the splatted array" do
@@ -153,7 +153,7 @@ describe "A method send" do
x = mock("splat argument")
x.should_receive(:to_a).and_return(1)
- lambda { m(1, 2, *x) }.should raise_error(TypeError)
+ -> { m(1, 2, *x) }.should raise_error(TypeError)
end
end
end
@@ -197,7 +197,7 @@ describe "An element assignment method send" do
x = mock("splat argument")
x.should_receive(:to_a).and_return(1)
- lambda { @o[*x] = 1 }.should raise_error(TypeError)
+ -> { @o[*x] = 1 }.should raise_error(TypeError)
end
end
@@ -235,7 +235,7 @@ describe "An element assignment method send" do
x = mock("splat argument")
x.should_receive(:to_a).and_return(1)
- lambda { @o[*x, 2, 3] = 4 }.should raise_error(TypeError)
+ -> { @o[*x, 2, 3] = 4 }.should raise_error(TypeError)
end
end
@@ -273,7 +273,7 @@ describe "An element assignment method send" do
x = mock("splat argument")
x.should_receive(:to_a).and_return(1)
- lambda { @o[1, 2, *x, 3] = 4 }.should raise_error(TypeError)
+ -> { @o[1, 2, *x, 3] = 4 }.should raise_error(TypeError)
end
end
@@ -311,7 +311,7 @@ describe "An element assignment method send" do
x = mock("splat argument")
x.should_receive(:to_a).and_return(1)
- lambda { @o[1, 2, 3, *x] = 4 }.should raise_error(TypeError)
+ -> { @o[1, 2, 3, *x] = 4 }.should raise_error(TypeError)
end
end
end
@@ -348,7 +348,7 @@ describe "An attribute assignment method send" do
x = mock("splat argument")
x.should_receive(:to_a).and_return(1)
- lambda { @o.send :m=, *x, 1 }.should raise_error(TypeError)
+ -> { @o.send :m=, *x, 1 }.should raise_error(TypeError)
end
end
@@ -383,7 +383,7 @@ describe "An attribute assignment method send" do
x = mock("splat argument")
x.should_receive(:to_a).and_return(1)
- lambda { @o.send :m=, *x, 2, 3, 4 }.should raise_error(TypeError)
+ -> { @o.send :m=, *x, 2, 3, 4 }.should raise_error(TypeError)
end
end
@@ -418,7 +418,7 @@ describe "An attribute assignment method send" do
x = mock("splat argument")
x.should_receive(:to_a).and_return(1)
- lambda { @o.send :m=, 1, 2, *x, 3, 4 }.should raise_error(TypeError)
+ -> { @o.send :m=, 1, 2, *x, 3, 4 }.should raise_error(TypeError)
end
end
@@ -453,7 +453,7 @@ describe "An attribute assignment method send" do
x = mock("splat argument")
x.should_receive(:to_a).and_return(1)
- lambda { @o.send :m=, 1, 2, 3, *x, 4 }.should raise_error(TypeError)
+ -> { @o.send :m=, 1, 2, 3, *x, 4 }.should raise_error(TypeError)
end
end
end
@@ -544,9 +544,9 @@ describe "A method" do
def m(a:) a end
ruby
- lambda { m() }.should raise_error(ArgumentError)
+ -> { m() }.should raise_error(ArgumentError)
m(a: 1).should == 1
- lambda { m("a" => 1, a: 1) }.should raise_error(ArgumentError)
+ -> { m("a" => 1, a: 1) }.should raise_error(ArgumentError)
end
evaluate <<-ruby do
@@ -563,7 +563,7 @@ describe "A method" do
m().should be_nil
m(a: 1, b: 2).should be_nil
- lambda { m(1) }.should raise_error(ArgumentError)
+ -> { m(1) }.should raise_error(ArgumentError)
end
evaluate <<-ruby do
@@ -575,7 +575,7 @@ describe "A method" do
m(*[]).should == {}
m(**{}).should == {}
m(**{a: 1, b: 2}, **{a: 4, c: 7}).should == { a: 4, b: 2, c: 7 }
- lambda { m(2) }.should raise_error(ArgumentError)
+ -> { m(2) }.should raise_error(ArgumentError)
end
evaluate <<-ruby do
@@ -614,7 +614,7 @@ describe "A method" do
m(2, 3).should be_nil
m([2, 3, 4], [5, 6]).should be_nil
- lambda { m a: 1 }.should raise_error(ArgumentError)
+ -> { m a: 1 }.should raise_error(ArgumentError)
end
evaluate <<-ruby do
@@ -706,7 +706,7 @@ describe "A method" do
ruby
m(1, b: 2).should == [1, 2]
- lambda { m("a" => 1, b: 2) }.should raise_error(ArgumentError)
+ -> { m("a" => 1, b: 2) }.should raise_error(ArgumentError)
end
evaluate <<-ruby do
@@ -808,8 +808,8 @@ describe "A method" do
def m(a=1, (*b), (*c)) [a, b, c] end
ruby
- lambda { m() }.should raise_error(ArgumentError)
- lambda { m(2) }.should raise_error(ArgumentError)
+ -> { m() }.should raise_error(ArgumentError)
+ -> { m(2) }.should raise_error(ArgumentError)
m(2, 3).should == [1, [2], [3]]
m(2, [3, 4], [5, 6]).should == [2, [3, 4], [5, 6]]
end
@@ -966,7 +966,7 @@ describe "A method" do
h = mock("keyword splat")
error = RuntimeError.new("error while converting to a hash")
h.should_receive(:to_hash).and_raise(error)
- lambda { m(h) }.should raise_error(error)
+ -> { m(h) }.should raise_error(error)
end
evaluate <<-ruby do
@@ -980,7 +980,7 @@ describe "A method" do
h = mock("keyword splat")
h.should_receive(:to_hash)
- lambda { m(**h) }.should raise_error(TypeError)
+ -> { m(**h) }.should raise_error(TypeError)
end
evaluate <<-ruby do
@@ -1077,7 +1077,7 @@ describe "A method" do
ruby
m(a: 1, b: 2).should == [1, 2]
- lambda { m("a" => 1, a: 1, b: 2) }.should raise_error(ArgumentError)
+ -> { m("a" => 1, a: 1, b: 2) }.should raise_error(ArgumentError)
end
evaluate <<-ruby do
@@ -1086,7 +1086,7 @@ describe "A method" do
m(a: 1).should == [1, 1]
m(a: 1, b: 2).should == [1, 2]
- lambda { m("a" => 1, a: 1, b: 2) }.should raise_error(ArgumentError)
+ -> { m("a" => 1, a: 1, b: 2) }.should raise_error(ArgumentError)
end
evaluate <<-ruby do
@@ -1095,7 +1095,7 @@ describe "A method" do
m(a: 1).should == 1
m(a: 1, b: 2).should == 1
- lambda { m("a" => 1, a: 1, b: 2) }.should raise_error(ArgumentError)
+ -> { m("a" => 1, a: 1, b: 2) }.should raise_error(ArgumentError)
end
evaluate <<-ruby do
@@ -1104,7 +1104,7 @@ describe "A method" do
m(a: 1).should == [1, {}]
m(a: 1, b: 2, c: 3).should == [1, {b: 2, c: 3}]
- lambda { m("a" => 1, a: 1, b: 2) }.should raise_error(ArgumentError)
+ -> { m("a" => 1, a: 1, b: 2) }.should raise_error(ArgumentError)
end
evaluate <<-ruby do
@@ -1224,7 +1224,7 @@ describe "A method" do
ruby
options = {a: 1}.freeze
- lambda do
+ -> do
m(options).should == 1
end.should_not raise_error
options.should == {a: 1}
@@ -1259,11 +1259,11 @@ describe "A method call with a space between method name and parentheses" do
context "when 2+ arguments provided" do
it "raises a syntax error" do
- lambda {
+ -> {
eval("m (1, 2)")
}.should raise_error(SyntaxError)
- lambda {
+ -> {
eval("m (1, 2, 3)")
}.should raise_error(SyntaxError)
end
diff --git a/spec/ruby/language/module_spec.rb b/spec/ruby/language/module_spec.rb
index 72d0046fb8..1b41e184bb 100644
--- a/spec/ruby/language/module_spec.rb
+++ b/spec/ruby/language/module_spec.rb
@@ -34,29 +34,29 @@ describe "The module keyword" do
end
it "raises a TypeError if the constant is a Class" do
- lambda do
+ -> do
module ModuleSpecs::Modules::Klass; end
end.should raise_error(TypeError)
end
it "raises a TypeError if the constant is a String" do
- lambda { module ModuleSpecs::Modules::A; end }.should raise_error(TypeError)
+ -> { module ModuleSpecs::Modules::A; end }.should raise_error(TypeError)
end
it "raises a TypeError if the constant is a Fixnum" do
- lambda { module ModuleSpecs::Modules::B; end }.should raise_error(TypeError)
+ -> { module ModuleSpecs::Modules::B; end }.should raise_error(TypeError)
end
it "raises a TypeError if the constant is nil" do
- lambda { module ModuleSpecs::Modules::C; end }.should raise_error(TypeError)
+ -> { module ModuleSpecs::Modules::C; end }.should raise_error(TypeError)
end
it "raises a TypeError if the constant is true" do
- lambda { module ModuleSpecs::Modules::D; end }.should raise_error(TypeError)
+ -> { module ModuleSpecs::Modules::D; end }.should raise_error(TypeError)
end
it "raises a TypeError if the constant is false" do
- lambda { module ModuleSpecs::Modules::D; end }.should raise_error(TypeError)
+ -> { module ModuleSpecs::Modules::D; end }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/language/next_spec.rb b/spec/ruby/language/next_spec.rb
index e0a0265ac6..6fbfc4a54d 100644
--- a/spec/ruby/language/next_spec.rb
+++ b/spec/ruby/language/next_spec.rb
@@ -8,7 +8,7 @@ describe "The next statement from within the block" do
it "ends block execution" do
a = []
- lambda {
+ -> {
a << 1
next
a << 2
@@ -17,15 +17,15 @@ describe "The next statement from within the block" do
end
it "causes block to return nil if invoked without arguments" do
- lambda { 123; next; 456 }.call.should == nil
+ -> { 123; next; 456 }.call.should == nil
end
it "causes block to return nil if invoked with an empty expression" do
- lambda { next (); 456 }.call.should be_nil
+ -> { next (); 456 }.call.should be_nil
end
it "returns the argument passed" do
- lambda { 123; next 234; 345 }.call.should == 234
+ -> { 123; next 234; 345 }.call.should == 234
end
it "returns to the invoking method" do
@@ -102,14 +102,14 @@ describe "The next statement from within the block" do
it "passes the value returned by a method with omitted parenthesis and passed block" do
obj = NextSpecs::Block.new
- lambda { next obj.method :value do |x| x end }.call.should == :value
+ -> { next obj.method :value do |x| x end }.call.should == :value
end
end
describe "The next statement" do
describe "in a method" do
it "is invalid and raises a SyntaxError" do
- lambda {
+ -> {
eval("def m; next; end")
}.should raise_error(SyntaxError)
end
diff --git a/spec/ruby/language/numbers_spec.rb b/spec/ruby/language/numbers_spec.rb
index 080c4ae6a3..c82a630632 100644
--- a/spec/ruby/language/numbers_spec.rb
+++ b/spec/ruby/language/numbers_spec.rb
@@ -11,7 +11,7 @@ describe "A number literal" do
end
it "cannot have a leading underscore" do
- lambda { eval("_4_2") }.should raise_error(NameError)
+ -> { eval("_4_2") }.should raise_error(NameError)
end
it "can have a decimal point" do
@@ -20,8 +20,8 @@ describe "A number literal" do
it "must have a digit before the decimal point" do
0.75.should == 0.75
- lambda { eval(".75") }.should raise_error(SyntaxError)
- lambda { eval("-.75") }.should raise_error(SyntaxError)
+ -> { eval(".75") }.should raise_error(SyntaxError)
+ -> { eval("-.75") }.should raise_error(SyntaxError)
end
it "can have an exponent" do
diff --git a/spec/ruby/language/optional_assignments_spec.rb b/spec/ruby/language/optional_assignments_spec.rb
index 29103c67fd..04abc2496b 100644
--- a/spec/ruby/language/optional_assignments_spec.rb
+++ b/spec/ruby/language/optional_assignments_spec.rb
@@ -280,7 +280,7 @@ describe 'Optional variable assignments' do
end
it 'with &&= assignments will fail with non-existent constants' do
- lambda { Object::A &&= 10 }.should raise_error(NameError)
+ -> { Object::A &&= 10 }.should raise_error(NameError)
end
it 'with operator assignments' do
@@ -292,7 +292,7 @@ describe 'Optional variable assignments' do
end
it 'with operator assignments will fail with non-existent constants' do
- lambda { Object::A += 10 }.should raise_error(NameError)
+ -> { Object::A += 10 }.should raise_error(NameError)
end
end
end
diff --git a/spec/ruby/language/or_spec.rb b/spec/ruby/language/or_spec.rb
index 88241f39e6..fb75e788f1 100644
--- a/spec/ruby/language/or_spec.rb
+++ b/spec/ruby/language/or_spec.rb
@@ -35,15 +35,15 @@ describe "The || operator" do
it "has a higher precedence than 'break' in 'break true || false'" do
# see also 'break true or false' below
- lambda { break false || true }.call.should be_true
+ -> { break false || true }.call.should be_true
end
it "has a higher precedence than 'next' in 'next true || false'" do
- lambda { next false || true }.call.should be_true
+ -> { next false || true }.call.should be_true
end
it "has a higher precedence than 'return' in 'return true || false'" do
- lambda { return false || true }.call.should be_true
+ -> { return false || true }.call.should be_true
end
end
@@ -77,14 +77,14 @@ describe "The or operator" do
it "has a lower precedence than 'break' in 'break true or false'" do
# see also 'break true || false' above
- lambda { eval "break true or false" }.should raise_error(SyntaxError, /void value expression/)
+ -> { eval "break true or false" }.should raise_error(SyntaxError, /void value expression/)
end
it "has a lower precedence than 'next' in 'next true or false'" do
- lambda { eval "next true or false" }.should raise_error(SyntaxError, /void value expression/)
+ -> { eval "next true or false" }.should raise_error(SyntaxError, /void value expression/)
end
it "has a lower precedence than 'return' in 'return true or false'" do
- lambda { eval "return true or false" }.should raise_error(SyntaxError, /void value expression/)
+ -> { eval "return true or false" }.should raise_error(SyntaxError, /void value expression/)
end
end
diff --git a/spec/ruby/language/precedence_spec.rb b/spec/ruby/language/precedence_spec.rb
index a342c82156..a911f765b0 100644
--- a/spec/ruby/language/precedence_spec.rb
+++ b/spec/ruby/language/precedence_spec.rb
@@ -253,12 +253,12 @@ describe "Operators" do
end
it "<=> == === != =~ !~ are non-associative" do
- lambda { eval("1 <=> 2 <=> 3") }.should raise_error(SyntaxError)
- lambda { eval("1 == 2 == 3") }.should raise_error(SyntaxError)
- lambda { eval("1 === 2 === 3") }.should raise_error(SyntaxError)
- lambda { eval("1 != 2 != 3") }.should raise_error(SyntaxError)
- lambda { eval("1 =~ 2 =~ 3") }.should raise_error(SyntaxError)
- lambda { eval("1 !~ 2 !~ 3") }.should raise_error(SyntaxError)
+ -> { eval("1 <=> 2 <=> 3") }.should raise_error(SyntaxError)
+ -> { eval("1 == 2 == 3") }.should raise_error(SyntaxError)
+ -> { eval("1 === 2 === 3") }.should raise_error(SyntaxError)
+ -> { eval("1 != 2 != 3") }.should raise_error(SyntaxError)
+ -> { eval("1 =~ 2 =~ 3") }.should raise_error(SyntaxError)
+ -> { eval("1 !~ 2 !~ 3") }.should raise_error(SyntaxError)
end
it "<=> == === != =~ !~ have higher precedence than &&" do
@@ -292,8 +292,8 @@ describe "Operators" do
end
it ".. ... are non-associative" do
- lambda { eval("1..2..3") }.should raise_error(SyntaxError)
- lambda { eval("1...2...3") }.should raise_error(SyntaxError)
+ -> { eval("1..2..3") }.should raise_error(SyntaxError)
+ -> { eval("1...2...3") }.should raise_error(SyntaxError)
end
it ".. ... have higher precedence than ? :" do
diff --git a/spec/ruby/language/predefined_spec.rb b/spec/ruby/language/predefined_spec.rb
index 61ca0d8237..90ea8c6bb1 100644
--- a/spec/ruby/language/predefined_spec.rb
+++ b/spec/ruby/language/predefined_spec.rb
@@ -92,8 +92,8 @@ describe "Predefined global $~" do
$~ = /foo/.match("foo")
$~.should be_an_instance_of(MatchData)
- lambda { $~ = Object.new }.should raise_error(TypeError)
- lambda { $~ = 1 }.should raise_error(TypeError)
+ -> { $~ = Object.new }.should raise_error(TypeError)
+ -> { $~ = 1 }.should raise_error(TypeError)
end
it "changes the value of derived capture globals when assigned" do
@@ -233,12 +233,12 @@ describe "Predefined global $stdout" do
end
it "raises TypeError error if assigned to nil" do
- lambda { $stdout = nil }.should raise_error(TypeError)
+ -> { $stdout = nil }.should raise_error(TypeError)
end
it "raises TypeError error if assigned to object that doesn't respond to #write" do
obj = mock('object')
- lambda { $stdout = obj }.should raise_error(TypeError)
+ -> { $stdout = obj }.should raise_error(TypeError)
obj.stub!(:write)
$stdout = obj
@@ -562,15 +562,15 @@ describe "Predefined global $/" do
obj = mock("$/ value")
obj.should_not_receive(:to_str)
- lambda { $/ = obj }.should raise_error(TypeError)
+ -> { $/ = obj }.should raise_error(TypeError)
end
it "raises a TypeError if assigned a Fixnum" do
- lambda { $/ = 1 }.should raise_error(TypeError)
+ -> { $/ = 1 }.should raise_error(TypeError)
end
it "raises a TypeError if assigned a boolean" do
- lambda { $/ = true }.should raise_error(TypeError)
+ -> { $/ = true }.should raise_error(TypeError)
end
end
@@ -609,15 +609,15 @@ describe "Predefined global $-0" do
obj = mock("$-0 value")
obj.should_not_receive(:to_str)
- lambda { $-0 = obj }.should raise_error(TypeError)
+ -> { $-0 = obj }.should raise_error(TypeError)
end
it "raises a TypeError if assigned a Fixnum" do
- lambda { $-0 = 1 }.should raise_error(TypeError)
+ -> { $-0 = 1 }.should raise_error(TypeError)
end
it "raises a TypeError if assigned a boolean" do
- lambda { $-0 = true }.should raise_error(TypeError)
+ -> { $-0 = true }.should raise_error(TypeError)
end
end
@@ -631,7 +631,7 @@ describe "Predefined global $," do
end
it "raises TypeError if assigned a non-String" do
- lambda { $, = Object.new }.should raise_error(TypeError)
+ -> { $, = Object.new }.should raise_error(TypeError)
end
end
@@ -658,7 +658,7 @@ describe "Predefined global $." do
obj = mock("bad-value")
obj.should_receive(:to_int).and_return('abc')
- lambda { $. = obj }.should raise_error(TypeError)
+ -> { $. = obj }.should raise_error(TypeError)
end
end
@@ -802,15 +802,15 @@ describe "Execution variable $:" do
end
it "is read-only" do
- lambda {
+ -> {
$: = []
}.should raise_error(NameError)
- lambda {
+ -> {
$LOAD_PATH = []
}.should raise_error(NameError)
- lambda {
+ -> {
$-I = []
}.should raise_error(NameError)
end
@@ -822,11 +822,11 @@ describe "Global variable $\"" do
end
it "is read-only" do
- lambda {
+ -> {
$" = []
}.should raise_error(NameError)
- lambda {
+ -> {
$LOADED_FEATURES = []
}.should raise_error(NameError)
end
@@ -834,7 +834,7 @@ end
describe "Global variable $<" do
it "is read-only" do
- lambda {
+ -> {
$< = nil
}.should raise_error(NameError)
end
@@ -842,7 +842,7 @@ end
describe "Global variable $FILENAME" do
it "is read-only" do
- lambda {
+ -> {
$FILENAME = "-"
}.should raise_error(NameError)
end
@@ -850,7 +850,7 @@ end
describe "Global variable $?" do
it "is read-only" do
- lambda {
+ -> {
$? = nil
}.should raise_error(NameError)
end
@@ -863,19 +863,19 @@ end
describe "Global variable $-a" do
it "is read-only" do
- lambda { $-a = true }.should raise_error(NameError)
+ -> { $-a = true }.should raise_error(NameError)
end
end
describe "Global variable $-l" do
it "is read-only" do
- lambda { $-l = true }.should raise_error(NameError)
+ -> { $-l = true }.should raise_error(NameError)
end
end
describe "Global variable $-p" do
it "is read-only" do
- lambda { $-p = true }.should raise_error(NameError)
+ -> { $-p = true }.should raise_error(NameError)
end
end
@@ -974,7 +974,7 @@ describe "Global variable $0" do
end
it "raises a TypeError when not given an object that can be coerced to a String" do
- lambda { $0 = nil }.should raise_error(TypeError)
+ -> { $0 = nil }.should raise_error(TypeError)
end
end
@@ -1016,7 +1016,7 @@ describe "The predefined standard object nil" do
end
it "raises a SyntaxError if assigned to" do
- lambda { eval("nil = true") }.should raise_error(SyntaxError)
+ -> { eval("nil = true") }.should raise_error(SyntaxError)
end
end
@@ -1026,7 +1026,7 @@ describe "The predefined standard object true" do
end
it "raises a SyntaxError if assigned to" do
- lambda { eval("true = false") }.should raise_error(SyntaxError)
+ -> { eval("true = false") }.should raise_error(SyntaxError)
end
end
@@ -1036,13 +1036,13 @@ describe "The predefined standard object false" do
end
it "raises a SyntaxError if assigned to" do
- lambda { eval("false = nil") }.should raise_error(SyntaxError)
+ -> { eval("false = nil") }.should raise_error(SyntaxError)
end
end
describe "The self pseudo-variable" do
it "raises a SyntaxError if assigned to" do
- lambda { eval("self = 1") }.should raise_error(SyntaxError)
+ -> { eval("self = 1") }.should raise_error(SyntaxError)
end
end
diff --git a/spec/ruby/language/private_spec.rb b/spec/ruby/language/private_spec.rb
index e7a871b09b..ddf185e6d2 100644
--- a/spec/ruby/language/private_spec.rb
+++ b/spec/ruby/language/private_spec.rb
@@ -5,11 +5,11 @@ describe "The private keyword" do
it "marks following methods as being private" do
a = Private::A.new
a.methods.should_not include(:bar)
- lambda { a.bar }.should raise_error(NoMethodError)
+ -> { a.bar }.should raise_error(NoMethodError)
b = Private::B.new
b.methods.should_not include(:bar)
- lambda { b.bar }.should raise_error(NoMethodError)
+ -> { b.bar }.should raise_error(NoMethodError)
end
# def expr.meth() methods are always public
@@ -22,7 +22,7 @@ describe "The private keyword" do
c.methods.should include(:baz)
c.baz
Private::B.public_class_method1.should == 1
- lambda { Private::B.private_class_method1 }.should raise_error(NoMethodError)
+ -> { Private::B.private_class_method1 }.should raise_error(NoMethodError)
end
it "is no longer in effect when the class is closed" do
@@ -42,12 +42,12 @@ describe "The private keyword" do
klass.class_eval do
private :foo
end
- lambda { f.foo }.should raise_error(NoMethodError)
+ -> { f.foo }.should raise_error(NoMethodError)
end
it "changes visibility of previously called methods with same send/call site" do
g = ::Private::G.new
- lambda {
+ -> {
2.times do
g.foo
module ::Private
@@ -61,7 +61,7 @@ describe "The private keyword" do
it "changes the visibility of the existing method in the subclass" do
::Private::A.new.foo.should == 'foo'
- lambda {::Private::H.new.foo}.should raise_error(NoMethodError)
+ -> { ::Private::H.new.foo }.should raise_error(NoMethodError)
::Private::H.new.send(:foo).should == 'foo'
end
end
diff --git a/spec/ruby/language/redo_spec.rb b/spec/ruby/language/redo_spec.rb
index fe1bcef0a1..57532553b3 100644
--- a/spec/ruby/language/redo_spec.rb
+++ b/spec/ruby/language/redo_spec.rb
@@ -3,7 +3,7 @@ require_relative '../spec_helper'
describe "The redo statement" do
it "restarts block execution if used within block" do
a = []
- lambda {
+ -> {
a << 1
redo if a.size < 2
a << 2
@@ -58,7 +58,7 @@ describe "The redo statement" do
describe "in a method" do
it "is invalid and raises a SyntaxError" do
- lambda {
+ -> {
eval("def m; redo; end")
}.should raise_error(SyntaxError)
end
diff --git a/spec/ruby/language/regexp/character_classes_spec.rb b/spec/ruby/language/regexp/character_classes_spec.rb
index c0f69bea9b..5f4221e213 100644
--- a/spec/ruby/language/regexp/character_classes_spec.rb
+++ b/spec/ruby/language/regexp/character_classes_spec.rb
@@ -89,7 +89,7 @@ describe "Regexp with character classes" do
/[^[:lower:]A-C]+/.match("abcABCDEF123def").to_a.should == ["DEF123"] # negated character class
/[:alnum:]+/.match("a:l:n:u:m").to_a.should == ["a:l:n:u:m"] # should behave like regular character class composed of the individual letters
/[\[:alnum:]+/.match("[:a:l:n:u:m").to_a.should == ["[:a:l:n:u:m"] # should behave like regular character class composed of the individual letters
- lambda { eval('/[[:alpha:]-[:digit:]]/') }.should raise_error(SyntaxError) # can't use character class as a start value of range
+ -> { eval('/[[:alpha:]-[:digit:]]/') }.should raise_error(SyntaxError) # can't use character class as a start value of range
end
it "matches ASCII characters with [[:ascii:]]" do
diff --git a/spec/ruby/language/regexp/escapes_spec.rb b/spec/ruby/language/regexp/escapes_spec.rb
index 17501af8c6..14e1424d47 100644
--- a/spec/ruby/language/regexp/escapes_spec.rb
+++ b/spec/ruby/language/regexp/escapes_spec.rb
@@ -48,7 +48,7 @@ describe "Regexps with escape characters" do
/\x0AA/.match("\nA").to_a.should == ["\nA"]
/\xAG/.match("\nG").to_a.should == ["\nG"]
# Non-matches
- lambda { eval('/\xG/') }.should raise_error(SyntaxError)
+ -> { eval('/\xG/') }.should raise_error(SyntaxError)
# \x{7HHHHHHH} wide hexadecimal char (character code point value)
end
@@ -69,9 +69,9 @@ describe "Regexps with escape characters" do
# Parsing precedence
/\cJ+/.match("\n\n").to_a.should == ["\n\n"] # Quantifiers apply to entire escape sequence
/\\cJ/.match("\\cJ").to_a.should == ["\\cJ"]
- lambda { eval('/[abc\x]/') }.should raise_error(SyntaxError) # \x is treated as a escape sequence even inside a character class
+ -> { eval('/[abc\x]/') }.should raise_error(SyntaxError) # \x is treated as a escape sequence even inside a character class
# Syntax error
- lambda { eval('/\c/') }.should raise_error(SyntaxError)
+ -> { eval('/\c/') }.should raise_error(SyntaxError)
# \cx control char (character code point value)
# \C-x control char (character code point value)
diff --git a/spec/ruby/language/regexp/grouping_spec.rb b/spec/ruby/language/regexp/grouping_spec.rb
index 61a52cba15..8806d06746 100644
--- a/spec/ruby/language/regexp/grouping_spec.rb
+++ b/spec/ruby/language/regexp/grouping_spec.rb
@@ -12,7 +12,7 @@ describe "Regexps with grouping" do
end
it "raises a SyntaxError when parentheses aren't balanced" do
- lambda { eval "/(hay(st)ack/" }.should raise_error(SyntaxError)
+ -> { eval "/(hay(st)ack/" }.should raise_error(SyntaxError)
end
it "supports (?: ) (non-capturing group)" do
diff --git a/spec/ruby/language/regexp/interpolation_spec.rb b/spec/ruby/language/regexp/interpolation_spec.rb
index c25a3cdb78..ed0b724763 100644
--- a/spec/ruby/language/regexp/interpolation_spec.rb
+++ b/spec/ruby/language/regexp/interpolation_spec.rb
@@ -41,9 +41,9 @@ describe "Regexps with interpolation" do
it "throws RegexpError for malformed interpolation" do
s = ""
- lambda { /(#{s}/ }.should raise_error(RegexpError)
+ -> { /(#{s}/ }.should raise_error(RegexpError)
s = "("
- lambda { /#{s}/ }.should raise_error(RegexpError)
+ -> { /#{s}/ }.should raise_error(RegexpError)
end
it "allows interpolation in extended mode" do
diff --git a/spec/ruby/language/regexp/modifiers_spec.rb b/spec/ruby/language/regexp/modifiers_spec.rb
index f0051ca55d..9f3cf8acf8 100644
--- a/spec/ruby/language/regexp/modifiers_spec.rb
+++ b/spec/ruby/language/regexp/modifiers_spec.rb
@@ -36,7 +36,7 @@ describe "Regexps with modifiers" do
/foo/imox.match("foo").to_a.should == ["foo"]
/foo/imoximox.match("foo").to_a.should == ["foo"]
- lambda { eval('/foo/a') }.should raise_error(SyntaxError)
+ -> { eval('/foo/a') }.should raise_error(SyntaxError)
end
it "supports (?~) (absent operator)" do
@@ -76,7 +76,7 @@ describe "Regexps with modifiers" do
/(?i-i)foo/.match("FOO").should be_nil
/(?ii)foo/.match("FOO").to_a.should == ["FOO"]
/(?-)foo/.match("foo").to_a.should == ["foo"]
- lambda { eval('/(?o)/') }.should raise_error(SyntaxError)
+ -> { eval('/(?o)/') }.should raise_error(SyntaxError)
end
it "supports (?imx-imx:expr) (scoped inline modifiers)" do
@@ -96,7 +96,7 @@ describe "Regexps with modifiers" do
/(?i-i:foo)/.match("FOO").should be_nil
/(?ii:foo)/.match("FOO").to_a.should == ["FOO"]
/(?-:)foo/.match("foo").to_a.should == ["foo"]
- lambda { eval('/(?o:)/') }.should raise_error(SyntaxError)
+ -> { eval('/(?o:)/') }.should raise_error(SyntaxError)
end
it "supports . with /m" do
diff --git a/spec/ruby/language/regexp_spec.rb b/spec/ruby/language/regexp_spec.rb
index aae5156dcd..67c7c034e9 100644
--- a/spec/ruby/language/regexp_spec.rb
+++ b/spec/ruby/language/regexp_spec.rb
@@ -27,7 +27,7 @@ describe "Literal Regexps" do
end
it "throws SyntaxError for malformed literals" do
- lambda { eval('/(/') }.should raise_error(SyntaxError)
+ -> { eval('/(/') }.should raise_error(SyntaxError)
end
#############################################################################
@@ -54,7 +54,7 @@ describe "Literal Regexps" do
it "disallows first part of paired delimiters to be used as non-paired delimiters" do
LanguageSpecs.paired_delimiters.each do |p0, p1|
- lambda { eval("%r#{p0} foo #{p0}") }.should raise_error(SyntaxError)
+ -> { eval("%r#{p0} foo #{p0}") }.should raise_error(SyntaxError)
end
end
@@ -65,11 +65,11 @@ describe "Literal Regexps" do
end
it "disallows alphabets as non-paired delimiter with %r" do
- lambda { eval('%ra foo a') }.should raise_error(SyntaxError)
+ -> { eval('%ra foo a') }.should raise_error(SyntaxError)
end
it "disallows spaces after %r and delimiter" do
- lambda { eval('%r !foo!') }.should raise_error(SyntaxError)
+ -> { eval('%r !foo!') }.should raise_error(SyntaxError)
end
it "allows unescaped / to be used with %r" do
diff --git a/spec/ruby/language/rescue_spec.rb b/spec/ruby/language/rescue_spec.rb
index b0eb949c1a..a912e17431 100644
--- a/spec/ruby/language/rescue_spec.rb
+++ b/spec/ruby/language/rescue_spec.rb
@@ -54,7 +54,7 @@ describe "The rescue keyword" do
end
it "can rescue multiple raised exceptions with a single rescue block" do
- [lambda{raise ArbitraryException}, lambda{raise SpecificExampleException}].map do |block|
+ [->{raise ArbitraryException}, ->{raise SpecificExampleException}].map do |block|
begin
block.call
rescue SpecificExampleException, ArbitraryException
@@ -72,7 +72,7 @@ describe "The rescue keyword" do
end
caught_it.should be_true
caught = []
- [lambda{raise ArbitraryException}, lambda{raise SpecificExampleException}].each do |block|
+ [->{raise ArbitraryException}, ->{raise SpecificExampleException}].each do |block|
begin
block.call
rescue *exception_list
@@ -94,7 +94,7 @@ describe "The rescue keyword" do
end
caught_it.should be_true
caught = []
- [lambda{raise ArbitraryException}, lambda{raise SpecificExampleException}].each do |block|
+ [->{raise ArbitraryException}, ->{raise SpecificExampleException}].each do |block|
begin
block.call
rescue ArbitraryException, *exception_list
@@ -108,7 +108,7 @@ describe "The rescue keyword" do
end
it "will only rescue the specified exceptions when doing a splat rescue" do
- lambda do
+ -> do
begin
raise OtherCustomException, "not rescued!"
rescue *exception_list
@@ -210,7 +210,7 @@ describe "The rescue keyword" do
ruby_version_is ''...'2.6' do
it "will execute an else block even without rescue and ensure" do
- lambda {
+ -> {
eval <<-ruby
begin
ScratchPad << :begin
@@ -226,7 +226,7 @@ describe "The rescue keyword" do
ruby_version_is '2.6' do
it "raises SyntaxError when else is used without rescue and ensure" do
- lambda {
+ -> {
eval <<-ruby
begin
ScratchPad << :begin
@@ -294,7 +294,7 @@ describe "The rescue keyword" do
end
it "will not rescue errors raised in an else block in the rescue block above it" do
- lambda do
+ -> do
begin
ScratchPad << :one
rescue Exception
@@ -329,7 +329,7 @@ describe "The rescue keyword" do
[ Exception.new, NoMemoryError.new, ScriptError.new, SecurityError.new,
SignalException.new('INT'), SystemExit.new, SystemStackError.new
].each do |exception|
- lambda {
+ -> {
begin
raise exception
rescue
@@ -361,7 +361,7 @@ describe "The rescue keyword" do
it "only accepts Module or Class in rescue clauses" do
rescuer = 42
- lambda {
+ -> {
begin
raise "error"
rescue rescuer
@@ -373,7 +373,7 @@ describe "The rescue keyword" do
it "only accepts Module or Class in splatted rescue clauses" do
rescuer = [42]
- lambda {
+ -> {
begin
raise "error"
rescue *rescuer
@@ -424,7 +424,7 @@ describe "The rescue keyword" do
end
it "does not allow rescue in {} block" do
- lambda {
+ -> {
eval <<-ruby
lambda {
raise SpecificExampleException
@@ -455,7 +455,7 @@ describe "The rescue keyword" do
end
it "requires the 'rescue' in method arguments to be wrapped in parens" do
- lambda { eval '1.+(1 rescue 1)' }.should raise_error(SyntaxError)
+ -> { eval '1.+(1 rescue 1)' }.should raise_error(SyntaxError)
eval('1.+((1 rescue 1))').should == 2
end
@@ -466,7 +466,7 @@ describe "The rescue keyword" do
end
it "doesn't except rescue expression" do
- lambda {
+ -> {
eval <<-ruby
a = 1 rescue RuntimeError 2
ruby
@@ -477,7 +477,7 @@ describe "The rescue keyword" do
a = raise(StandardError) rescue 1
a.should == 1
- lambda {
+ -> {
a = raise(Exception) rescue 1
}.should raise_error(Exception)
end
diff --git a/spec/ruby/language/retry_spec.rb b/spec/ruby/language/retry_spec.rb
index 0b816daa5c..ee5377946f 100644
--- a/spec/ruby/language/retry_spec.rb
+++ b/spec/ruby/language/retry_spec.rb
@@ -32,7 +32,7 @@ describe "The retry statement" do
end
it "raises a SyntaxError when used outside of a begin statement" do
- lambda { eval 'retry' }.should raise_error(SyntaxError)
+ -> { eval 'retry' }.should raise_error(SyntaxError)
end
end
diff --git a/spec/ruby/language/return_spec.rb b/spec/ruby/language/return_spec.rb
index e697b0b44c..1af88c55cd 100644
--- a/spec/ruby/language/return_spec.rb
+++ b/spec/ruby/language/return_spec.rb
@@ -159,7 +159,7 @@ describe "The return keyword" do
end
it "executes the ensure clause when begin/ensure are inside a lambda" do
- lambda do
+ -> do
begin
return
ensure
@@ -176,15 +176,15 @@ describe "The return keyword" do
end
it "causes lambda to return nil if invoked without any arguments" do
- lambda { return; 456 }.call.should be_nil
+ -> { return; 456 }.call.should be_nil
end
it "causes lambda to return nil if invoked with an empty expression" do
- lambda { return (); 456 }.call.should be_nil
+ -> { return (); 456 }.call.should be_nil
end
it "causes lambda to return the value passed to return" do
- lambda { return 123; 456 }.call.should == 123
+ -> { return 123; 456 }.call.should == 123
end
it "causes the method that lexically encloses the block to return" do
diff --git a/spec/ruby/language/safe_navigator_spec.rb b/spec/ruby/language/safe_navigator_spec.rb
index 46a1a012d1..c3aecff2dd 100644
--- a/spec/ruby/language/safe_navigator_spec.rb
+++ b/spec/ruby/language/safe_navigator_spec.rb
@@ -2,7 +2,7 @@ require_relative '../spec_helper'
describe "Safe navigator" do
it "requires a method name to be provided" do
- lambda { eval("obj&. {}") }.should raise_error(SyntaxError)
+ -> { eval("obj&. {}") }.should raise_error(SyntaxError)
end
context "when context is nil" do
@@ -26,7 +26,7 @@ describe "Safe navigator" do
it "calls the method" do
eval("false&.to_s").should == "false"
- lambda { eval("false&.unknown") }.should raise_error(NoMethodError)
+ -> { eval("false&.unknown") }.should raise_error(NoMethodError)
end
end
@@ -34,7 +34,7 @@ describe "Safe navigator" do
it "calls the method" do
eval("1&.to_s").should == "1"
- lambda { eval("1&.unknown") }.should raise_error(NoMethodError)
+ -> { eval("1&.unknown") }.should raise_error(NoMethodError)
end
end
@@ -90,7 +90,7 @@ describe "Safe navigator" do
end
obj = klass.new
- lambda {
+ -> {
eval("obj&.foo += 3")
}.should raise_error(NoMethodError) { |e|
e.name.should == :+
diff --git a/spec/ruby/language/safe_spec.rb b/spec/ruby/language/safe_spec.rb
index 9b8350c892..be150df9d1 100644
--- a/spec/ruby/language/safe_spec.rb
+++ b/spec/ruby/language/safe_spec.rb
@@ -31,7 +31,7 @@ describe "The $SAFE variable" do
[2, 3, 4].each do |n|
it "cannot be set to #{n}" do
- lambda {
+ -> {
proc {
$SAFE = n
}.call
@@ -41,7 +41,7 @@ describe "The $SAFE variable" do
ruby_version_is ""..."2.6" do
it "cannot be set to values below 0" do
- lambda {
+ -> {
proc {
$SAFE = -100
}.call
@@ -51,7 +51,7 @@ describe "The $SAFE variable" do
ruby_version_is "2.6" do
it "raises ArgumentError when set to values below 0" do
- lambda {
+ -> {
proc {
$SAFE = -100
}.call
@@ -60,7 +60,7 @@ describe "The $SAFE variable" do
end
it "cannot be set to values above 4" do
- lambda {
+ -> {
proc {
$SAFE = 100
}.call
@@ -71,7 +71,7 @@ describe "The $SAFE variable" do
it "cannot be manually lowered" do
proc {
$SAFE = 1
- lambda {
+ -> {
$SAFE = 0
}.should raise_error(SecurityError, /tried to downgrade safe level from 1 to 0/)
}.call
@@ -87,7 +87,7 @@ describe "The $SAFE variable" do
it "is automatically lowered when leaving a lambda" do
$SAFE.should == 0
- lambda {
+ -> {
$SAFE = 1
}.call
$SAFE.should == 0
@@ -111,7 +111,7 @@ describe "The $SAFE variable" do
it "is not lambda local" do
$SAFE.should == 0
- lambda {
+ -> {
$SAFE = 1
}.call
$SAFE.should == 1
diff --git a/spec/ruby/language/send_spec.rb b/spec/ruby/language/send_spec.rb
index 84d02afb82..4ba3dcc9c2 100644
--- a/spec/ruby/language/send_spec.rb
+++ b/spec/ruby/language/send_spec.rb
@@ -20,7 +20,7 @@ describe "Invoking a method" do
end
it "raises ArgumentError if the method has a positive arity" do
- lambda {
+ -> {
specs.fooM1
}.should raise_error(ArgumentError)
end
@@ -36,7 +36,7 @@ describe "Invoking a method" do
end
it "raises ArgumentError if the methods arity doesn't match" do
- lambda {
+ -> {
specs.fooM1(1,2)
}.should raise_error(ArgumentError)
end
@@ -52,7 +52,7 @@ describe "Invoking a method" do
end
it "raises ArgumentError if extra arguments are passed" do
- lambda {
+ -> {
specs.fooM0O1(2,3)
}.should raise_error(ArgumentError)
end
@@ -64,13 +64,13 @@ describe "Invoking a method" do
end
it "raises an ArgumentError if there are no values for the mandatory args" do
- lambda {
+ -> {
specs.fooM1O1
}.should raise_error(ArgumentError)
end
it "raises an ArgumentError if too many values are passed" do
- lambda {
+ -> {
specs.fooM1O1(1,2,3)
}.should raise_error(ArgumentError)
end
@@ -107,7 +107,7 @@ describe "Invoking a method" do
end
it "raises a SyntaxError with both a literal block and an object as block" do
- lambda {
+ -> {
eval "specs.oneb(10, &l){ 42 }"
}.should raise_error(SyntaxError)
end
@@ -195,20 +195,20 @@ describe "Invoking a method" do
end
it "raises NameError if invoked as a vcall" do
- lambda { no_such_method }.should raise_error NameError
+ -> { no_such_method }.should raise_error NameError
end
it "should omit the method_missing call from the backtrace for NameError" do
- lambda { no_such_method }.should raise_error { |e| e.backtrace.first.should_not include("method_missing") }
+ -> { no_such_method }.should raise_error { |e| e.backtrace.first.should_not include("method_missing") }
end
it "raises NoMethodError if invoked as an unambiguous method call" do
- lambda { no_such_method() }.should raise_error NoMethodError
- lambda { no_such_method(1,2,3) }.should raise_error NoMethodError
+ -> { no_such_method() }.should raise_error NoMethodError
+ -> { no_such_method(1,2,3) }.should raise_error NoMethodError
end
it "should omit the method_missing call from the backtrace for NoMethodError" do
- lambda { no_such_method() }.should raise_error { |e| e.backtrace.first.should_not include("method_missing") }
+ -> { no_such_method() }.should raise_error { |e| e.backtrace.first.should_not include("method_missing") }
end
end
@@ -260,8 +260,8 @@ end
describe "Invoking a private getter method" do
it "does not permit self as a receiver" do
receiver = LangSendSpecs::PrivateGetter.new
- lambda { receiver.call_self_foo }.should raise_error(NoMethodError)
- lambda { receiver.call_self_foo_or_equals(6) }.should raise_error(NoMethodError)
+ -> { receiver.call_self_foo }.should raise_error(NoMethodError)
+ -> { receiver.call_self_foo_or_equals(6) }.should raise_error(NoMethodError)
end
end
diff --git a/spec/ruby/language/singleton_class_spec.rb b/spec/ruby/language/singleton_class_spec.rb
index e3a0d2870b..df735018af 100644
--- a/spec/ruby/language/singleton_class_spec.rb
+++ b/spec/ruby/language/singleton_class_spec.rb
@@ -15,11 +15,11 @@ describe "A singleton class" do
end
it "raises a TypeError for Fixnum's" do
- lambda { 1.singleton_class }.should raise_error(TypeError)
+ -> { 1.singleton_class }.should raise_error(TypeError)
end
it "raises a TypeError for symbols" do
- lambda { :symbol.singleton_class }.should raise_error(TypeError)
+ -> { :symbol.singleton_class }.should raise_error(TypeError)
end
it "is a singleton Class instance" do
@@ -74,7 +74,7 @@ describe "A singleton class" do
end
it "doesn't have singleton class" do
- lambda { bignum_value.singleton_class.superclass.should == Bignum }.should raise_error(TypeError)
+ -> { bignum_value.singleton_class.superclass.should == Bignum }.should raise_error(TypeError)
end
end
@@ -112,11 +112,11 @@ describe "A constant on a singleton class" do
class << @object
CONST
end
- lambda { CONST }.should raise_error(NameError)
+ -> { CONST }.should raise_error(NameError)
end
it "cannot be accessed via object::CONST" do
- lambda do
+ -> do
@object::CONST
end.should raise_error(TypeError)
end
@@ -127,7 +127,7 @@ describe "A constant on a singleton class" do
CONST = 100
end
- lambda do
+ -> do
@object::CONST
end.should raise_error(NameError)
end
@@ -143,7 +143,7 @@ describe "A constant on a singleton class" do
it "is not preserved when the object is duped" do
@object = @object.dup
- lambda do
+ -> do
class << @object; CONST; end
end.should raise_error(NameError)
end
@@ -280,13 +280,13 @@ end
describe "Instantiating a singleton class" do
it "raises a TypeError when new is called" do
- lambda {
+ -> {
Object.new.singleton_class.new
}.should raise_error(TypeError)
end
it "raises a TypeError when allocate is called" do
- lambda {
+ -> {
Object.new.singleton_class.allocate
}.should raise_error(TypeError)
end
diff --git a/spec/ruby/language/string_spec.rb b/spec/ruby/language/string_spec.rb
index 308485d546..a7ca00ef03 100644
--- a/spec/ruby/language/string_spec.rb
+++ b/spec/ruby/language/string_spec.rb
@@ -282,6 +282,6 @@ describe "Ruby String interpolation" do
a = "\u3042"
b = "\xff".force_encoding "binary"
- lambda { "#{a} #{b}" }.should raise_error(Encoding::CompatibilityError)
+ -> { "#{a} #{b}" }.should raise_error(Encoding::CompatibilityError)
end
end
diff --git a/spec/ruby/language/super_spec.rb b/spec/ruby/language/super_spec.rb
index 5aff5e8eea..66a1ec7592 100644
--- a/spec/ruby/language/super_spec.rb
+++ b/spec/ruby/language/super_spec.rb
@@ -83,8 +83,8 @@ describe "The super keyword" do
end
end
- lambda {sub_normal.new.foo}.should raise_error(NoMethodError, /super/)
- lambda {sub_zsuper.new.foo}.should raise_error(NoMethodError, /super/)
+ -> {sub_normal.new.foo}.should raise_error(NoMethodError, /super/)
+ -> {sub_zsuper.new.foo}.should raise_error(NoMethodError, /super/)
end
it "uses given block even if arguments are passed explicitly" do
@@ -169,7 +169,7 @@ describe "The super keyword" do
end
end
- lambda { klass.new.a(:a_called) }.should raise_error(RuntimeError)
+ -> { klass.new.a(:a_called) }.should raise_error(RuntimeError)
end
# Rubinius ticket github#157
diff --git a/spec/ruby/language/throw_spec.rb b/spec/ruby/language/throw_spec.rb
index 1662789da4..d723843688 100644
--- a/spec/ruby/language/throw_spec.rb
+++ b/spec/ruby/language/throw_spec.rb
@@ -45,7 +45,7 @@ describe "The throw keyword" do
end
it "does not convert strings to a symbol" do
- lambda { catch(:exit) { throw "exit" } }.should raise_error(ArgumentError)
+ -> { catch(:exit) { throw "exit" } }.should raise_error(ArgumentError)
end
it "unwinds stack from within a method" do
@@ -59,13 +59,13 @@ describe "The throw keyword" do
end
it "unwinds stack from within a lambda" do
- c = lambda { throw :foo, :msg }
+ c = -> { throw :foo, :msg }
catch(:foo) { c.call }.should == :msg
end
it "raises an ArgumentError if outside of scope of a matching catch" do
- lambda { throw :test, 5 }.should raise_error(ArgumentError)
- lambda { catch(:different) { throw :test, 5 } }.should raise_error(ArgumentError)
+ -> { throw :test, 5 }.should raise_error(ArgumentError)
+ -> { catch(:different) { throw :test, 5 } }.should raise_error(ArgumentError)
end
it "raises an UncaughtThrowError if used to exit a thread" do
diff --git a/spec/ruby/language/undef_spec.rb b/spec/ruby/language/undef_spec.rb
index 7a333c46ef..4e473b803f 100644
--- a/spec/ruby/language/undef_spec.rb
+++ b/spec/ruby/language/undef_spec.rb
@@ -14,35 +14,35 @@ describe "The undef keyword" do
@undef_class.class_eval do
undef meth
end
- lambda { @obj.meth(5) }.should raise_error(NoMethodError)
+ -> { @obj.meth(5) }.should raise_error(NoMethodError)
end
it "with a simple symbol" do
@undef_class.class_eval do
undef :meth
end
- lambda { @obj.meth(5) }.should raise_error(NoMethodError)
+ -> { @obj.meth(5) }.should raise_error(NoMethodError)
end
it "with a single quoted symbol" do
@undef_class.class_eval do
undef :'meth'
end
- lambda { @obj.meth(5) }.should raise_error(NoMethodError)
+ -> { @obj.meth(5) }.should raise_error(NoMethodError)
end
it "with a double quoted symbol" do
@undef_class.class_eval do
undef :"meth"
end
- lambda { @obj.meth(5) }.should raise_error(NoMethodError)
+ -> { @obj.meth(5) }.should raise_error(NoMethodError)
end
it "with a interpolated symbol" do
@undef_class.class_eval do
undef :"#{'meth'}"
end
- lambda { @obj.meth(5) }.should raise_error(NoMethodError)
+ -> { @obj.meth(5) }.should raise_error(NoMethodError)
end
end
@@ -61,7 +61,7 @@ describe "The undef keyword" do
it "raises a NameError when passed a missing name" do
Class.new do
- lambda {
+ -> {
undef not_exist
}.should raise_error(NameError) { |e|
# a NameError and not a NoMethodError
diff --git a/spec/ruby/language/variables_spec.rb b/spec/ruby/language/variables_spec.rb
index 640c9e49ac..868603eb88 100644
--- a/spec/ruby/language/variables_spec.rb
+++ b/spec/ruby/language/variables_spec.rb
@@ -46,7 +46,7 @@ describe "Multiple assignment" do
x = mock("multi-assign single RHS")
x.should_receive(:to_ary).and_return(1)
- lambda { a, b, c = x }.should raise_error(TypeError)
+ -> { a, b, c = x }.should raise_error(TypeError)
end
it "does not call #to_a to convert an Object RHS when assigning a simple MLHS" do
@@ -127,7 +127,7 @@ describe "Multiple assignment" do
x = mock("multi-assign splat")
x.should_receive(:to_ary).and_return(1)
- lambda { *a = x }.should raise_error(TypeError)
+ -> { *a = x }.should raise_error(TypeError)
end
it "does not call #to_ary on an Array subclass" do
@@ -160,7 +160,7 @@ describe "Multiple assignment" do
x = mock("multi-assign splat")
x.should_receive(:to_ary).and_return(1)
- lambda { a, *b, c = x }.should raise_error(TypeError)
+ -> { a, *b, c = x }.should raise_error(TypeError)
end
it "does not call #to_a to convert an Object RHS with a MLHS" do
@@ -256,7 +256,7 @@ describe "Multiple assignment" do
x = mock("multi-assign attributes")
x.should_receive(:m).and_return(y)
- lambda { a, b = x.m }.should raise_error(TypeError)
+ -> { a, b = x.m }.should raise_error(TypeError)
end
it "assigns values from a RHS method call with receiver and arguments" do
@@ -407,7 +407,7 @@ describe "Multiple assignment" do
x = mock("multi-assign RHS splat")
x.should_receive(:to_a).and_return(1)
- lambda { *a = *x }.should raise_error(TypeError)
+ -> { *a = *x }.should raise_error(TypeError)
end
it "does not call #to_ary to convert an Object RHS with a single splat LHS" do
@@ -453,7 +453,7 @@ describe "Multiple assignment" do
x = mock("multi-assign splat")
x.should_receive(:to_a).and_return(1)
- lambda { a = *x }.should raise_error(TypeError)
+ -> { a = *x }.should raise_error(TypeError)
end
it "calls #to_a to convert an Object splat RHS when assigned to a simple MLHS" do
@@ -468,7 +468,7 @@ describe "Multiple assignment" do
x = mock("multi-assign splat")
x.should_receive(:to_a).and_return(1)
- lambda { a, b, c = *x }.should raise_error(TypeError)
+ -> { a, b, c = *x }.should raise_error(TypeError)
end
it "does not call #to_ary to convert an Object splat RHS when assigned to a simple MLHS" do
@@ -491,7 +491,7 @@ describe "Multiple assignment" do
x = mock("multi-assign splat")
x.should_receive(:to_a).and_return(1)
- lambda { a, *b, c = *x }.should raise_error(TypeError)
+ -> { a, *b, c = *x }.should raise_error(TypeError)
end
it "does not call #to_ary to convert an Object RHS with a MLHS" do
@@ -569,7 +569,7 @@ describe "Multiple assignment" do
x = mock("multi-assign splat MRHS")
x.should_receive(:to_a).and_return(1)
- lambda { a, *b = 1, *x }.should raise_error(TypeError)
+ -> { a, *b = 1, *x }.should raise_error(TypeError)
end
it "does not call #to_ary to convert a splatted Object as part of a MRHS with a splat MRHS" do
@@ -592,7 +592,7 @@ describe "Multiple assignment" do
x = mock("multi-assign splat MRHS")
x.should_receive(:to_a).and_return(1)
- lambda { a, *b = *x, 1 }.should raise_error(TypeError)
+ -> { a, *b = *x, 1 }.should raise_error(TypeError)
end
it "does not call #to_ary to convert a splatted Object with a splat MRHS" do
@@ -641,7 +641,7 @@ describe "Multiple assignment" do
x = mock("multi-assign mixed RHS")
x.should_receive(:to_ary).and_return(x)
- lambda { a, (b, c), d = 1, x, 3, 4 }.should raise_error(TypeError)
+ -> { a, (b, c), d = 1, x, 3, 4 }.should raise_error(TypeError)
end
it "calls #to_a to convert a splatted Object value in a MRHS" do
@@ -665,7 +665,7 @@ describe "Multiple assignment" do
x = mock("multi-assign mixed splatted RHS")
x.should_receive(:to_ary).and_return(x)
- lambda { a, *b, (c, d) = 1, 2, 3, *x }.should raise_error(TypeError)
+ -> { a, *b, (c, d) = 1, 2, 3, *x }.should raise_error(TypeError)
end
it "does not call #to_ary to convert an Object when the position receiving the value is a simple variable" do
diff --git a/spec/ruby/language/yield_spec.rb b/spec/ruby/language/yield_spec.rb
index 8ab698196a..5fad7cb176 100644
--- a/spec/ruby/language/yield_spec.rb
+++ b/spec/ruby/language/yield_spec.rb
@@ -13,7 +13,7 @@ describe "The yield call" do
describe "taking no arguments" do
it "raises a LocalJumpError when the method is not passed a block" do
- lambda { @y.z }.should raise_error(LocalJumpError)
+ -> { @y.z }.should raise_error(LocalJumpError)
end
it "ignores assignment to the explicit block argument and calls the passed block" do
@@ -28,7 +28,7 @@ describe "The yield call" do
describe "taking a single argument" do
describe "when no block is given" do
it "raises a LocalJumpError" do
- lambda { @y.s(1) }.should raise_error(LocalJumpError)
+ -> { @y.s(1) }.should raise_error(LocalJumpError)
end
end
@@ -52,30 +52,30 @@ describe "The yield call" do
describe "yielding to a lambda" do
it "passes an empty Array when the argument is an empty Array" do
- @y.s([], &lambda { |*a| a }).should == [[]]
+ @y.s([], &-> *a { a }).should == [[]]
end
it "passes nil as a value" do
- @y.s(nil, &lambda { |*a| a }).should == [nil]
+ @y.s(nil, &-> *a { a }).should == [nil]
end
it "passes a single value" do
- @y.s(1, &lambda { |*a| a }).should == [1]
+ @y.s(1, &-> *a { a }).should == [1]
end
it "passes a single, multi-value Array" do
- @y.s([1, 2, 3], &lambda { |*a| a }).should == [[1, 2, 3]]
+ @y.s([1, 2, 3], &-> *a { a }).should == [[1, 2, 3]]
end
it "raises an ArgumentError if too few arguments are passed" do
- lambda {
- @y.s(1, &lambda { |a,b| [a,b] })
+ -> {
+ @y.s(1, &-> a, b { [a,b] })
}.should raise_error(ArgumentError)
end
it "should not destructure an Array into multiple arguments" do
- lambda {
- @y.s([1, 2], &lambda { |a,b| [a,b] })
+ -> {
+ @y.s([1, 2], &-> a, b { [a,b] })
}.should raise_error(ArgumentError)
end
end
@@ -83,7 +83,7 @@ describe "The yield call" do
describe "taking multiple arguments" do
it "raises a LocalJumpError when the method is not passed a block" do
- lambda { @y.m(1, 2, 3) }.should raise_error(LocalJumpError)
+ -> { @y.m(1, 2, 3) }.should raise_error(LocalJumpError)
end
it "passes the arguments to the block" do
@@ -95,21 +95,21 @@ describe "The yield call" do
end
it "raises an ArgumentError if too many arguments are passed to a lambda" do
- lambda {
- @y.m(1, 2, 3, &lambda { |a| })
+ -> {
+ @y.m(1, 2, 3, &-> a { })
}.should raise_error(ArgumentError)
end
it "raises an ArgumentError if too few arguments are passed to a lambda" do
- lambda {
- @y.m(1, 2, 3, &lambda { |a,b,c,d| })
+ -> {
+ @y.m(1, 2, 3, &-> a, b, c, d { })
}.should raise_error(ArgumentError)
end
end
describe "taking a single splatted argument" do
it "raises a LocalJumpError when the method is not passed a block" do
- lambda { @y.r(0) }.should raise_error(LocalJumpError)
+ -> { @y.r(0) }.should raise_error(LocalJumpError)
end
it "passes a single value" do
@@ -141,7 +141,7 @@ describe "The yield call" do
describe "taking multiple arguments with a splat" do
it "raises a LocalJumpError when the method is not passed a block" do
- lambda { @y.rs(1, 2, [3, 4]) }.should raise_error(LocalJumpError)
+ -> { @y.rs(1, 2, [3, 4]) }.should raise_error(LocalJumpError)
end
it "passes the arguments to the block" do
@@ -166,7 +166,7 @@ describe "The yield call" do
describe "taking matching arguments with splats and post args" do
it "raises a LocalJumpError when the method is not passed a block" do
- lambda { @y.rs(1, 2, [3, 4]) }.should raise_error(LocalJumpError)
+ -> { @y.rs(1, 2, [3, 4]) }.should raise_error(LocalJumpError)
end
it "passes the arguments to the block" do
diff --git a/spec/ruby/library/abbrev/abbrev_spec.rb b/spec/ruby/library/abbrev/abbrev_spec.rb
index 60d1a953b3..61b0926597 100644
--- a/spec/ruby/library/abbrev/abbrev_spec.rb
+++ b/spec/ruby/library/abbrev/abbrev_spec.rb
@@ -5,8 +5,8 @@ require 'abbrev'
#the same manner, as they're more or less aliases
#of one another
-[["Abbrev.abbrev", lambda {|a| Abbrev.abbrev(a)}],
- ["Array#abbrev", lambda {|a| a.abbrev}]
+[["Abbrev.abbrev", -> a { Abbrev.abbrev(a)}],
+ ["Array#abbrev", -> a { a.abbrev}]
].each do |(name, func)|
describe name do
diff --git a/spec/ruby/library/bigdecimal/BigDecimal_spec.rb b/spec/ruby/library/bigdecimal/BigDecimal_spec.rb
index ec38c6f113..e1e6fe9fb1 100644
--- a/spec/ruby/library/bigdecimal/BigDecimal_spec.rb
+++ b/spec/ruby/library/bigdecimal/BigDecimal_spec.rb
@@ -51,16 +51,16 @@ describe "Kernel#BigDecimal" do
ruby_version_is "2.6" do
it "does not ignores trailing garbage" do
- lambda { BigDecimal("123E45ruby") }.should raise_error(ArgumentError)
- lambda { BigDecimal("123x45") }.should raise_error(ArgumentError)
- lambda { BigDecimal("123.4%E5") }.should raise_error(ArgumentError)
- lambda { BigDecimal("1E2E3E4E5E") }.should raise_error(ArgumentError)
+ -> { BigDecimal("123E45ruby") }.should raise_error(ArgumentError)
+ -> { BigDecimal("123x45") }.should raise_error(ArgumentError)
+ -> { BigDecimal("123.4%E5") }.should raise_error(ArgumentError)
+ -> { BigDecimal("1E2E3E4E5E") }.should raise_error(ArgumentError)
end
end
it "raises ArgumentError for invalid strings" do
- lambda { BigDecimal("ruby") }.should raise_error(ArgumentError)
- lambda { BigDecimal(" \t\n \r-\t\t\tInfinity \n") }.should raise_error(ArgumentError)
+ -> { BigDecimal("ruby") }.should raise_error(ArgumentError)
+ -> { BigDecimal(" \t\n \r-\t\t\tInfinity \n") }.should raise_error(ArgumentError)
end
it "allows omitting the integer part" do
@@ -82,8 +82,8 @@ describe "Kernel#BigDecimal" do
reference = BigDecimal("12345.67E89")
BigDecimal("12_345.67E89").should == reference
- lambda { BigDecimal("1_2_3_4_5_._6____7_E89") }.should raise_error(ArgumentError)
- lambda { BigDecimal("12345_.67E_8__9_") }.should raise_error(ArgumentError)
+ -> { BigDecimal("1_2_3_4_5_._6____7_E89") }.should raise_error(ArgumentError)
+ -> { BigDecimal("12345_.67E_8__9_") }.should raise_error(ArgumentError)
end
end
@@ -151,7 +151,7 @@ describe "Kernel#BigDecimal" do
end
it "raises ArgumentError when Float is used without precision" do
- lambda { BigDecimal(1.0) }.should raise_error(ArgumentError)
+ -> { BigDecimal(1.0) }.should raise_error(ArgumentError)
end
it "returns appropriate BigDecimal zero for signed zero" do
diff --git a/spec/ruby/library/bigdecimal/add_spec.rb b/spec/ruby/library/bigdecimal/add_spec.rb
index 1ae5b7f428..5b874687fe 100644
--- a/spec/ruby/library/bigdecimal/add_spec.rb
+++ b/spec/ruby/library/bigdecimal/add_spec.rb
@@ -81,6 +81,12 @@ describe "BigDecimal#add" do
end
end
+ describe "with Rational" do
+ it "produces a BigDecimal" do
+ (@three + Rational(500, 2)).should == BigDecimal("0.253e3")
+ end
+ end
+
it "favors the precision specified in the second argument over the global limit" do
BigDecimalSpecs.with_limit(1) do
BigDecimal('0.888').add(@zero, 3).should == BigDecimal('0.888')
@@ -165,22 +171,22 @@ describe "BigDecimal#add" do
end
it "raises TypeError when adds nil" do
- lambda {
+ -> {
@one.add(nil, 10)
}.should raise_error(TypeError)
- lambda {
+ -> {
@one.add(nil, 0)
}.should raise_error(TypeError)
end
it "raises TypeError when precision parameter is nil" do
- lambda {
+ -> {
@one.add(@one, nil)
}.should raise_error(TypeError)
end
it "raises ArgumentError when precision parameter is negative" do
- lambda {
+ -> {
@one.add(@one, -10)
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/bigdecimal/ceil_spec.rb b/spec/ruby/library/bigdecimal/ceil_spec.rb
index 879c4fcf36..60e71b12fb 100644
--- a/spec/ruby/library/bigdecimal/ceil_spec.rb
+++ b/spec/ruby/library/bigdecimal/ceil_spec.rb
@@ -48,9 +48,9 @@ describe "BigDecimal#ceil" do
end
it "raise exception, if self is special value" do
- lambda { @infinity.ceil }.should raise_error(FloatDomainError)
- lambda { @infinity_neg.ceil }.should raise_error(FloatDomainError)
- lambda { @nan.ceil }.should raise_error(FloatDomainError)
+ -> { @infinity.ceil }.should raise_error(FloatDomainError)
+ -> { @infinity_neg.ceil }.should raise_error(FloatDomainError)
+ -> { @nan.ceil }.should raise_error(FloatDomainError)
end
it "returns n digits right of the decimal point if given n > 0" do
diff --git a/spec/ruby/library/bigdecimal/div_spec.rb b/spec/ruby/library/bigdecimal/div_spec.rb
index 23d1ae1efd..0c9eb2ddec 100644
--- a/spec/ruby/library/bigdecimal/div_spec.rb
+++ b/spec/ruby/library/bigdecimal/div_spec.rb
@@ -51,9 +51,9 @@ describe "BigDecimal#div" do
end
it "raises FloatDomainError if NaN is involved" do
- lambda { @one.div(@nan) }.should raise_error(FloatDomainError)
- lambda { @nan.div(@one) }.should raise_error(FloatDomainError)
- lambda { @nan.div(@nan) }.should raise_error(FloatDomainError)
+ -> { @one.div(@nan) }.should raise_error(FloatDomainError)
+ -> { @nan.div(@one) }.should raise_error(FloatDomainError)
+ -> { @nan.div(@nan) }.should raise_error(FloatDomainError)
end
it "returns 0 if divided by Infinity and no precision given" do
@@ -69,14 +69,14 @@ describe "BigDecimal#div" do
end
it "raises ZeroDivisionError if divided by zero and no precision given" do
- lambda { @one.div(@zero) }.should raise_error(ZeroDivisionError)
- lambda { @one.div(@zero_plus) }.should raise_error(ZeroDivisionError)
- lambda { @one.div(@zero_minus) }.should raise_error(ZeroDivisionError)
-
- lambda { @zero.div(@zero) }.should raise_error(ZeroDivisionError)
- lambda { @zero_minus.div(@zero_plus) }.should raise_error(ZeroDivisionError)
- lambda { @zero_minus.div(@zero_minus) }.should raise_error(ZeroDivisionError)
- lambda { @zero_plus.div(@zero_minus) }.should raise_error(ZeroDivisionError)
+ -> { @one.div(@zero) }.should raise_error(ZeroDivisionError)
+ -> { @one.div(@zero_plus) }.should raise_error(ZeroDivisionError)
+ -> { @one.div(@zero_minus) }.should raise_error(ZeroDivisionError)
+
+ -> { @zero.div(@zero) }.should raise_error(ZeroDivisionError)
+ -> { @zero_minus.div(@zero_plus) }.should raise_error(ZeroDivisionError)
+ -> { @zero_minus.div(@zero_minus) }.should raise_error(ZeroDivisionError)
+ -> { @zero_plus.div(@zero_minus) }.should raise_error(ZeroDivisionError)
end
it "returns NaN if zero is divided by zero" do
@@ -90,9 +90,9 @@ describe "BigDecimal#div" do
end
it "raises FloatDomainError if (+|-) Infinity divided by 1 and no precision given" do
- lambda { @infinity_minus.div(@one) }.should raise_error(FloatDomainError)
- lambda { @infinity.div(@one) }.should raise_error(FloatDomainError)
- lambda { @infinity_minus.div(@one_minus) }.should raise_error(FloatDomainError)
+ -> { @infinity_minus.div(@one) }.should raise_error(FloatDomainError)
+ -> { @infinity.div(@one) }.should raise_error(FloatDomainError)
+ -> { @infinity_minus.div(@one_minus) }.should raise_error(FloatDomainError)
end
it "returns (+|-)Infinity if (+|-)Infinity by 1 and precision given" do
diff --git a/spec/ruby/library/bigdecimal/divide_spec.rb b/spec/ruby/library/bigdecimal/divide_spec.rb
index 2aac99799f..c62b23557d 100644
--- a/spec/ruby/library/bigdecimal/divide_spec.rb
+++ b/spec/ruby/library/bigdecimal/divide_spec.rb
@@ -4,4 +4,14 @@ require 'bigdecimal'
describe "BigDecimal#/" do
it_behaves_like :bigdecimal_quo, :/, []
+
+ before :each do
+ @three = BigDecimal("3")
+ end
+
+ describe "with Rational" do
+ it "produces a BigDecimal" do
+ (@three / Rational(500, 2)).should == BigDecimal("0.12e-1")
+ end
+ end
end
diff --git a/spec/ruby/library/bigdecimal/divmod_spec.rb b/spec/ruby/library/bigdecimal/divmod_spec.rb
index 3946d6f208..ae8b84983a 100644
--- a/spec/ruby/library/bigdecimal/divmod_spec.rb
+++ b/spec/ruby/library/bigdecimal/divmod_spec.rb
@@ -38,9 +38,9 @@ describe "BigDecimal#mod_part_of_divmod" do
it "raises ZeroDivisionError if other is zero" do
bd5667 = BigDecimal("5667.19")
- lambda { bd5667.mod_part_of_divmod(0) }.should raise_error(ZeroDivisionError)
- lambda { bd5667.mod_part_of_divmod(BigDecimal("0")) }.should raise_error(ZeroDivisionError)
- lambda { @zero.mod_part_of_divmod(@zero) }.should raise_error(ZeroDivisionError)
+ -> { bd5667.mod_part_of_divmod(0) }.should raise_error(ZeroDivisionError)
+ -> { bd5667.mod_part_of_divmod(BigDecimal("0")) }.should raise_error(ZeroDivisionError)
+ -> { @zero.mod_part_of_divmod(@zero) }.should raise_error(ZeroDivisionError)
end
end
@@ -140,7 +140,7 @@ describe "BigDecimal#divmod" do
it "raises ZeroDivisionError if the divisor is zero" do
(@special_vals + @regular_vals + @zeroes - [@nan]).each do |val|
@zeroes.each do |zero|
- lambda { val.divmod(zero) }.should raise_error(ZeroDivisionError)
+ -> { val.divmod(zero) }.should raise_error(ZeroDivisionError)
end
end
end
@@ -172,7 +172,7 @@ describe "BigDecimal#divmod" do
end
it "raises TypeError if the argument cannot be coerced to BigDecimal" do
- lambda {
+ -> {
@one.divmod('1')
}.should raise_error(TypeError)
end
diff --git a/spec/ruby/library/bigdecimal/fix_spec.rb b/spec/ruby/library/bigdecimal/fix_spec.rb
index af852d6471..53b30cbf8b 100644
--- a/spec/ruby/library/bigdecimal/fix_spec.rb
+++ b/spec/ruby/library/bigdecimal/fix_spec.rb
@@ -49,7 +49,7 @@ describe "BigDecimal#fix" do
end
it "does not allow any arguments" do
- lambda {
+ -> {
@mixed.fix(10)
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/bigdecimal/floor_spec.rb b/spec/ruby/library/bigdecimal/floor_spec.rb
index 509cb00e10..a7dfec2c9a 100644
--- a/spec/ruby/library/bigdecimal/floor_spec.rb
+++ b/spec/ruby/library/bigdecimal/floor_spec.rb
@@ -41,9 +41,9 @@ describe "BigDecimal#floor" do
end
it "raise exception, if self is special value" do
- lambda { @infinity.floor }.should raise_error(FloatDomainError)
- lambda { @infinity_neg.floor }.should raise_error(FloatDomainError)
- lambda { @nan.floor }.should raise_error(FloatDomainError)
+ -> { @infinity.floor }.should raise_error(FloatDomainError)
+ -> { @infinity_neg.floor }.should raise_error(FloatDomainError)
+ -> { @nan.floor }.should raise_error(FloatDomainError)
end
it "returns n digits right of the decimal point if given n > 0" do
diff --git a/spec/ruby/library/bigdecimal/gt_spec.rb b/spec/ruby/library/bigdecimal/gt_spec.rb
index 8ebb631cb8..4717cfdd9d 100644
--- a/spec/ruby/library/bigdecimal/gt_spec.rb
+++ b/spec/ruby/library/bigdecimal/gt_spec.rb
@@ -86,11 +86,11 @@ describe "BigDecimal#>" do
end
it "raises an ArgumentError if the argument can't be coerced into a BigDecimal" do
- lambda {@zero > nil }.should raise_error(ArgumentError)
- lambda {@infinity > nil }.should raise_error(ArgumentError)
- lambda {@infinity_neg > nil }.should raise_error(ArgumentError)
- lambda {@mixed > nil }.should raise_error(ArgumentError)
- lambda {@pos_int > nil }.should raise_error(ArgumentError)
- lambda {@neg_frac > nil }.should raise_error(ArgumentError)
+ -> {@zero > nil }.should raise_error(ArgumentError)
+ -> {@infinity > nil }.should raise_error(ArgumentError)
+ -> {@infinity_neg > nil }.should raise_error(ArgumentError)
+ -> {@mixed > nil }.should raise_error(ArgumentError)
+ -> {@pos_int > nil }.should raise_error(ArgumentError)
+ -> {@neg_frac > nil }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/bigdecimal/gte_spec.rb b/spec/ruby/library/bigdecimal/gte_spec.rb
index 6b0b7f41e9..8dc81707f0 100644
--- a/spec/ruby/library/bigdecimal/gte_spec.rb
+++ b/spec/ruby/library/bigdecimal/gte_spec.rb
@@ -90,11 +90,11 @@ describe "BigDecimal#>=" do
end
it "returns nil if the argument is nil" do
- lambda {@zero >= nil }.should raise_error(ArgumentError)
- lambda {@infinity >= nil }.should raise_error(ArgumentError)
- lambda {@infinity_neg >= nil }.should raise_error(ArgumentError)
- lambda {@mixed >= nil }.should raise_error(ArgumentError)
- lambda {@pos_int >= nil }.should raise_error(ArgumentError)
- lambda {@neg_frac >= nil }.should raise_error(ArgumentError)
+ -> {@zero >= nil }.should raise_error(ArgumentError)
+ -> {@infinity >= nil }.should raise_error(ArgumentError)
+ -> {@infinity_neg >= nil }.should raise_error(ArgumentError)
+ -> {@mixed >= nil }.should raise_error(ArgumentError)
+ -> {@pos_int >= nil }.should raise_error(ArgumentError)
+ -> {@neg_frac >= nil }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/bigdecimal/lt_spec.rb b/spec/ruby/library/bigdecimal/lt_spec.rb
index 1894daf17f..61f4f19912 100644
--- a/spec/ruby/library/bigdecimal/lt_spec.rb
+++ b/spec/ruby/library/bigdecimal/lt_spec.rb
@@ -84,11 +84,11 @@ describe "BigDecimal#<" do
end
it "raises an ArgumentError if the argument can't be coerced into a BigDecimal" do
- lambda {@zero < nil }.should raise_error(ArgumentError)
- lambda {@infinity < nil }.should raise_error(ArgumentError)
- lambda {@infinity_neg < nil }.should raise_error(ArgumentError)
- lambda {@mixed < nil }.should raise_error(ArgumentError)
- lambda {@pos_int < nil }.should raise_error(ArgumentError)
- lambda {@neg_frac < nil }.should raise_error(ArgumentError)
+ -> {@zero < nil }.should raise_error(ArgumentError)
+ -> {@infinity < nil }.should raise_error(ArgumentError)
+ -> {@infinity_neg < nil }.should raise_error(ArgumentError)
+ -> {@mixed < nil }.should raise_error(ArgumentError)
+ -> {@pos_int < nil }.should raise_error(ArgumentError)
+ -> {@neg_frac < nil }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/bigdecimal/lte_spec.rb b/spec/ruby/library/bigdecimal/lte_spec.rb
index 56d3caa3b1..fc632315f8 100644
--- a/spec/ruby/library/bigdecimal/lte_spec.rb
+++ b/spec/ruby/library/bigdecimal/lte_spec.rb
@@ -90,11 +90,11 @@ describe "BigDecimal#<=" do
end
it "raises an ArgumentError if the argument can't be coerced into a BigDecimal" do
- lambda {@zero <= nil }.should raise_error(ArgumentError)
- lambda {@infinity <= nil }.should raise_error(ArgumentError)
- lambda {@infinity_neg <= nil }.should raise_error(ArgumentError)
- lambda {@mixed <= nil }.should raise_error(ArgumentError)
- lambda {@pos_int <= nil }.should raise_error(ArgumentError)
- lambda {@neg_frac <= nil }.should raise_error(ArgumentError)
+ -> {@zero <= nil }.should raise_error(ArgumentError)
+ -> {@infinity <= nil }.should raise_error(ArgumentError)
+ -> {@infinity_neg <= nil }.should raise_error(ArgumentError)
+ -> {@mixed <= nil }.should raise_error(ArgumentError)
+ -> {@pos_int <= nil }.should raise_error(ArgumentError)
+ -> {@neg_frac <= nil }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/bigdecimal/mode_spec.rb b/spec/ruby/library/bigdecimal/mode_spec.rb
index 1de19c9971..f57028ae5d 100644
--- a/spec/ruby/library/bigdecimal/mode_spec.rb
+++ b/spec/ruby/library/bigdecimal/mode_spec.rb
@@ -24,13 +24,13 @@ describe "BigDecimal.mode" do
it "raise an exception if the flag is true" do
BigDecimal.mode(BigDecimal::EXCEPTION_NaN, true)
- lambda { BigDecimal("NaN").add(BigDecimal("1"),0) }.should raise_error(FloatDomainError)
+ -> { BigDecimal("NaN").add(BigDecimal("1"),0) }.should raise_error(FloatDomainError)
BigDecimal.mode(BigDecimal::EXCEPTION_INFINITY, true)
- lambda { BigDecimal("0").add(BigDecimal("Infinity"),0) }.should raise_error(FloatDomainError)
+ -> { BigDecimal("0").add(BigDecimal("Infinity"),0) }.should raise_error(FloatDomainError)
BigDecimal.mode(BigDecimal::EXCEPTION_ZERODIVIDE, true)
- lambda { BigDecimal("1").quo(BigDecimal("0")) }.should raise_error(FloatDomainError)
+ -> { BigDecimal("1").quo(BigDecimal("0")) }.should raise_error(FloatDomainError)
BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, true)
- lambda { BigDecimal("1E11111111111111111111") }.should raise_error(FloatDomainError)
- lambda { (BigDecimal("1E1000000000000000000")**10) }.should raise_error(FloatDomainError)
+ -> { BigDecimal("1E11111111111111111111") }.should raise_error(FloatDomainError)
+ -> { (BigDecimal("1E1000000000000000000")**10) }.should raise_error(FloatDomainError)
end
end
diff --git a/spec/ruby/library/bigdecimal/multiply_spec.rb b/spec/ruby/library/bigdecimal/multiply_spec.rb
index 4e5a8d6681..a8ce1da32e 100644
--- a/spec/ruby/library/bigdecimal/multiply_spec.rb
+++ b/spec/ruby/library/bigdecimal/multiply_spec.rb
@@ -8,6 +8,7 @@ end
describe "BigDecimal#*" do
before :each do
+ @three = BigDecimal("3")
@e3_minus = BigDecimal("3E-20001")
@e3_plus = BigDecimal("3E20001")
@e = BigDecimal("1.00000000000000000000123456789")
@@ -31,4 +32,10 @@ describe "BigDecimal#*" do
(@e3_minus * object).should == BigDecimal("9")
end
end
+
+ describe "with Rational" do
+ it "produces a BigDecimal" do
+ (@three * Rational(500, 2)).should == BigDecimal("0.75e3")
+ end
+ end
end
diff --git a/spec/ruby/library/bigdecimal/remainder_spec.rb b/spec/ruby/library/bigdecimal/remainder_spec.rb
index 8626064a2f..04233edece 100644
--- a/spec/ruby/library/bigdecimal/remainder_spec.rb
+++ b/spec/ruby/library/bigdecimal/remainder_spec.rb
@@ -84,7 +84,7 @@ describe "BigDecimal#remainder" do
end
it "raises TypeError if the argument cannot be coerced to BigDecimal" do
- lambda {
+ -> {
@one.remainder('2')
}.should raise_error(TypeError)
end
diff --git a/spec/ruby/library/bigdecimal/round_spec.rb b/spec/ruby/library/bigdecimal/round_spec.rb
index 467e2c5563..501a1a7342 100644
--- a/spec/ruby/library/bigdecimal/round_spec.rb
+++ b/spec/ruby/library/bigdecimal/round_spec.rb
@@ -217,18 +217,18 @@ describe "BigDecimal#round" do
end
it 'raise exception, if self is special value' do
- lambda { BigDecimal('NaN').round }.should raise_error(FloatDomainError)
- lambda { BigDecimal('Infinity').round }.should raise_error(FloatDomainError)
- lambda { BigDecimal('-Infinity').round }.should raise_error(FloatDomainError)
+ -> { BigDecimal('NaN').round }.should raise_error(FloatDomainError)
+ -> { BigDecimal('Infinity').round }.should raise_error(FloatDomainError)
+ -> { BigDecimal('-Infinity').round }.should raise_error(FloatDomainError)
end
it 'do not raise exception, if self is special value and precision is given' do
- lambda { BigDecimal('NaN').round(2) }.should_not raise_error(FloatDomainError)
- lambda { BigDecimal('Infinity').round(2) }.should_not raise_error(FloatDomainError)
- lambda { BigDecimal('-Infinity').round(2) }.should_not raise_error(FloatDomainError)
+ -> { BigDecimal('NaN').round(2) }.should_not raise_error(FloatDomainError)
+ -> { BigDecimal('Infinity').round(2) }.should_not raise_error(FloatDomainError)
+ -> { BigDecimal('-Infinity').round(2) }.should_not raise_error(FloatDomainError)
end
it "raise for a non-existent round mode" do
- lambda { @p1_50.round(0, :nonsense) }.should raise_error(ArgumentError, "invalid rounding mode")
+ -> { @p1_50.round(0, :nonsense) }.should raise_error(ArgumentError, "invalid rounding mode")
end
end
diff --git a/spec/ruby/library/bigdecimal/shared/modulo.rb b/spec/ruby/library/bigdecimal/shared/modulo.rb
index d570b86d7a..67c0ecf2fc 100644
--- a/spec/ruby/library/bigdecimal/shared/modulo.rb
+++ b/spec/ruby/library/bigdecimal/shared/modulo.rb
@@ -108,7 +108,7 @@ describe :bigdecimal_modulo, shared: true do
end
it "raises TypeError if the argument cannot be coerced to BigDecimal" do
- lambda {
+ -> {
@one.send(@method, '2')
}.should raise_error(TypeError)
end
@@ -118,8 +118,8 @@ describe :bigdecimal_modulo_zerodivisionerror, shared: true do
it "raises ZeroDivisionError if other is zero" do
bd5667 = BigDecimal("5667.19")
- lambda { bd5667.send(@method, 0) }.should raise_error(ZeroDivisionError)
- lambda { bd5667.send(@method, BigDecimal("0")) }.should raise_error(ZeroDivisionError)
- lambda { @zero.send(@method, @zero) }.should raise_error(ZeroDivisionError)
+ -> { bd5667.send(@method, 0) }.should raise_error(ZeroDivisionError)
+ -> { bd5667.send(@method, BigDecimal("0")) }.should raise_error(ZeroDivisionError)
+ -> { @zero.send(@method, @zero) }.should raise_error(ZeroDivisionError)
end
end
diff --git a/spec/ruby/library/bigdecimal/shared/to_int.rb b/spec/ruby/library/bigdecimal/shared/to_int.rb
index 729a25f511..02f6092f23 100644
--- a/spec/ruby/library/bigdecimal/shared/to_int.rb
+++ b/spec/ruby/library/bigdecimal/shared/to_int.rb
@@ -2,8 +2,8 @@ require 'bigdecimal'
describe :bigdecimal_to_int , shared: true do
it "raises FloatDomainError if BigDecimal is infinity or NaN" do
- lambda { BigDecimal("Infinity").send(@method) }.should raise_error(FloatDomainError)
- lambda { BigDecimal("NaN").send(@method) }.should raise_error(FloatDomainError)
+ -> { BigDecimal("Infinity").send(@method) }.should raise_error(FloatDomainError)
+ -> { BigDecimal("NaN").send(@method) }.should raise_error(FloatDomainError)
end
it "returns Integer or Bignum otherwise" do
diff --git a/spec/ruby/library/bigdecimal/sqrt_spec.rb b/spec/ruby/library/bigdecimal/sqrt_spec.rb
index 75182fcbc8..d149003b9f 100644
--- a/spec/ruby/library/bigdecimal/sqrt_spec.rb
+++ b/spec/ruby/library/bigdecimal/sqrt_spec.rb
@@ -41,37 +41,37 @@ describe "BigDecimal#sqrt" do
end
it "raises ArgumentError when no argument is given" do
- lambda {
+ -> {
@one.sqrt
}.should raise_error(ArgumentError)
end
it "raises ArgumentError if a negative number is given" do
- lambda {
+ -> {
@one.sqrt(-1)
}.should raise_error(ArgumentError)
end
it "raises ArgumentError if 2 arguments are given" do
- lambda {
+ -> {
@one.sqrt(1, 1)
}.should raise_error(ArgumentError)
end
it "raises TypeError if nil is given" do
- lambda {
+ -> {
@one.sqrt(nil)
}.should raise_error(TypeError)
end
it "raises TypeError if a string is given" do
- lambda {
+ -> {
@one.sqrt("stuff")
}.should raise_error(TypeError)
end
it "raises TypeError if a plain Object is given" do
- lambda {
+ -> {
@one.sqrt(Object.new)
}.should raise_error(TypeError)
end
@@ -82,7 +82,7 @@ describe "BigDecimal#sqrt" do
end
it "raises FloatDomainError on negative values" do
- lambda {
+ -> {
BigDecimal('-1').sqrt(10)
}.should raise_error(FloatDomainError)
end
@@ -92,13 +92,13 @@ describe "BigDecimal#sqrt" do
end
it "raises FloatDomainError for negative infinity" do
- lambda {
+ -> {
@infinity_minus.sqrt(1)
}.should raise_error(FloatDomainError)
end
it "raises FloatDomainError for NaN" do
- lambda {
+ -> {
@nan.sqrt(1)
}.should raise_error(FloatDomainError)
end
diff --git a/spec/ruby/library/bigdecimal/sub_spec.rb b/spec/ruby/library/bigdecimal/sub_spec.rb
index f0068b12a9..29ec851193 100644
--- a/spec/ruby/library/bigdecimal/sub_spec.rb
+++ b/spec/ruby/library/bigdecimal/sub_spec.rb
@@ -7,6 +7,7 @@ describe "BigDecimal#sub" do
@one = BigDecimal("1")
@zero = BigDecimal("0")
@two = BigDecimal("2")
+ @three = BigDecimal("3")
@nan = BigDecimal("NaN")
@infinity = BigDecimal("Infinity")
@infinity_minus = BigDecimal("-Infinity")
@@ -42,6 +43,12 @@ describe "BigDecimal#sub" do
end
end
+ describe "with Rational" do
+ it "produces a BigDecimal" do
+ (@three - Rational(500, 2)).should == BigDecimal('-0.247e3')
+ end
+ end
+
it "returns NaN if NaN is involved" do
@one.sub(@nan, 1).nan?.should == true
@nan.sub(@one, 1).nan?.should == true
diff --git a/spec/ruby/library/bigdecimal/to_s_spec.rb b/spec/ruby/library/bigdecimal/to_s_spec.rb
index c7ee6a01b0..b6154c680d 100644
--- a/spec/ruby/library/bigdecimal/to_s_spec.rb
+++ b/spec/ruby/library/bigdecimal/to_s_spec.rb
@@ -26,7 +26,7 @@ describe "BigDecimal#to_s" do
end
it "takes an optional argument" do
- lambda {@bigdec.to_s("F")}.should_not raise_error()
+ -> {@bigdec.to_s("F")}.should_not raise_error()
end
it "starts with + if + is supplied and value is positive" do
diff --git a/spec/ruby/library/bigdecimal/truncate_spec.rb b/spec/ruby/library/bigdecimal/truncate_spec.rb
index 7edee771c9..d3a15f62c7 100644
--- a/spec/ruby/library/bigdecimal/truncate_spec.rb
+++ b/spec/ruby/library/bigdecimal/truncate_spec.rb
@@ -74,8 +74,8 @@ describe "BigDecimal#truncate" do
end
it "returns the same value if self is special value" do
- lambda { @nan.truncate }.should raise_error(FloatDomainError)
- lambda { @infinity.truncate }.should raise_error(FloatDomainError)
- lambda { @infinity_negative.truncate }.should raise_error(FloatDomainError)
+ -> { @nan.truncate }.should raise_error(FloatDomainError)
+ -> { @infinity.truncate }.should raise_error(FloatDomainError)
+ -> { @infinity_negative.truncate }.should raise_error(FloatDomainError)
end
end
diff --git a/spec/ruby/library/cgi/cookie/initialize_spec.rb b/spec/ruby/library/cgi/cookie/initialize_spec.rb
index f41129a9cf..4b6e104b10 100644
--- a/spec/ruby/library/cgi/cookie/initialize_spec.rb
+++ b/spec/ruby/library/cgi/cookie/initialize_spec.rb
@@ -120,8 +120,8 @@ describe "CGI::Cookie#initialize when passed Hash" do
end
it "raises a ArgumentError when the passed Hash has no 'name' entry" do
- lambda { @cookie.send(:initialize, {}) }.should raise_error(ArgumentError)
- lambda { @cookie.send(:initialize, "value" => "test") }.should raise_error(ArgumentError)
+ -> { @cookie.send(:initialize, {}) }.should raise_error(ArgumentError)
+ -> { @cookie.send(:initialize, "value" => "test") }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/cgi/out_spec.rb b/spec/ruby/library/cgi/out_spec.rb
index 84068cdd4f..bc09f5bcbb 100644
--- a/spec/ruby/library/cgi/out_spec.rb
+++ b/spec/ruby/library/cgi/out_spec.rb
@@ -46,6 +46,6 @@ describe "CGI#out when passed no block" do
end
it "raises a LocalJumpError" do
- lambda { @cgi.out }.should raise_error(LocalJumpError)
+ -> { @cgi.out }.should raise_error(LocalJumpError)
end
end
diff --git a/spec/ruby/library/complex/math/shared/acos.rb b/spec/ruby/library/complex/math/shared/acos.rb
index 61be31571f..65637fa838 100644
--- a/spec/ruby/library/complex/math/shared/acos.rb
+++ b/spec/ruby/library/complex/math/shared/acos.rb
@@ -28,14 +28,14 @@ describe :complex_math_acos_bang, shared: true do
end
it "raises a TypeError when passed a Complex number" do
- lambda { @object.send(:acos!, Complex(4, 5)) }.should raise_error(TypeError)
+ -> { @object.send(:acos!, Complex(4, 5)) }.should raise_error(TypeError)
end
it "raises an Errno::EDOM for numbers greater than 1.0" do
- lambda { @object.send(:acos!, 1.0001) }.should raise_error(Errno::EDOM)
+ -> { @object.send(:acos!, 1.0001) }.should raise_error(Errno::EDOM)
end
it "raises an Errno::EDOM for numbers less than -1.0" do
- lambda { @object.send(:acos!, -1.0001) }.should raise_error(Errno::EDOM)
+ -> { @object.send(:acos!, -1.0001) }.should raise_error(Errno::EDOM)
end
end
diff --git a/spec/ruby/library/complex/math/shared/acosh.rb b/spec/ruby/library/complex/math/shared/acosh.rb
index a2cd887f95..285b0b823f 100644
--- a/spec/ruby/library/complex/math/shared/acosh.rb
+++ b/spec/ruby/library/complex/math/shared/acosh.rb
@@ -26,12 +26,12 @@ describe :complex_math_acosh_bang, shared: true do
end
it "raises Errno::EDOM for numbers less than 1.0" do
- lambda { @object.send(:acosh!, 1.0 - TOLERANCE) }.should raise_error(Errno::EDOM)
- lambda { @object.send(:acosh!, 0) }.should raise_error(Errno::EDOM)
- lambda { @object.send(:acosh!, -1.0) }.should raise_error(Errno::EDOM)
+ -> { @object.send(:acosh!, 1.0 - TOLERANCE) }.should raise_error(Errno::EDOM)
+ -> { @object.send(:acosh!, 0) }.should raise_error(Errno::EDOM)
+ -> { @object.send(:acosh!, -1.0) }.should raise_error(Errno::EDOM)
end
it "raises a TypeError when passed a Complex number" do
- lambda { @object.send(:acosh!, Complex(4, 5)) }.should raise_error(TypeError)
+ -> { @object.send(:acosh!, Complex(4, 5)) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/complex/math/shared/asin.rb b/spec/ruby/library/complex/math/shared/asin.rb
index 1705745210..91fed7aa06 100644
--- a/spec/ruby/library/complex/math/shared/asin.rb
+++ b/spec/ruby/library/complex/math/shared/asin.rb
@@ -34,14 +34,14 @@ describe :complex_math_asin_bang, shared: true do
end
it "raises an Errno::EDOM if the argument is greater than 1.0" do
- lambda { @object.send(:asin!, 1.0001) }.should raise_error( Errno::EDOM)
+ -> { @object.send(:asin!, 1.0001) }.should raise_error( Errno::EDOM)
end
it "raises an Errno::EDOM if the argument is less than -1.0" do
- lambda { @object.send(:asin!, -1.0001) }.should raise_error( Errno::EDOM)
+ -> { @object.send(:asin!, -1.0001) }.should raise_error( Errno::EDOM)
end
it "raises a TypeError when passed a Complex number" do
- lambda { @object.send(:asin!, Complex(4, 5)) }.should raise_error(TypeError)
+ -> { @object.send(:asin!, Complex(4, 5)) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/complex/math/shared/asinh.rb b/spec/ruby/library/complex/math/shared/asinh.rb
index b4256e7475..b4ddd3a22e 100644
--- a/spec/ruby/library/complex/math/shared/asinh.rb
+++ b/spec/ruby/library/complex/math/shared/asinh.rb
@@ -27,6 +27,6 @@ describe :complex_math_asinh_bang, shared: true do
end
it "raises a TypeError when passed a Complex number" do
- lambda { @object.send(:asinh!, Complex(4, 5)) }.should raise_error(TypeError)
+ -> { @object.send(:asinh!, Complex(4, 5)) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/complex/math/shared/atan.rb b/spec/ruby/library/complex/math/shared/atan.rb
index 46c1897407..63a496e841 100644
--- a/spec/ruby/library/complex/math/shared/atan.rb
+++ b/spec/ruby/library/complex/math/shared/atan.rb
@@ -27,6 +27,6 @@ describe :complex_math_atan_bang, shared: true do
end
it "raises a TypeError when passed a Complex number" do
- lambda { @object.send(:atan!, Complex(4, 5)) }.should raise_error(TypeError)
+ -> { @object.send(:atan!, Complex(4, 5)) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/complex/math/shared/atan2.rb b/spec/ruby/library/complex/math/shared/atan2.rb
index 3305d695c5..6d89423924 100644
--- a/spec/ruby/library/complex/math/shared/atan2.rb
+++ b/spec/ruby/library/complex/math/shared/atan2.rb
@@ -27,8 +27,8 @@ describe :complex_math_atan2_bang, shared: true do
end
it "raises a TypeError when passed a Complex number" do
- lambda { @object.send(:atan2!, Complex(4, 5), Complex(4, 5)) }.should raise_error(TypeError)
- lambda { @object.send(:atan2!, 4, Complex(4, 5)) }.should raise_error(TypeError)
- lambda { @object.send(:atan2!, Complex(4, 5), 5) }.should raise_error(TypeError)
+ -> { @object.send(:atan2!, Complex(4, 5), Complex(4, 5)) }.should raise_error(TypeError)
+ -> { @object.send(:atan2!, 4, Complex(4, 5)) }.should raise_error(TypeError)
+ -> { @object.send(:atan2!, Complex(4, 5), 5) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/complex/math/shared/atanh.rb b/spec/ruby/library/complex/math/shared/atanh.rb
index ebd4d7c223..ae80e61bec 100644
--- a/spec/ruby/library/complex/math/shared/atanh.rb
+++ b/spec/ruby/library/complex/math/shared/atanh.rb
@@ -25,6 +25,6 @@ end
describe :complex_math_atanh_no_complex, shared: true do
it "raises a TypeError when passed a Complex number" do
- lambda { @object.send(:atanh!, Complex(4, 5)) }.should raise_error(TypeError)
+ -> { @object.send(:atanh!, Complex(4, 5)) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/complex/math/shared/cos.rb b/spec/ruby/library/complex/math/shared/cos.rb
index ddd8512231..31cb5ab1e5 100644
--- a/spec/ruby/library/complex/math/shared/cos.rb
+++ b/spec/ruby/library/complex/math/shared/cos.rb
@@ -25,6 +25,6 @@ describe :complex_math_cos_bang, shared: true do
end
it "raises a TypeError when passed a Complex number" do
- lambda { @object.send(:cos!, Complex(3, 4)) }.should raise_error(TypeError)
+ -> { @object.send(:cos!, Complex(3, 4)) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/complex/math/shared/cosh.rb b/spec/ruby/library/complex/math/shared/cosh.rb
index a56a655cd5..7cf561c985 100644
--- a/spec/ruby/library/complex/math/shared/cosh.rb
+++ b/spec/ruby/library/complex/math/shared/cosh.rb
@@ -23,6 +23,6 @@ describe :complex_math_cosh_bang, shared: true do
end
it "raises a TypeError when passed a Complex number" do
- lambda { @object.send(:cosh!, Complex(4, 5)) }.should raise_error(TypeError)
+ -> { @object.send(:cosh!, Complex(4, 5)) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/complex/math/shared/exp.rb b/spec/ruby/library/complex/math/shared/exp.rb
index 91ab5739be..6715ac63d3 100644
--- a/spec/ruby/library/complex/math/shared/exp.rb
+++ b/spec/ruby/library/complex/math/shared/exp.rb
@@ -23,6 +23,6 @@ describe :complex_math_exp_bang, shared: true do
end
it "raises a TypeError when passed a Complex number" do
- lambda { @object.send(:exp!, Complex(1, 3)) }.should raise_error(TypeError)
+ -> { @object.send(:exp!, Complex(1, 3)) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/complex/math/shared/log.rb b/spec/ruby/library/complex/math/shared/log.rb
index f3aad0d66a..4b23e8c5f2 100644
--- a/spec/ruby/library/complex/math/shared/log.rb
+++ b/spec/ruby/library/complex/math/shared/log.rb
@@ -30,10 +30,10 @@ describe :complex_math_log_bang, shared: true do
end
it "raises an Errno::EDOM if the argument is less than 0" do
- lambda { @object.send(:log!, -10) }.should raise_error(Errno::EDOM)
+ -> { @object.send(:log!, -10) }.should raise_error(Errno::EDOM)
end
it "raises a TypeError when passed a Complex number" do
- lambda { @object.send(:log!, Complex(4, 5)) }.should raise_error(TypeError)
+ -> { @object.send(:log!, Complex(4, 5)) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/complex/math/shared/log10.rb b/spec/ruby/library/complex/math/shared/log10.rb
index a2cf5344bf..f49934d958 100644
--- a/spec/ruby/library/complex/math/shared/log10.rb
+++ b/spec/ruby/library/complex/math/shared/log10.rb
@@ -32,10 +32,10 @@ describe :complex_math_log10_bang, shared: true do
end
it "raises an Errno::EDOM when the passed argument is negative" do
- lambda { @object.send(:log10!, -10) }.should raise_error(Errno::EDOM)
+ -> { @object.send(:log10!, -10) }.should raise_error(Errno::EDOM)
end
it "raises a TypeError when passed a Complex number" do
- lambda { @object.send(:log10!, Complex(4, 5)) }.should raise_error(TypeError)
+ -> { @object.send(:log10!, Complex(4, 5)) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/complex/math/shared/sin.rb b/spec/ruby/library/complex/math/shared/sin.rb
index 418ba5d810..1cb1b29cda 100644
--- a/spec/ruby/library/complex/math/shared/sin.rb
+++ b/spec/ruby/library/complex/math/shared/sin.rb
@@ -25,6 +25,6 @@ describe :complex_math_sin_bang, shared: true do
end
it "raises a TypeError when passed a Complex number" do
- lambda { @object.send(:sin!, Complex(4, 5)) }.should raise_error(TypeError)
+ -> { @object.send(:sin!, Complex(4, 5)) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/complex/math/shared/sinh.rb b/spec/ruby/library/complex/math/shared/sinh.rb
index bd85bd0799..de80a376da 100644
--- a/spec/ruby/library/complex/math/shared/sinh.rb
+++ b/spec/ruby/library/complex/math/shared/sinh.rb
@@ -23,6 +23,6 @@ describe :complex_math_sinh_bang, shared: true do
end
it "raises a TypeError when passed a Complex number" do
- lambda { @object.send(:sinh!, Complex(4, 5)) }.should raise_error(TypeError)
+ -> { @object.send(:sinh!, Complex(4, 5)) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/complex/math/shared/sqrt.rb b/spec/ruby/library/complex/math/shared/sqrt.rb
index b6a289c3f9..23b1ba48ff 100644
--- a/spec/ruby/library/complex/math/shared/sqrt.rb
+++ b/spec/ruby/library/complex/math/shared/sqrt.rb
@@ -24,11 +24,11 @@ describe :complex_math_sqrt_bang, shared: true do
end
it "raises Errno::EDOM when the passed argument is negative" do
- lambda { @object.send(:sqrt!, -4) }.should raise_error(Errno::EDOM)
- lambda { @object.send(:sqrt!, -19.36) }.should raise_error(Errno::EDOM)
+ -> { @object.send(:sqrt!, -4) }.should raise_error(Errno::EDOM)
+ -> { @object.send(:sqrt!, -19.36) }.should raise_error(Errno::EDOM)
end
it "raises a TypeError when passed a Complex number" do
- lambda { @object.send(:sqrt!, Complex(4, 5)) }.should raise_error(TypeError)
+ -> { @object.send(:sqrt!, Complex(4, 5)) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/complex/math/shared/tan.rb b/spec/ruby/library/complex/math/shared/tan.rb
index df7a6ff19b..9022c84fc9 100644
--- a/spec/ruby/library/complex/math/shared/tan.rb
+++ b/spec/ruby/library/complex/math/shared/tan.rb
@@ -23,6 +23,6 @@ describe :complex_math_tan_bang, shared: true do
end
it "raises a TypeError when passed a Complex number" do
- lambda { @object.send(:tan!, Complex(4, 5)) }.should raise_error(TypeError)
+ -> { @object.send(:tan!, Complex(4, 5)) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/complex/math/shared/tanh.rb b/spec/ruby/library/complex/math/shared/tanh.rb
index 7bf07f9a3f..f2c9a5abb1 100644
--- a/spec/ruby/library/complex/math/shared/tanh.rb
+++ b/spec/ruby/library/complex/math/shared/tanh.rb
@@ -27,6 +27,6 @@ describe :complex_math_tanh_bang, shared: true do
end
it "raises a TypeError when passed a Complex number" do
- lambda { @object.send(:tanh!, Complex(4, 5)) }.should raise_error(TypeError)
+ -> { @object.send(:tanh!, Complex(4, 5)) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/date/add_month_spec.rb b/spec/ruby/library/date/add_month_spec.rb
index 32e9de4d70..40833f6487 100644
--- a/spec/ruby/library/date/add_month_spec.rb
+++ b/spec/ruby/library/date/add_month_spec.rb
@@ -21,18 +21,18 @@ describe "Date#>>" do
end
it "raise a TypeError when passed a Symbol" do
- lambda { Date.civil(2007,2,27) >> :hello }.should raise_error(TypeError)
+ -> { Date.civil(2007,2,27) >> :hello }.should raise_error(TypeError)
end
it "raise a TypeError when passed a String" do
- lambda { Date.civil(2007,2,27) >> "hello" }.should raise_error(TypeError)
+ -> { Date.civil(2007,2,27) >> "hello" }.should raise_error(TypeError)
end
it "raise a TypeError when passed a Date" do
- lambda { Date.civil(2007,2,27) >> Date.new }.should raise_error(TypeError)
+ -> { Date.civil(2007,2,27) >> Date.new }.should raise_error(TypeError)
end
it "raise a TypeError when passed an Object" do
- lambda { Date.civil(2007,2,27) >> Object.new }.should raise_error(TypeError)
+ -> { Date.civil(2007,2,27) >> Object.new }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/date/add_spec.rb b/spec/ruby/library/date/add_spec.rb
index edcff4c55b..2b9cc62023 100644
--- a/spec/ruby/library/date/add_spec.rb
+++ b/spec/ruby/library/date/add_spec.rb
@@ -13,18 +13,18 @@ describe "Date#+" do
end
it "raises a TypeError when passed a Symbol" do
- lambda { Date.civil(2007,2,27) + :hello }.should raise_error(TypeError)
+ -> { Date.civil(2007,2,27) + :hello }.should raise_error(TypeError)
end
it "raises a TypeError when passed a String" do
- lambda { Date.civil(2007,2,27) + "hello" }.should raise_error(TypeError)
+ -> { Date.civil(2007,2,27) + "hello" }.should raise_error(TypeError)
end
it "raises a TypeError when passed a Date" do
- lambda { Date.civil(2007,2,27) + Date.new }.should raise_error(TypeError)
+ -> { Date.civil(2007,2,27) + Date.new }.should raise_error(TypeError)
end
it "raises a TypeError when passed an Object" do
- lambda { Date.civil(2007,2,27) + Object.new }.should raise_error(TypeError)
+ -> { Date.civil(2007,2,27) + Object.new }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/date/constants_spec.rb b/spec/ruby/library/date/constants_spec.rb
index dd7803052f..fc1dba4999 100644
--- a/spec/ruby/library/date/constants_spec.rb
+++ b/spec/ruby/library/date/constants_spec.rb
@@ -34,11 +34,11 @@ describe "Date constants" do
it "freezes MONTHNAMES, DAYNAMES, ABBR_MONTHNAMES, ABBR_DAYSNAMES" do
[Date::MONTHNAMES, Date::DAYNAMES, Date::ABBR_MONTHNAMES, Date::ABBR_DAYNAMES].each do |ary|
- lambda {
+ -> {
ary << "Unknown"
}.should raise_error(frozen_error_class, /frozen/)
ary.compact.each do |name|
- lambda {
+ -> {
name << "modified"
}.should raise_error(frozen_error_class, /frozen/)
end
diff --git a/spec/ruby/library/date/iso8601_spec.rb b/spec/ruby/library/date/iso8601_spec.rb
index 41f055e648..21b0a4cedd 100644
--- a/spec/ruby/library/date/iso8601_spec.rb
+++ b/spec/ruby/library/date/iso8601_spec.rb
@@ -28,10 +28,10 @@ describe "Date.iso8601" do
end
it "raises an ArgumentError when passed a Symbol without a valid Date" do
- lambda { Date.iso8601(:test) }.should raise_error(ArgumentError)
+ -> { Date.iso8601(:test) }.should raise_error(ArgumentError)
end
it "raises a TypeError when passed an Object" do
- lambda { Date.iso8601(Object.new) }.should raise_error(TypeError)
+ -> { Date.iso8601(Object.new) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/date/minus_month_spec.rb b/spec/ruby/library/date/minus_month_spec.rb
index 563da073f0..470c4d8a76 100644
--- a/spec/ruby/library/date/minus_month_spec.rb
+++ b/spec/ruby/library/date/minus_month_spec.rb
@@ -14,10 +14,10 @@ describe "Date#<<" do
end
it "raises an error on non numeric parameters" do
- lambda { Date.civil(2007,2,27) << :hello }.should raise_error(TypeError)
- lambda { Date.civil(2007,2,27) << "hello" }.should raise_error(TypeError)
- lambda { Date.civil(2007,2,27) << Date.new }.should raise_error(TypeError)
- lambda { Date.civil(2007,2,27) << Object.new }.should raise_error(TypeError)
+ -> { Date.civil(2007,2,27) << :hello }.should raise_error(TypeError)
+ -> { Date.civil(2007,2,27) << "hello" }.should raise_error(TypeError)
+ -> { Date.civil(2007,2,27) << Date.new }.should raise_error(TypeError)
+ -> { Date.civil(2007,2,27) << Object.new }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/date/minus_spec.rb b/spec/ruby/library/date/minus_spec.rb
index 4cf6129f02..5a2a29e04a 100644
--- a/spec/ruby/library/date/minus_spec.rb
+++ b/spec/ruby/library/date/minus_spec.rb
@@ -22,9 +22,9 @@ describe "Date#-" do
end
it "raises an error for non Numeric arguments" do
- lambda { Date.civil(2007,2,27) - :hello }.should raise_error(TypeError)
- lambda { Date.civil(2007,2,27) - "hello" }.should raise_error(TypeError)
- lambda { Date.civil(2007,2,27) - Object.new }.should raise_error(TypeError)
+ -> { Date.civil(2007,2,27) - :hello }.should raise_error(TypeError)
+ -> { Date.civil(2007,2,27) - "hello" }.should raise_error(TypeError)
+ -> { Date.civil(2007,2,27) - Object.new }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/date/parse_spec.rb b/spec/ruby/library/date/parse_spec.rb
index 09e072ba3e..379847a6fd 100644
--- a/spec/ruby/library/date/parse_spec.rb
+++ b/spec/ruby/library/date/parse_spec.rb
@@ -23,7 +23,7 @@ describe "Date#parse" do
# Specs using numbers
it "throws an argument error for a single digit" do
- lambda{ Date.parse("1") }.should raise_error(ArgumentError)
+ ->{ Date.parse("1") }.should raise_error(ArgumentError)
end
it "parses DD as month day number" do
@@ -66,8 +66,8 @@ describe "Date#parse" do
end
it "raises a TypeError trying to parse non-String-like object" do
- lambda { Date.parse(1) }.should raise_error(TypeError)
- lambda { Date.parse(:invalid) }.should raise_error(TypeError)
+ -> { Date.parse(1) }.should raise_error(TypeError)
+ -> { Date.parse(:invalid) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/date/plus_spec.rb b/spec/ruby/library/date/plus_spec.rb
index ce5e074ed7..0cb99fd4ca 100644
--- a/spec/ruby/library/date/plus_spec.rb
+++ b/spec/ruby/library/date/plus_spec.rb
@@ -15,6 +15,6 @@ describe "Date#+" do
end
it "raises TypeError if argument is not Numeric" do
- lambda { Date.today + Date.today }.should raise_error(TypeError)
+ -> { Date.today + Date.today }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/date/shared/civil.rb b/spec/ruby/library/date/shared/civil.rb
index 47dbed49fc..4c8ba23622 100644
--- a/spec/ruby/library/date/shared/civil.rb
+++ b/spec/ruby/library/date/shared/civil.rb
@@ -36,14 +36,14 @@ describe :date_civil, shared: true do
end
it "doesn't create dates for invalid arguments" do
- lambda { Date.send(@method, 2000, 13, 31) }.should raise_error(ArgumentError)
- lambda { Date.send(@method, 2000, 12, 32) }.should raise_error(ArgumentError)
- lambda { Date.send(@method, 2000, 2, 30) }.should raise_error(ArgumentError)
- lambda { Date.send(@method, 1900, 2, 29) }.should raise_error(ArgumentError)
- lambda { Date.send(@method, 2000, 2, 29) }.should_not raise_error(ArgumentError)
-
- lambda { Date.send(@method, 1582, 10, 14) }.should raise_error(ArgumentError)
- lambda { Date.send(@method, 1582, 10, 15) }.should_not raise_error(ArgumentError)
+ -> { Date.send(@method, 2000, 13, 31) }.should raise_error(ArgumentError)
+ -> { Date.send(@method, 2000, 12, 32) }.should raise_error(ArgumentError)
+ -> { Date.send(@method, 2000, 2, 30) }.should raise_error(ArgumentError)
+ -> { Date.send(@method, 1900, 2, 29) }.should raise_error(ArgumentError)
+ -> { Date.send(@method, 2000, 2, 29) }.should_not raise_error(ArgumentError)
+
+ -> { Date.send(@method, 1582, 10, 14) }.should raise_error(ArgumentError)
+ -> { Date.send(@method, 1582, 10, 15) }.should_not raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/date/shared/commercial.rb b/spec/ruby/library/date/shared/commercial.rb
index 354a5d5cd0..39c9af47b6 100644
--- a/spec/ruby/library/date/shared/commercial.rb
+++ b/spec/ruby/library/date/shared/commercial.rb
@@ -25,15 +25,15 @@ describe :date_commercial, shared: true do
end
it "creates only Date objects for valid weeks" do
- lambda { Date.send(@method, 2004, 53, 1) }.should_not raise_error(ArgumentError)
- lambda { Date.send(@method, 2004, 53, 0) }.should raise_error(ArgumentError)
- lambda { Date.send(@method, 2004, 53, 8) }.should raise_error(ArgumentError)
- lambda { Date.send(@method, 2004, 54, 1) }.should raise_error(ArgumentError)
- lambda { Date.send(@method, 2004, 0, 1) }.should raise_error(ArgumentError)
+ -> { Date.send(@method, 2004, 53, 1) }.should_not raise_error(ArgumentError)
+ -> { Date.send(@method, 2004, 53, 0) }.should raise_error(ArgumentError)
+ -> { Date.send(@method, 2004, 53, 8) }.should raise_error(ArgumentError)
+ -> { Date.send(@method, 2004, 54, 1) }.should raise_error(ArgumentError)
+ -> { Date.send(@method, 2004, 0, 1) }.should raise_error(ArgumentError)
- lambda { Date.send(@method, 2003, 52, 1) }.should_not raise_error(ArgumentError)
- lambda { Date.send(@method, 2003, 53, 1) }.should raise_error(ArgumentError)
- lambda { Date.send(@method, 2003, 52, 0) }.should raise_error(ArgumentError)
- lambda { Date.send(@method, 2003, 52, 8) }.should raise_error(ArgumentError)
+ -> { Date.send(@method, 2003, 52, 1) }.should_not raise_error(ArgumentError)
+ -> { Date.send(@method, 2003, 53, 1) }.should raise_error(ArgumentError)
+ -> { Date.send(@method, 2003, 52, 0) }.should raise_error(ArgumentError)
+ -> { Date.send(@method, 2003, 52, 8) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/date/strftime_spec.rb b/spec/ruby/library/date/strftime_spec.rb
index 973d4668f8..9d298e42e6 100644
--- a/spec/ruby/library/date/strftime_spec.rb
+++ b/spec/ruby/library/date/strftime_spec.rb
@@ -3,7 +3,7 @@ require_relative '../../shared/time/strftime_for_date'
describe "Date#strftime" do
before :all do
- @new_date = lambda { |y,m,d| Date.civil(y,m,d) }
+ @new_date = -> y, m, d { Date.civil(y,m,d) }
@date = Date.civil(2000, 4, 9)
end
diff --git a/spec/ruby/library/datetime/hour_spec.rb b/spec/ruby/library/datetime/hour_spec.rb
index f019b60c74..8efd5f92f0 100644
--- a/spec/ruby/library/datetime/hour_spec.rb
+++ b/spec/ruby/library/datetime/hour_spec.rb
@@ -15,27 +15,27 @@ describe "DateTime#hour" do
end
it "raises an error for Rational" do
- lambda { new_datetime(hour: 1 + Rational(1,2)) }.should raise_error(ArgumentError)
+ -> { new_datetime(hour: 1 + Rational(1,2)) }.should raise_error(ArgumentError)
end
it "raises an error for Float" do
- lambda { new_datetime(hour: 1.5).hour }.should raise_error(ArgumentError)
+ -> { new_datetime(hour: 1.5).hour }.should raise_error(ArgumentError)
end
it "raises an error for Rational" do
- lambda { new_datetime(day: 1 + Rational(1,2)) }.should raise_error(ArgumentError)
+ -> { new_datetime(day: 1 + Rational(1,2)) }.should raise_error(ArgumentError)
end
it "raises an error, when the hour is smaller than -24" do
- lambda { new_datetime(hour: -25) }.should raise_error(ArgumentError)
+ -> { new_datetime(hour: -25) }.should raise_error(ArgumentError)
end
it "raises an error, when the hour is larger than 24" do
- lambda { new_datetime(hour: 25) }.should raise_error(ArgumentError)
+ -> { new_datetime(hour: 25) }.should raise_error(ArgumentError)
end
it "raises an error for hour fractions smaller than -24" do
- lambda { new_datetime(hour: -24 - Rational(1,2)) }.should(
+ -> { new_datetime(hour: -24 - Rational(1,2)) }.should(
raise_error(ArgumentError))
end
diff --git a/spec/ruby/library/datetime/new_spec.rb b/spec/ruby/library/datetime/new_spec.rb
index 85fbe7578b..6a4dced384 100644
--- a/spec/ruby/library/datetime/new_spec.rb
+++ b/spec/ruby/library/datetime/new_spec.rb
@@ -47,6 +47,6 @@ describe "DateTime.new" do
end
it "raises an error on invalid arguments" do
- lambda { new_datetime(minute: 999) }.should raise_error(ArgumentError)
+ -> { new_datetime(minute: 999) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/datetime/parse_spec.rb b/spec/ruby/library/datetime/parse_spec.rb
index e5441bd9dc..e9bf4e2ed1 100644
--- a/spec/ruby/library/datetime/parse_spec.rb
+++ b/spec/ruby/library/datetime/parse_spec.rb
@@ -20,7 +20,7 @@ describe "DateTime.parse" do
# Specs using numbers
it "throws an argument error for a single digit" do
- lambda{ DateTime.parse("1") }.should raise_error(ArgumentError)
+ ->{ DateTime.parse("1") }.should raise_error(ArgumentError)
end
it "parses DD as month day number" do
@@ -54,23 +54,23 @@ describe "DateTime.parse" do
end
it "throws an argument error for invalid month values" do
- lambda{DateTime.parse("2012-13-08T15:43:59")}.should raise_error(ArgumentError)
+ ->{DateTime.parse("2012-13-08T15:43:59")}.should raise_error(ArgumentError)
end
it "throws an argument error for invalid day values" do
- lambda{DateTime.parse("2012-12-32T15:43:59")}.should raise_error(ArgumentError)
+ ->{DateTime.parse("2012-12-32T15:43:59")}.should raise_error(ArgumentError)
end
it "throws an argument error for invalid hour values" do
- lambda{DateTime.parse("2012-12-31T25:43:59")}.should raise_error(ArgumentError)
+ ->{DateTime.parse("2012-12-31T25:43:59")}.should raise_error(ArgumentError)
end
it "throws an argument error for invalid minute values" do
- lambda{DateTime.parse("2012-12-31T25:43:59")}.should raise_error(ArgumentError)
+ ->{DateTime.parse("2012-12-31T25:43:59")}.should raise_error(ArgumentError)
end
it "throws an argument error for invalid second values" do
- lambda{DateTime.parse("2012-11-08T15:43:61")}.should raise_error(ArgumentError)
+ ->{DateTime.parse("2012-11-08T15:43:61")}.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/datetime/shared/min.rb b/spec/ruby/library/datetime/shared/min.rb
index e69d86ab02..a35b839281 100644
--- a/spec/ruby/library/datetime/shared/min.rb
+++ b/spec/ruby/library/datetime/shared/min.rb
@@ -14,27 +14,27 @@ describe :datetime_min, shared: true do
end
it "raises an error for Rational" do
- lambda { new_datetime minute: 5 + Rational(1,2) }.should raise_error(ArgumentError)
+ -> { new_datetime minute: 5 + Rational(1,2) }.should raise_error(ArgumentError)
end
it "raises an error for Float" do
- lambda { new_datetime minute: 5.5 }.should raise_error(ArgumentError)
+ -> { new_datetime minute: 5.5 }.should raise_error(ArgumentError)
end
it "raises an error for Rational" do
- lambda { new_datetime(hour: 2 + Rational(1,2)) }.should raise_error(ArgumentError)
+ -> { new_datetime(hour: 2 + Rational(1,2)) }.should raise_error(ArgumentError)
end
it "raises an error, when the minute is smaller than -60" do
- lambda { new_datetime(minute: -61) }.should raise_error(ArgumentError)
+ -> { new_datetime(minute: -61) }.should raise_error(ArgumentError)
end
it "raises an error, when the minute is greater or equal than 60" do
- lambda { new_datetime(minute: 60) }.should raise_error(ArgumentError)
+ -> { new_datetime(minute: 60) }.should raise_error(ArgumentError)
end
it "raises an error for minute fractions smaller than -60" do
- lambda { new_datetime(minute: -60 - Rational(1,2))}.should(
+ -> { new_datetime(minute: -60 - Rational(1,2))}.should(
raise_error(ArgumentError))
end
end
diff --git a/spec/ruby/library/datetime/shared/sec.rb b/spec/ruby/library/datetime/shared/sec.rb
index 68e8af8e40..60009213aa 100644
--- a/spec/ruby/library/datetime/shared/sec.rb
+++ b/spec/ruby/library/datetime/shared/sec.rb
@@ -23,19 +23,19 @@ describe :datetime_sec, shared: true do
end
it "raises an error when minute is given as a rational" do
- lambda { new_datetime(minute: 5 + Rational(1,2)) }.should raise_error(ArgumentError)
+ -> { new_datetime(minute: 5 + Rational(1,2)) }.should raise_error(ArgumentError)
end
it "raises an error, when the second is smaller than -60" do
- lambda { new_datetime(second: -61) }.should raise_error(ArgumentError)
+ -> { new_datetime(second: -61) }.should raise_error(ArgumentError)
end
it "raises an error, when the second is greater or equal than 60" do
- lambda { new_datetime(second: 60) }.should raise_error(ArgumentError)
+ -> { new_datetime(second: 60) }.should raise_error(ArgumentError)
end
it "raises an error for second fractions smaller than -60" do
- lambda { new_datetime(second: -60 - Rational(1,2))}.should(
+ -> { new_datetime(second: -60 - Rational(1,2))}.should(
raise_error(ArgumentError))
end
diff --git a/spec/ruby/library/datetime/strftime_spec.rb b/spec/ruby/library/datetime/strftime_spec.rb
index f95b52fffb..1c925f92eb 100644
--- a/spec/ruby/library/datetime/strftime_spec.rb
+++ b/spec/ruby/library/datetime/strftime_spec.rb
@@ -4,13 +4,13 @@ require_relative '../../shared/time/strftime_for_time'
describe "DateTime#strftime" do
before :all do
- @new_date = lambda { |y,m,d| DateTime.civil(y,m,d) }
- @new_time = lambda { |*args| DateTime.civil(*args) }
- @new_time_in_zone = lambda { |zone,offset,*args|
+ @new_date = -> y, m, d { DateTime.civil(y,m,d) }
+ @new_time = -> *args { DateTime.civil(*args) }
+ @new_time_in_zone = -> zone, offset, *args {
y, m, d, h, min, s = args
DateTime.new(y, m||1, d||1, h||0, min||0, s||0, Rational(offset, 24))
}
- @new_time_with_offset = lambda { |y,m,d,h,min,s,offset|
+ @new_time_with_offset = -> y, m, d, h, min, s, offset {
DateTime.new(y,m,d,h,min,s, Rational(offset, 86_400))
}
diff --git a/spec/ruby/library/delegate/delegate_class/instance_method_spec.rb b/spec/ruby/library/delegate/delegate_class/instance_method_spec.rb
index 7e50dd81d8..16bf8d734c 100644
--- a/spec/ruby/library/delegate/delegate_class/instance_method_spec.rb
+++ b/spec/ruby/library/delegate/delegate_class/instance_method_spec.rb
@@ -20,7 +20,7 @@ describe "DelegateClass.instance_method" do
end
it "raises a NameError for a private instance methods of the delegated class" do
- lambda {
+ -> {
@klass.instance_method(:priv)
}.should raise_error(NameError)
end
@@ -44,7 +44,7 @@ describe "DelegateClass.instance_method" do
end
it "raises a NameError for an invalid method name" do
- lambda {
+ -> {
@klass.instance_method(:invalid_and_silly_method_name)
}.should raise_error(NameError)
end
diff --git a/spec/ruby/library/delegate/delegator/frozen_spec.rb b/spec/ruby/library/delegate/delegator/frozen_spec.rb
index bc91259b08..b3145c54b1 100644
--- a/spec/ruby/library/delegate/delegator/frozen_spec.rb
+++ b/spec/ruby/library/delegate/delegator/frozen_spec.rb
@@ -18,7 +18,7 @@ describe "Delegator when frozen" do
end
it "is not writable" do
- lambda{ @delegate[0] += 2 }.should raise_error( RuntimeError )
+ ->{ @delegate[0] += 2 }.should raise_error( RuntimeError )
end
it "creates a frozen clone" do
@@ -30,7 +30,7 @@ describe "Delegator when frozen" do
end
it "causes mutative calls to raise RuntimeError" do
- lambda{ @delegate.__setobj__("hola!") }.should raise_error( RuntimeError )
+ ->{ @delegate.__setobj__("hola!") }.should raise_error( RuntimeError )
end
it "returns false if only the delegated object is frozen" do
diff --git a/spec/ruby/library/delegate/delegator/method_spec.rb b/spec/ruby/library/delegate/delegator/method_spec.rb
index 7b66c28125..81c8eea710 100644
--- a/spec/ruby/library/delegate/delegator/method_spec.rb
+++ b/spec/ruby/library/delegate/delegator/method_spec.rb
@@ -14,7 +14,7 @@ describe "Delegator#method" do
end
it "raises a NameError for protected methods of the delegate object" do
- lambda {
+ -> {
-> {
@delegate.method(:prot)
}.should complain(/delegator does not forward private method #prot/)
@@ -22,7 +22,7 @@ describe "Delegator#method" do
end
it "raises a NameError for a private methods of the delegate object" do
- lambda {
+ -> {
-> {
@delegate.method(:priv)
}.should complain(/delegator does not forward private method #priv/)
@@ -48,7 +48,7 @@ describe "Delegator#method" do
end
it "raises a NameError for an invalid method name" do
- lambda {
+ -> {
@delegate.method(:invalid_and_silly_method_name)
}.should raise_error(NameError)
end
@@ -62,7 +62,7 @@ describe "Delegator#method" do
it "raises a NameError if method is no longer valid because object has changed" do
m = @delegate.method(:pub)
@delegate.__setobj__([1,2,3])
- lambda {
+ -> {
m.call
}.should raise_error(NameError)
end
diff --git a/spec/ruby/library/delegate/delegator/send_spec.rb b/spec/ruby/library/delegate/delegator/send_spec.rb
index b14e6996d1..3022c2ce91 100644
--- a/spec/ruby/library/delegate/delegator/send_spec.rb
+++ b/spec/ruby/library/delegate/delegator/send_spec.rb
@@ -12,15 +12,15 @@ describe "SimpleDelegator.new" do
end
it "forwards protected method calls" do
- lambda{ @delegate.prot }.should raise_error( NoMethodError )
+ ->{ @delegate.prot }.should raise_error( NoMethodError )
end
it "doesn't forward private method calls" do
- lambda{ @delegate.priv }.should raise_error( NoMethodError )
+ ->{ @delegate.priv }.should raise_error( NoMethodError )
end
it "doesn't forward private method calls even via send or __send__" do
- lambda{ @delegate.send(:priv, 42) }.should raise_error( NoMethodError )
- lambda{ @delegate.__send__(:priv, 42) }.should raise_error( NoMethodError )
+ ->{ @delegate.send(:priv, 42) }.should raise_error( NoMethodError )
+ ->{ @delegate.__send__(:priv, 42) }.should raise_error( NoMethodError )
end
end
diff --git a/spec/ruby/library/delegate/delegator/untaint_spec.rb b/spec/ruby/library/delegate/delegator/untaint_spec.rb
index 4fa4509b53..ddcf854a43 100644
--- a/spec/ruby/library/delegate/delegator/untaint_spec.rb
+++ b/spec/ruby/library/delegate/delegator/untaint_spec.rb
@@ -3,7 +3,7 @@ require_relative '../fixtures/classes'
describe "Delegator#untaint" do
before :each do
- @delegate = lambda { DelegateSpecs::Delegator.new("") }.call
+ @delegate = -> { DelegateSpecs::Delegator.new("") }.call
end
it "returns self" do
diff --git a/spec/ruby/library/digest/bubblebabble_spec.rb b/spec/ruby/library/digest/bubblebabble_spec.rb
index 7e06a974a3..7097553466 100644
--- a/spec/ruby/library/digest/bubblebabble_spec.rb
+++ b/spec/ruby/library/digest/bubblebabble_spec.rb
@@ -20,10 +20,10 @@ describe "Digest.bubblebabble" do
end
it "raises a TypeError when passed nil" do
- lambda { Digest.bubblebabble(nil) }.should raise_error(TypeError)
+ -> { Digest.bubblebabble(nil) }.should raise_error(TypeError)
end
it "raises a TypeError when passed a Fixnum" do
- lambda { Digest.bubblebabble(9001) }.should raise_error(TypeError)
+ -> { Digest.bubblebabble(9001) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/digest/hexencode_spec.rb b/spec/ruby/library/digest/hexencode_spec.rb
index 717590dd14..fcbbf4846a 100644
--- a/spec/ruby/library/digest/hexencode_spec.rb
+++ b/spec/ruby/library/digest/hexencode_spec.rb
@@ -22,10 +22,10 @@ describe "Digest.hexencode" do
end
it "raises a TypeError when passed nil" do
- lambda { Digest.hexencode(nil) }.should raise_error(TypeError)
+ -> { Digest.hexencode(nil) }.should raise_error(TypeError)
end
it "raises a TypeError when passed a Fixnum" do
- lambda { Digest.hexencode(9001) }.should raise_error(TypeError)
+ -> { Digest.hexencode(9001) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/digest/md5/file_spec.rb b/spec/ruby/library/digest/md5/file_spec.rb
index 2684f50373..0c8d12cbc9 100644
--- a/spec/ruby/library/digest/md5/file_spec.rb
+++ b/spec/ruby/library/digest/md5/file_spec.rb
@@ -34,10 +34,10 @@ describe "Digest::MD5.file" do
it_behaves_like :file_read_directory, :file, Digest::MD5
it "raises a Errno::ENOENT when passed a path that does not exist" do
- lambda { Digest::MD5.file("") }.should raise_error(Errno::ENOENT)
+ -> { Digest::MD5.file("") }.should raise_error(Errno::ENOENT)
end
it "raises a TypeError when passed nil" do
- lambda { Digest::MD5.file(nil) }.should raise_error(TypeError)
+ -> { Digest::MD5.file(nil) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/digest/sha1/file_spec.rb b/spec/ruby/library/digest/sha1/file_spec.rb
index 1ac4e1f756..9c15f5b02f 100644
--- a/spec/ruby/library/digest/sha1/file_spec.rb
+++ b/spec/ruby/library/digest/sha1/file_spec.rb
@@ -34,10 +34,10 @@ describe "Digest::SHA1.file" do
it_behaves_like :file_read_directory, :file, Digest::SHA1
it "raises a Errno::ENOENT when passed a path that does not exist" do
- lambda { Digest::SHA1.file("") }.should raise_error(Errno::ENOENT)
+ -> { Digest::SHA1.file("") }.should raise_error(Errno::ENOENT)
end
it "raises a TypeError when passed nil" do
- lambda { Digest::SHA1.file(nil) }.should raise_error(TypeError)
+ -> { Digest::SHA1.file(nil) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/digest/sha256/file_spec.rb b/spec/ruby/library/digest/sha256/file_spec.rb
index 3cccbb518f..6103971b5a 100644
--- a/spec/ruby/library/digest/sha256/file_spec.rb
+++ b/spec/ruby/library/digest/sha256/file_spec.rb
@@ -34,10 +34,10 @@ describe "Digest::SHA256.file" do
it_behaves_like :file_read_directory, :file, Digest::SHA256
it "raises a Errno::ENOENT when passed a path that does not exist" do
- lambda { Digest::SHA256.file("") }.should raise_error(Errno::ENOENT)
+ -> { Digest::SHA256.file("") }.should raise_error(Errno::ENOENT)
end
it "raises a TypeError when passed nil" do
- lambda { Digest::SHA256.file(nil) }.should raise_error(TypeError)
+ -> { Digest::SHA256.file(nil) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/digest/sha384/file_spec.rb b/spec/ruby/library/digest/sha384/file_spec.rb
index 376d819040..8556f10175 100644
--- a/spec/ruby/library/digest/sha384/file_spec.rb
+++ b/spec/ruby/library/digest/sha384/file_spec.rb
@@ -34,10 +34,10 @@ describe "Digest::SHA384.file" do
it_behaves_like :file_read_directory, :file, Digest::SHA384
it "raises a Errno::ENOENT when passed a path that does not exist" do
- lambda { Digest::SHA384.file("") }.should raise_error(Errno::ENOENT)
+ -> { Digest::SHA384.file("") }.should raise_error(Errno::ENOENT)
end
it "raises a TypeError when passed nil" do
- lambda { Digest::SHA384.file(nil) }.should raise_error(TypeError)
+ -> { Digest::SHA384.file(nil) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/digest/sha512/file_spec.rb b/spec/ruby/library/digest/sha512/file_spec.rb
index 0043146efa..781ec781e5 100644
--- a/spec/ruby/library/digest/sha512/file_spec.rb
+++ b/spec/ruby/library/digest/sha512/file_spec.rb
@@ -34,10 +34,10 @@ describe "Digest::SHA512.file" do
it_behaves_like :file_read_directory, :file, Digest::SHA512
it "raises a Errno::ENOENT when passed a path that does not exist" do
- lambda { Digest::SHA512.file("") }.should raise_error(Errno::ENOENT)
+ -> { Digest::SHA512.file("") }.should raise_error(Errno::ENOENT)
end
it "raises a TypeError when passed nil" do
- lambda { Digest::SHA512.file(nil) }.should raise_error(TypeError)
+ -> { Digest::SHA512.file(nil) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/erb/filename_spec.rb b/spec/ruby/library/erb/filename_spec.rb
index 26fed2897b..8ecaed7343 100644
--- a/spec/ruby/library/erb/filename_spec.rb
+++ b/spec/ruby/library/erb/filename_spec.rb
@@ -6,7 +6,7 @@ describe "ERB#filename" do
filename = 'foobar.rhtml'
erb = ERB.new('<% if true %>') # will raise SyntaxError
erb.filename = filename
- lambda {
+ -> {
begin
erb.result(binding)
rescue Exception => e
@@ -23,7 +23,7 @@ describe "ERB#filename" do
it "uses '(erb)' as filename when filename is not set" do
erb = ERB.new('<% if true %>') # will raise SyntaxError
- lambda {
+ -> {
begin
erb.result(binding)
rescue Exception => e
diff --git a/spec/ruby/library/erb/new_spec.rb b/spec/ruby/library/erb/new_spec.rb
index f1e5cd299e..3bb870dd3f 100644
--- a/spec/ruby/library/erb/new_spec.rb
+++ b/spec/ruby/library/erb/new_spec.rb
@@ -38,7 +38,7 @@ END
ruby_version_is "2.6" do
it "warns invalid trim_mode" do
- lambda do
+ -> do
ERBSpecs.new_erb(@eruby_str, trim_mode: '')
end.should complain(/Invalid ERB trim mode/)
end
@@ -83,7 +83,7 @@ END
</p>
END
- lambda {
+ -> {
ERBSpecs.new_erb(input, trim_mode: '-').result
}.should raise_error(SyntaxError)
end
@@ -143,6 +143,6 @@ END
it "forget local variables defined previous one" do
ERB.new(@eruby_str).result
- lambda{ ERB.new("<%= list %>").result }.should raise_error(NameError)
+ ->{ ERB.new("<%= list %>").result }.should raise_error(NameError)
end
end
diff --git a/spec/ruby/library/erb/result_spec.rb b/spec/ruby/library/erb/result_spec.rb
index eb9d0c5356..a29c1ccedb 100644
--- a/spec/ruby/library/erb/result_spec.rb
+++ b/spec/ruby/library/erb/result_spec.rb
@@ -41,7 +41,7 @@ END
it "is not able to h() or u() unless including ERB::Util" do
input = "<%=h '<>' %>"
- lambda {
+ -> {
ERB.new(input).result()
}.should raise_error(NameError)
end
@@ -79,7 +79,7 @@ END
expected = '123'
myerb2.new.main1().should == expected
- lambda {
+ -> {
myerb2.new.main2()
}.should raise_error(NameError)
end
diff --git a/spec/ruby/library/erb/run_spec.rb b/spec/ruby/library/erb/run_spec.rb
index c4b82b155e..8c07442d8f 100644
--- a/spec/ruby/library/erb/run_spec.rb
+++ b/spec/ruby/library/erb/run_spec.rb
@@ -52,7 +52,7 @@ END
it "is not able to h() or u() unless including ERB::Util" do
input = "<%=h '<>' %>"
- lambda {
+ -> {
_steal_stdout { ERB.new(input).run() }
}.should raise_error(NameError)
end
@@ -89,7 +89,7 @@ END
actual = _steal_stdout { myerb2.new.main1() }
actual.should == expected
- lambda {
+ -> {
_steal_stdout { myerb2.new.main2() }
}.should raise_error(NameError)
end
diff --git a/spec/ruby/library/etc/getgrgid_spec.rb b/spec/ruby/library/etc/getgrgid_spec.rb
index 04758912b3..c7bd55b20e 100644
--- a/spec/ruby/library/etc/getgrgid_spec.rb
+++ b/spec/ruby/library/etc/getgrgid_spec.rb
@@ -54,12 +54,12 @@ platform_is_not :windows do
end
it "raises if the group does not exist" do
- lambda { Etc.getgrgid(9876)}.should raise_error(ArgumentError)
+ -> { Etc.getgrgid(9876)}.should raise_error(ArgumentError)
end
it "raises a TypeError if not passed an Integer" do
- lambda { Etc.getgrgid("foo") }.should raise_error(TypeError)
- lambda { Etc.getgrgid(nil) }.should raise_error(TypeError)
+ -> { Etc.getgrgid("foo") }.should raise_error(TypeError)
+ -> { Etc.getgrgid(nil) }.should raise_error(TypeError)
end
it "can be called safely by multiple threads" do
diff --git a/spec/ruby/library/etc/getgrnam_spec.rb b/spec/ruby/library/etc/getgrnam_spec.rb
index 3fe94ed5f5..a7c624efbf 100644
--- a/spec/ruby/library/etc/getgrnam_spec.rb
+++ b/spec/ruby/library/etc/getgrnam_spec.rb
@@ -21,7 +21,7 @@ platform_is_not :windows do
end
it "only accepts strings as argument" do
- lambda {
+ -> {
Etc.getgrnam(123)
Etc.getgrnam(nil)
}.should raise_error(TypeError)
diff --git a/spec/ruby/library/etc/getpwnam_spec.rb b/spec/ruby/library/etc/getpwnam_spec.rb
index 2062ee51aa..3f4416aa9d 100644
--- a/spec/ruby/library/etc/getpwnam_spec.rb
+++ b/spec/ruby/library/etc/getpwnam_spec.rb
@@ -19,7 +19,7 @@ platform_is_not :windows do
end
it "only accepts strings as argument" do
- lambda {
+ -> {
Etc.getpwnam(123)
Etc.getpwnam(nil)
}.should raise_error(TypeError)
diff --git a/spec/ruby/library/etc/getpwuid_spec.rb b/spec/ruby/library/etc/getpwuid_spec.rb
index 3f6866ddc6..5b98f0f8d9 100644
--- a/spec/ruby/library/etc/getpwuid_spec.rb
+++ b/spec/ruby/library/etc/getpwuid_spec.rb
@@ -27,7 +27,7 @@ platform_is_not :windows do
end
it "only accepts integers as argument" do
- lambda {
+ -> {
Etc.getpwuid("foo")
Etc.getpwuid(nil)
}.should raise_error(TypeError)
diff --git a/spec/ruby/library/expect/expect_spec.rb b/spec/ruby/library/expect/expect_spec.rb
index 454023979f..a7041d42ee 100644
--- a/spec/ruby/library/expect/expect_spec.rb
+++ b/spec/ruby/library/expect/expect_spec.rb
@@ -37,7 +37,7 @@ platform_is_not :windows do
@write << "prompt> hello"
@read.close
- lambda {
+ -> {
@read.expect("hello")
}.should raise_error(IOError)
end
diff --git a/spec/ruby/library/fiber/alive_spec.rb b/spec/ruby/library/fiber/alive_spec.rb
index 0c20a1c6b8..47149d5279 100644
--- a/spec/ruby/library/fiber/alive_spec.rb
+++ b/spec/ruby/library/fiber/alive_spec.rb
@@ -30,16 +30,16 @@ describe "Fiber#alive?" do
it "returns false for a Fiber that's dead" do
fiber = Fiber.new { true }
fiber.resume
- lambda { fiber.resume }.should raise_error(FiberError)
+ -> { fiber.resume }.should raise_error(FiberError)
fiber.alive?.should be_false
end
it "always returns false for a dead Fiber" do
fiber = Fiber.new { true }
fiber.resume
- lambda { fiber.resume }.should raise_error(FiberError)
+ -> { fiber.resume }.should raise_error(FiberError)
fiber.alive?.should be_false
- lambda { fiber.resume }.should raise_error(FiberError)
+ -> { fiber.resume }.should raise_error(FiberError)
fiber.alive?.should be_false
fiber.alive?.should be_false
end
diff --git a/spec/ruby/library/fiber/resume_spec.rb b/spec/ruby/library/fiber/resume_spec.rb
index 3d86aed94e..dae717c8a1 100644
--- a/spec/ruby/library/fiber/resume_spec.rb
+++ b/spec/ruby/library/fiber/resume_spec.rb
@@ -7,6 +7,6 @@ describe "Fiber#resume" do
fiber1 = Fiber.new { true }
fiber2 = Fiber.new { fiber1.transfer; Fiber.yield }
fiber2.resume
- lambda { fiber2.resume }.should raise_error(FiberError)
+ -> { fiber2.resume }.should raise_error(FiberError)
end
end
diff --git a/spec/ruby/library/fiber/transfer_spec.rb b/spec/ruby/library/fiber/transfer_spec.rb
index 1063bebeda..d13053666c 100644
--- a/spec/ruby/library/fiber/transfer_spec.rb
+++ b/spec/ruby/library/fiber/transfer_spec.rb
@@ -44,7 +44,7 @@ describe "Fiber#transfer" do
it "raises a FiberError when transferring to a Fiber which resumes itself" do
fiber = Fiber.new { fiber.resume }
- lambda { fiber.transfer }.should raise_error(FiberError)
+ -> { fiber.transfer }.should raise_error(FiberError)
end
it "works if Fibers in different Threads each transfer to a Fiber in the same Thread" do
diff --git a/spec/ruby/library/getoptlong/ordering_spec.rb b/spec/ruby/library/getoptlong/ordering_spec.rb
index e6b645018d..695d1cafa7 100644
--- a/spec/ruby/library/getoptlong/ordering_spec.rb
+++ b/spec/ruby/library/getoptlong/ordering_spec.rb
@@ -9,7 +9,7 @@ describe "GetoptLong#ordering=" do
opts.quiet = true
opts.get
- lambda {
+ -> {
opts.ordering = GetoptLong::PERMUTE
}.should raise_error(ArgumentError)
end
@@ -18,7 +18,7 @@ describe "GetoptLong#ordering=" do
it "raises an ArgumentError if given an invalid value" do
opts = GetoptLong.new
- lambda {
+ -> {
opts.ordering = 12345
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/getoptlong/set_options_spec.rb b/spec/ruby/library/getoptlong/set_options_spec.rb
index f2acccea28..36b9c579c4 100644
--- a/spec/ruby/library/getoptlong/set_options_spec.rb
+++ b/spec/ruby/library/getoptlong/set_options_spec.rb
@@ -39,7 +39,7 @@ describe "GetoptLong#set_options" do
it "raises an ArgumentError if too many argument flags where given" do
argv [] do
- lambda {
+ -> {
@opts.set_options(["--size", GetoptLong::NO_ARGUMENT, GetoptLong::REQUIRED_ARGUMENT])
}.should raise_error(ArgumentError)
end
@@ -48,7 +48,7 @@ describe "GetoptLong#set_options" do
it "raises a RuntimeError if processing has already started" do
argv [] do
@opts.get
- lambda {
+ -> {
@opts.set_options()
}.should raise_error(RuntimeError)
end
@@ -56,7 +56,7 @@ describe "GetoptLong#set_options" do
it "raises an ArgumentError if no argument flag was given" do
argv [] do
- lambda {
+ -> {
@opts.set_options(["--size"])
}.should raise_error(ArgumentError)
end
@@ -64,7 +64,7 @@ describe "GetoptLong#set_options" do
it "raises an ArgumentError if one of the given arguments is not an Array" do
argv [] do
- lambda {
+ -> {
@opts.set_options(
["--size", GetoptLong::REQUIRED_ARGUMENT],
"test")
@@ -74,13 +74,13 @@ describe "GetoptLong#set_options" do
it "raises an ArgumentError if the same option is given twice" do
argv [] do
- lambda {
+ -> {
@opts.set_options(
["--size", GetoptLong::NO_ARGUMENT],
["--size", GetoptLong::OPTIONAL_ARGUMENT])
}.should raise_error(ArgumentError)
- lambda {
+ -> {
@opts.set_options(
["--size", GetoptLong::NO_ARGUMENT],
["-s", "--size", GetoptLong::OPTIONAL_ARGUMENT])
@@ -90,7 +90,7 @@ describe "GetoptLong#set_options" do
it "raises an ArgumentError if the given option is invalid" do
argv [] do
- lambda {
+ -> {
@opts.set_options(["-size", GetoptLong::NO_ARGUMENT])
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/getoptlong/shared/get.rb b/spec/ruby/library/getoptlong/shared/get.rb
index 91a0fbaacc..772a7f6773 100644
--- a/spec/ruby/library/getoptlong/shared/get.rb
+++ b/spec/ruby/library/getoptlong/shared/get.rb
@@ -49,7 +49,7 @@ describe :getoptlong_get, shared: true do
it "raises a if an argument was required, but none given" do
argv [ "--size" ] do
- lambda { @opts.send(@method) }.should raise_error(GetoptLong::MissingArgument)
+ -> { @opts.send(@method) }.should raise_error(GetoptLong::MissingArgument)
end
end
diff --git a/spec/ruby/library/ipaddr/new_spec.rb b/spec/ruby/library/ipaddr/new_spec.rb
index 77165d2857..c8c8bc80b3 100644
--- a/spec/ruby/library/ipaddr/new_spec.rb
+++ b/spec/ruby/library/ipaddr/new_spec.rb
@@ -3,9 +3,9 @@ require 'ipaddr'
describe "IPAddr#new" do
it "initializes IPAddr" do
- lambda{ IPAddr.new("3FFE:505:ffff::/48") }.should_not raise_error
- lambda{ IPAddr.new("0:0:0:1::") }.should_not raise_error
- lambda{ IPAddr.new("2001:200:300::/48") }.should_not raise_error
+ ->{ IPAddr.new("3FFE:505:ffff::/48") }.should_not raise_error
+ ->{ IPAddr.new("0:0:0:1::") }.should_not raise_error
+ ->{ IPAddr.new("2001:200:300::/48") }.should_not raise_error
end
it "initializes IPAddr ipv6 address with short notation" do
@@ -85,7 +85,7 @@ describe "IPAddr#new" do
["::ffff:192.168.1.2/120", Socket::AF_INET],
["[192.168.1.2]/120"],
].each { |args|
- lambda{
+ ->{
IPAddr.new(*args)
}.should raise_error(ArgumentError)
}
diff --git a/spec/ruby/library/ipaddr/reverse_spec.rb b/spec/ruby/library/ipaddr/reverse_spec.rb
index db39b6c7a0..6ebb343269 100644
--- a/spec/ruby/library/ipaddr/reverse_spec.rb
+++ b/spec/ruby/library/ipaddr/reverse_spec.rb
@@ -11,7 +11,7 @@ end
describe "IPAddr#ip6_arpa" do
it "converts an IPv6 address into the reverse DNS lookup representation according to RFC3172" do
IPAddr.new("3ffe:505:2::f").ip6_arpa.should == "f.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.0.5.0.5.0.e.f.f.3.ip6.arpa"
- lambda{
+ ->{
IPAddr.new("192.168.2.1").ip6_arpa
}.should raise_error(ArgumentError)
end
@@ -20,7 +20,7 @@ end
describe "IPAddr#ip6_int" do
it "converts an IPv6 address into the reverse DNS lookup representation according to RFC1886" do
IPAddr.new("3ffe:505:2::f").ip6_int.should == "f.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.0.5.0.5.0.e.f.f.3.ip6.int"
- lambda{
+ ->{
IPAddr.new("192.168.2.1").ip6_int
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/logger/device/close_spec.rb b/spec/ruby/library/logger/device/close_spec.rb
index 3fd96675a4..d7d107fcce 100644
--- a/spec/ruby/library/logger/device/close_spec.rb
+++ b/spec/ruby/library/logger/device/close_spec.rb
@@ -18,14 +18,14 @@ describe "Logger::LogDevice#close" do
ruby_version_is ""..."2.7" do
it "closes the LogDevice's stream" do
@device.close
- lambda { @device.write("Test") }.should complain(/\Alog writing failed\./)
+ -> { @device.write("Test") }.should complain(/\Alog writing failed\./)
end
end
ruby_version_is "2.7" do
it "closes the LogDevice's stream" do
@device.close
- lambda { @device.write("Test") }.should complain(/\Alog shifting failed\./)
+ -> { @device.write("Test") }.should complain(/\Alog shifting failed\./)
end
end
end
diff --git a/spec/ruby/library/logger/device/new_spec.rb b/spec/ruby/library/logger/device/new_spec.rb
index a66c364392..578624a91c 100644
--- a/spec/ruby/library/logger/device/new_spec.rb
+++ b/spec/ruby/library/logger/device/new_spec.rb
@@ -40,7 +40,7 @@ describe "Logger::LogDevice#new" do
end
it "receives options via a hash as second argument" do
- lambda { Logger::LogDevice.new(STDERR,
+ -> { Logger::LogDevice.new(STDERR,
{ shift_age: 8, shift_size: 10
})}.should_not raise_error
end
diff --git a/spec/ruby/library/logger/device/write_spec.rb b/spec/ruby/library/logger/device/write_spec.rb
index 6f4e13c8e6..5506bb2c38 100644
--- a/spec/ruby/library/logger/device/write_spec.rb
+++ b/spec/ruby/library/logger/device/write_spec.rb
@@ -38,14 +38,14 @@ describe "Logger::LogDevice#write" do
ruby_version_is ""..."2.7" do
it "fails if the device is already closed" do
@device.close
- lambda { @device.write "foo" }.should complain(/\Alog writing failed\./)
+ -> { @device.write "foo" }.should complain(/\Alog writing failed\./)
end
end
ruby_version_is "2.7" do
it "fails if the device is already closed" do
@device.close
- lambda { @device.write "foo" }.should complain(/\Alog shifting failed\./)
+ -> { @device.write "foo" }.should complain(/\Alog shifting failed\./)
end
end
end
diff --git a/spec/ruby/library/logger/logger/add_spec.rb b/spec/ruby/library/logger/logger/add_spec.rb
index 85a3b5ae3c..3f709e18ba 100644
--- a/spec/ruby/library/logger/logger/add_spec.rb
+++ b/spec/ruby/library/logger/logger/add_spec.rb
@@ -52,7 +52,7 @@ describe "Logger#add" do
end
it "receives a block" do
- lambda {
+ -> {
@logger.log(nil, "test", "TestApp") do
1+1
end
@@ -61,7 +61,7 @@ describe "Logger#add" do
it "calls the block if message is nil" do
temp = 0
- lambda {
+ -> {
@logger.log(nil, nil, "TestApp") do
temp = 1+1
end
@@ -71,7 +71,7 @@ describe "Logger#add" do
it "ignores the block if the message is not nil" do
temp = 0
- lambda {
+ -> {
@logger.log(nil, "not nil", "TestApp") do
temp = 1+1
end
diff --git a/spec/ruby/library/logger/logger/close_spec.rb b/spec/ruby/library/logger/logger/close_spec.rb
index 45da2fa770..81aac2a6cd 100644
--- a/spec/ruby/library/logger/logger/close_spec.rb
+++ b/spec/ruby/library/logger/logger/close_spec.rb
@@ -15,6 +15,6 @@ describe "Logger#close" do
it "closes the logging device" do
@logger.close
- lambda { @logger.add(nil, "Foo") }.should complain(/\Alog writing failed\./)
+ -> { @logger.add(nil, "Foo") }.should complain(/\Alog writing failed\./)
end
end
diff --git a/spec/ruby/library/logger/logger/datetime_format_spec.rb b/spec/ruby/library/logger/logger/datetime_format_spec.rb
index 39fd29bd3f..582b34bfda 100644
--- a/spec/ruby/library/logger/logger/datetime_format_spec.rb
+++ b/spec/ruby/library/logger/logger/datetime_format_spec.rb
@@ -49,7 +49,7 @@ describe "Logger#datetime_format=" do
end
it "follows the Time#strftime format" do
- lambda { @logger.datetime_format = "%Y-%m" }.should_not raise_error
+ -> { @logger.datetime_format = "%Y-%m" }.should_not raise_error
regex = /\d{4}-\d{2}-\d{2}oo-\w+ar/
@logger.datetime_format = "%Foo-%Bar"
diff --git a/spec/ruby/library/logger/logger/new_spec.rb b/spec/ruby/library/logger/logger/new_spec.rb
index 43f701a3dd..f70e1904f3 100644
--- a/spec/ruby/library/logger/logger/new_spec.rb
+++ b/spec/ruby/library/logger/logger/new_spec.rb
@@ -15,7 +15,7 @@ describe "Logger#new" do
it "creates a new logger object" do
l = Logger.new(STDERR)
- lambda { l.add(Logger::WARN, "Foo") }.should output_to_fd(/Foo/, STDERR)
+ -> { l.add(Logger::WARN, "Foo") }.should output_to_fd(/Foo/, STDERR)
end
it "receives a logging device as first argument" do
@@ -28,13 +28,13 @@ describe "Logger#new" do
end
it "receives a frequency rotation as second argument" do
- lambda { Logger.new(@log_file, "daily") }.should_not raise_error
- lambda { Logger.new(@log_file, "weekly") }.should_not raise_error
- lambda { Logger.new(@log_file, "monthly") }.should_not raise_error
+ -> { Logger.new(@log_file, "daily") }.should_not raise_error
+ -> { Logger.new(@log_file, "weekly") }.should_not raise_error
+ -> { Logger.new(@log_file, "monthly") }.should_not raise_error
end
it "also receives a number of log files to keep as second argument" do
- lambda { Logger.new(@log_file, 1).close }.should_not raise_error
+ -> { Logger.new(@log_file, 1).close }.should_not raise_error
end
it "receives a maximum logfile size as third argument" do
diff --git a/spec/ruby/library/logger/logger/unknown_spec.rb b/spec/ruby/library/logger/logger/unknown_spec.rb
index 4a042f9215..b174b8b2c9 100644
--- a/spec/ruby/library/logger/logger/unknown_spec.rb
+++ b/spec/ruby/library/logger/logger/unknown_spec.rb
@@ -29,7 +29,7 @@ describe "Logger#unknown" do
end
it "receives empty messages" do
- lambda { @logger.unknown("") }.should_not raise_error
+ -> { @logger.unknown("") }.should_not raise_error
@log_file.rewind
LoggerSpecs.strip_date(@log_file.readlines.first).should == "ANY -- : \n"
end
diff --git a/spec/ruby/library/mathn/integer/prime_division_spec.rb b/spec/ruby/library/mathn/integer/prime_division_spec.rb
index e2141490f0..fb4a1c3fea 100644
--- a/spec/ruby/library/mathn/integer/prime_division_spec.rb
+++ b/spec/ruby/library/mathn/integer/prime_division_spec.rb
@@ -15,7 +15,7 @@ ruby_version_is ''...'2.5' do
end
it "raises a ZeroDivisionError when is called on zero" do
- lambda { 0.prime_division }.should raise_error(ZeroDivisionError)
+ -> { 0.prime_division }.should raise_error(ZeroDivisionError)
end
end
end
diff --git a/spec/ruby/library/mathn/math/shared/rsqrt.rb b/spec/ruby/library/mathn/math/shared/rsqrt.rb
index 0f623a7d4f..ea3d1b0cfc 100644
--- a/spec/ruby/library/mathn/math/shared/rsqrt.rb
+++ b/spec/ruby/library/mathn/math/shared/rsqrt.rb
@@ -14,8 +14,8 @@ describe :mathn_math_rsqrt, shared: true do
end
it "raises an Math::DomainError if the argument is a negative number" do
- lambda { @object.send(:rsqrt, -1) }.should raise_error(Math::DomainError)
- lambda { @object.send(:rsqrt, -4.0) }.should raise_error(Math::DomainError)
- lambda { @object.send(:rsqrt, -16/64) }.should raise_error(Math::DomainError)
+ -> { @object.send(:rsqrt, -1) }.should raise_error(Math::DomainError)
+ -> { @object.send(:rsqrt, -4.0) }.should raise_error(Math::DomainError)
+ -> { @object.send(:rsqrt, -16/64) }.should raise_error(Math::DomainError)
end
end
diff --git a/spec/ruby/library/matrix/antisymmetric_spec.rb b/spec/ruby/library/matrix/antisymmetric_spec.rb
index 534fab60ea..3eb0f8b726 100644
--- a/spec/ruby/library/matrix/antisymmetric_spec.rb
+++ b/spec/ruby/library/matrix/antisymmetric_spec.rb
@@ -28,7 +28,7 @@ ruby_version_is "2.6" do
Matrix.empty(0, 2),
Matrix.empty(2, 0),
].each do |rectangular_matrix|
- lambda {
+ -> {
rectangular_matrix.antisymmetric?
}.should raise_error(Matrix::ErrDimensionMismatch)
end
diff --git a/spec/ruby/library/matrix/build_spec.rb b/spec/ruby/library/matrix/build_spec.rb
index 6819b9b617..6d8017a3df 100644
--- a/spec/ruby/library/matrix/build_spec.rb
+++ b/spec/ruby/library/matrix/build_spec.rb
@@ -29,14 +29,14 @@ describe "Matrix.build" do
end
it "requires integers as parameters" do
- lambda { Matrix.build("1", "2"){1} }.should raise_error(TypeError)
- lambda { Matrix.build(nil, nil){1} }.should raise_error(TypeError)
- lambda { Matrix.build(1..2){1} }.should raise_error(TypeError)
+ -> { Matrix.build("1", "2"){1} }.should raise_error(TypeError)
+ -> { Matrix.build(nil, nil){1} }.should raise_error(TypeError)
+ -> { Matrix.build(1..2){1} }.should raise_error(TypeError)
end
it "requires non-negative integers" do
- lambda { Matrix.build(-1, 1){1} }.should raise_error(ArgumentError)
- lambda { Matrix.build(+1,-1){1} }.should raise_error(ArgumentError)
+ -> { Matrix.build(-1, 1){1} }.should raise_error(ArgumentError)
+ -> { Matrix.build(+1,-1){1} }.should raise_error(ArgumentError)
end
it "returns empty Matrix if one argument is zero" do
diff --git a/spec/ruby/library/matrix/column_spec.rb b/spec/ruby/library/matrix/column_spec.rb
index 46cd57f2b3..1f3c80964a 100644
--- a/spec/ruby/library/matrix/column_spec.rb
+++ b/spec/ruby/library/matrix/column_spec.rb
@@ -29,7 +29,7 @@ describe "Matrix#column" do
end
it "never yields when out of bounds" do
- lambda { @m.column(3){ raise } }.should_not raise_error
- lambda { @m.column(-4){ raise } }.should_not raise_error
+ -> { @m.column(3){ raise } }.should_not raise_error
+ -> { @m.column(-4){ raise } }.should_not raise_error
end
end
diff --git a/spec/ruby/library/matrix/constructor_spec.rb b/spec/ruby/library/matrix/constructor_spec.rb
index 2479923fb5..70d77babbb 100644
--- a/spec/ruby/library/matrix/constructor_spec.rb
+++ b/spec/ruby/library/matrix/constructor_spec.rb
@@ -5,10 +5,10 @@ require 'matrix'
describe "Matrix.[]" do
it "requires arrays as parameters" do
- lambda { Matrix[5] }.should raise_error(TypeError)
- lambda { Matrix[nil] }.should raise_error(TypeError)
- lambda { Matrix[1..2] }.should raise_error(TypeError)
- lambda { Matrix[[1, 2], 3] }.should raise_error(TypeError)
+ -> { Matrix[5] }.should raise_error(TypeError)
+ -> { Matrix[nil] }.should raise_error(TypeError)
+ -> { Matrix[1..2] }.should raise_error(TypeError)
+ -> { Matrix[[1, 2], 3] }.should raise_error(TypeError)
end
it "creates an empty Matrix with no arguments" do
@@ -18,9 +18,9 @@ describe "Matrix.[]" do
end
it "raises for non-rectangular matrices" do
- lambda{ Matrix[ [0], [0,1] ] }.should \
+ ->{ Matrix[ [0], [0,1] ] }.should \
raise_error(Matrix::ErrDimensionMismatch)
- lambda{ Matrix[ [0,1], [0,1,2], [0,1] ]}.should \
+ ->{ Matrix[ [0,1], [0,1,2], [0,1] ]}.should \
raise_error(Matrix::ErrDimensionMismatch)
end
diff --git a/spec/ruby/library/matrix/diagonal_spec.rb b/spec/ruby/library/matrix/diagonal_spec.rb
index f066a21c47..ef9738e73e 100644
--- a/spec/ruby/library/matrix/diagonal_spec.rb
+++ b/spec/ruby/library/matrix/diagonal_spec.rb
@@ -64,7 +64,7 @@ describe "Matrix.diagonal?" do
Matrix.empty(0, 2),
Matrix.empty(2, 0),
].each do |rectangular_matrix|
- lambda {
+ -> {
rectangular_matrix.diagonal?
}.should raise_error(Matrix::ErrDimensionMismatch)
end
diff --git a/spec/ruby/library/matrix/divide_spec.rb b/spec/ruby/library/matrix/divide_spec.rb
index 205bc5d892..2e3bb85bf6 100644
--- a/spec/ruby/library/matrix/divide_spec.rb
+++ b/spec/ruby/library/matrix/divide_spec.rb
@@ -30,7 +30,7 @@ describe "Matrix#/" do
end
it "raises a Matrix::ErrDimensionMismatch if the matrices are different sizes" do
- lambda { @a / Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch)
+ -> { @a / Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch)
end
it "returns an instance of Matrix" do
@@ -46,9 +46,9 @@ describe "Matrix#/" do
end
it "raises a TypeError if other is of wrong type" do
- lambda { @a / nil }.should raise_error(TypeError)
- lambda { @a / "a" }.should raise_error(TypeError)
- lambda { @a / [ [1, 2] ] }.should raise_error(TypeError)
- lambda { @a / Object.new }.should raise_error(TypeError)
+ -> { @a / nil }.should raise_error(TypeError)
+ -> { @a / "a" }.should raise_error(TypeError)
+ -> { @a / [ [1, 2] ] }.should raise_error(TypeError)
+ -> { @a / Object.new }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/matrix/each_spec.rb b/spec/ruby/library/matrix/each_spec.rb
index 214aae1a3a..f3b0f01867 100644
--- a/spec/ruby/library/matrix/each_spec.rb
+++ b/spec/ruby/library/matrix/each_spec.rb
@@ -31,13 +31,13 @@ describe "Matrix#each with an argument" do
end
it "raises an ArgumentError for unrecognized argument" do
- lambda {
+ -> {
@m.each("all"){}
}.should raise_error(ArgumentError)
- lambda {
+ -> {
@m.each(nil){}
}.should raise_error(ArgumentError)
- lambda {
+ -> {
@m.each(:left){}
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/matrix/each_with_index_spec.rb b/spec/ruby/library/matrix/each_with_index_spec.rb
index 36a1309292..a005b88621 100644
--- a/spec/ruby/library/matrix/each_with_index_spec.rb
+++ b/spec/ruby/library/matrix/each_with_index_spec.rb
@@ -38,13 +38,13 @@ describe "Matrix#each_with_index with an argument" do
end
it "raises an ArgumentError for unrecognized argument" do
- lambda {
+ -> {
@m.each_with_index("all"){}
}.should raise_error(ArgumentError)
- lambda {
+ -> {
@m.each_with_index(nil){}
}.should raise_error(ArgumentError)
- lambda {
+ -> {
@m.each_with_index(:left){}
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/matrix/eigenvalue_decomposition/initialize_spec.rb b/spec/ruby/library/matrix/eigenvalue_decomposition/initialize_spec.rb
index f8964070d9..8438f63133 100644
--- a/spec/ruby/library/matrix/eigenvalue_decomposition/initialize_spec.rb
+++ b/spec/ruby/library/matrix/eigenvalue_decomposition/initialize_spec.rb
@@ -3,16 +3,16 @@ require 'matrix'
describe "Matrix::EigenvalueDecomposition#initialize" do
it "raises an error if argument is not a matrix" do
- lambda {
+ -> {
Matrix::EigenvalueDecomposition.new([[]])
}.should raise_error(TypeError)
- lambda {
+ -> {
Matrix::EigenvalueDecomposition.new(42)
}.should raise_error(TypeError)
end
it "raises an error if matrix is not square" do
- lambda {
+ -> {
Matrix::EigenvalueDecomposition.new(Matrix[[1, 2]])
}.should raise_error(Matrix::ErrDimensionMismatch)
end
diff --git a/spec/ruby/library/matrix/empty_spec.rb b/spec/ruby/library/matrix/empty_spec.rb
index ce23d926d6..5f294711db 100644
--- a/spec/ruby/library/matrix/empty_spec.rb
+++ b/spec/ruby/library/matrix/empty_spec.rb
@@ -15,7 +15,7 @@ describe "Matrix#empty?" do
end
it "doesn't accept any parameter" do
- lambda{
+ ->{
Matrix[ [1, 2] ].empty?(42)
}.should raise_error(ArgumentError)
end
@@ -38,23 +38,23 @@ describe "Matrix.empty" do
end
it "does not accept more than two parameters" do
- lambda{
+ ->{
Matrix.empty(1, 2, 3)
}.should raise_error(ArgumentError)
end
it "raises an error if both dimensions are > 0" do
- lambda{
+ ->{
Matrix.empty(1, 2)
}.should raise_error(ArgumentError)
end
it "raises an error if any dimension is < 0" do
- lambda{
+ ->{
Matrix.empty(-2, 0)
}.should raise_error(ArgumentError)
- lambda{
+ ->{
Matrix.empty(0, -2)
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/matrix/exponent_spec.rb b/spec/ruby/library/matrix/exponent_spec.rb
index c496d9d3cc..447c962967 100644
--- a/spec/ruby/library/matrix/exponent_spec.rb
+++ b/spec/ruby/library/matrix/exponent_spec.rb
@@ -17,8 +17,8 @@ describe "Matrix#**" do
it "raises a ErrDimensionMismatch for non square matrices" do
m = Matrix[ [1, 1], [1, 2], [2, 3]]
- lambda { m ** 3 }.should raise_error(Matrix::ErrDimensionMismatch)
- lambda { m ** 0 }.should raise_error(Matrix::ErrDimensionMismatch)
+ -> { m ** 3 }.should raise_error(Matrix::ErrDimensionMismatch)
+ -> { m ** 0 }.should raise_error(Matrix::ErrDimensionMismatch)
end
describe "that is <= 0" do
@@ -30,8 +30,8 @@ describe "Matrix#**" do
it "raises a ErrDimensionMismatch for irregular matrices" do
m = Matrix[ [1, 1], [1, 1] ]
- lambda { m ** -2 }.should raise_error(Matrix::ErrNotRegular)
- lambda { m ** 0 }.should raise_error(Matrix::ErrNotRegular)
+ -> { m ** -2 }.should raise_error(Matrix::ErrNotRegular)
+ -> { m ** 0 }.should raise_error(Matrix::ErrNotRegular)
end
end
end
diff --git a/spec/ruby/library/matrix/find_index_spec.rb b/spec/ruby/library/matrix/find_index_spec.rb
index 27672e526b..c2bfa6d61a 100644
--- a/spec/ruby/library/matrix/find_index_spec.rb
+++ b/spec/ruby/library/matrix/find_index_spec.rb
@@ -130,16 +130,16 @@ end
describe "Matrix#find_index with two arguments" do
it "raises an ArgumentError for an unrecognized last argument" do
- lambda {
+ -> {
@m.find_index(1, "all"){}
}.should raise_error(ArgumentError)
- lambda {
+ -> {
@m.find_index(1, nil){}
}.should raise_error(ArgumentError)
- lambda {
+ -> {
@m.find_index(1, :left){}
}.should raise_error(ArgumentError)
- lambda {
+ -> {
@m.find_index(:diagonal, 1){}
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/matrix/hermitian_spec.rb b/spec/ruby/library/matrix/hermitian_spec.rb
index dda5280d64..177ca64d83 100644
--- a/spec/ruby/library/matrix/hermitian_spec.rb
+++ b/spec/ruby/library/matrix/hermitian_spec.rb
@@ -21,7 +21,7 @@ describe "Matrix.hermitian?" do
Matrix.empty(0, 2),
Matrix.empty(2, 0),
].each do |rectangular_matrix|
- lambda {
+ -> {
rectangular_matrix.hermitian?
}.should raise_error(Matrix::ErrDimensionMismatch)
end
diff --git a/spec/ruby/library/matrix/lup_decomposition/determinant_spec.rb b/spec/ruby/library/matrix/lup_decomposition/determinant_spec.rb
index ca2ddf18c6..9d733066c1 100644
--- a/spec/ruby/library/matrix/lup_decomposition/determinant_spec.rb
+++ b/spec/ruby/library/matrix/lup_decomposition/determinant_spec.rb
@@ -13,7 +13,7 @@ describe "Matrix::LUPDecomposition#determinant" do
Matrix[[7, 8], [14, 46], [28, 82]],
].each do |m|
lup = m.lup
- lambda {
+ -> {
lup.determinant
}.should raise_error(Matrix::ErrDimensionMismatch)
end
diff --git a/spec/ruby/library/matrix/lup_decomposition/initialize_spec.rb b/spec/ruby/library/matrix/lup_decomposition/initialize_spec.rb
index 00dc47ddb9..36afb349e6 100644
--- a/spec/ruby/library/matrix/lup_decomposition/initialize_spec.rb
+++ b/spec/ruby/library/matrix/lup_decomposition/initialize_spec.rb
@@ -3,10 +3,10 @@ require 'matrix'
describe "Matrix::LUPDecomposition#initialize" do
it "raises an error if argument is not a matrix" do
- lambda {
+ -> {
Matrix::LUPDecomposition.new([[]])
}.should raise_error(TypeError)
- lambda {
+ -> {
Matrix::LUPDecomposition.new(42)
}.should raise_error(TypeError)
end
diff --git a/spec/ruby/library/matrix/lup_decomposition/solve_spec.rb b/spec/ruby/library/matrix/lup_decomposition/solve_spec.rb
index 43d49de9c7..66242627e9 100644
--- a/spec/ruby/library/matrix/lup_decomposition/solve_spec.rb
+++ b/spec/ruby/library/matrix/lup_decomposition/solve_spec.rb
@@ -6,7 +6,7 @@ describe "Matrix::LUPDecomposition#solve" do
it "raises an error for singular matrices" do
a = Matrix[[1, 2, 3], [1, 3, 5], [2, 5, 8]]
lu = Matrix::LUPDecomposition.new(a)
- lambda {
+ -> {
lu.solve(a)
}.should raise_error(Matrix::ErrNotRegular)
end
@@ -31,7 +31,7 @@ describe "Matrix::LUPDecomposition#solve" do
it "raises an error when given a matrix of the wrong size" do
values = Matrix[[1, 2, 3, 4], [0, 1, 2, 3]]
- lambda {
+ -> {
@lu.solve(values)
}.should raise_error(Matrix::ErrDimensionMismatch)
end
@@ -44,7 +44,7 @@ describe "Matrix::LUPDecomposition#solve" do
it "raises an error when given a vector of the wrong size" do
values = Vector[14, 55]
- lambda {
+ -> {
@lu.solve(values)
}.should raise_error(Matrix::ErrDimensionMismatch)
end
diff --git a/spec/ruby/library/matrix/minus_spec.rb b/spec/ruby/library/matrix/minus_spec.rb
index 25191893a6..95cf4a6072 100644
--- a/spec/ruby/library/matrix/minus_spec.rb
+++ b/spec/ruby/library/matrix/minus_spec.rb
@@ -17,20 +17,20 @@ describe "Matrix#-" do
end
it "raises a Matrix::ErrDimensionMismatch if the matrices are different sizes" do
- lambda { @a - Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch)
+ -> { @a - Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch)
end
it "raises a ExceptionForMatrix::ErrOperationNotDefined if other is a Numeric Type" do
- lambda { @a - 2 }.should raise_error(Matrix::ErrOperationNotDefined)
- lambda { @a - 1.2 }.should raise_error(Matrix::ErrOperationNotDefined)
- lambda { @a - bignum_value }.should raise_error(Matrix::ErrOperationNotDefined)
+ -> { @a - 2 }.should raise_error(Matrix::ErrOperationNotDefined)
+ -> { @a - 1.2 }.should raise_error(Matrix::ErrOperationNotDefined)
+ -> { @a - bignum_value }.should raise_error(Matrix::ErrOperationNotDefined)
end
it "raises a TypeError if other is of wrong type" do
- lambda { @a - nil }.should raise_error(TypeError)
- lambda { @a - "a" }.should raise_error(TypeError)
- lambda { @a - [ [1, 2] ] }.should raise_error(TypeError)
- lambda { @a - Object.new }.should raise_error(TypeError)
+ -> { @a - nil }.should raise_error(TypeError)
+ -> { @a - "a" }.should raise_error(TypeError)
+ -> { @a - [ [1, 2] ] }.should raise_error(TypeError)
+ -> { @a - Object.new }.should raise_error(TypeError)
end
describe "for a subclass of Matrix" do
diff --git a/spec/ruby/library/matrix/multiply_spec.rb b/spec/ruby/library/matrix/multiply_spec.rb
index 9b401a4dad..585f268931 100644
--- a/spec/ruby/library/matrix/multiply_spec.rb
+++ b/spec/ruby/library/matrix/multiply_spec.rb
@@ -32,7 +32,7 @@ describe "Matrix#*" do
end
it "raises a Matrix::ErrDimensionMismatch if the matrices are different sizes" do
- lambda { @a * Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch)
+ -> { @a * Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch)
end
it "returns a zero matrix if (nx0) * (0xn)" do
@@ -52,10 +52,10 @@ describe "Matrix#*" do
end
it "raises a TypeError if other is of wrong type" do
- lambda { @a * nil }.should raise_error(TypeError)
- lambda { @a * "a" }.should raise_error(TypeError)
- lambda { @a * [ [1, 2] ] }.should raise_error(TypeError)
- lambda { @a * Object.new }.should raise_error(TypeError)
+ -> { @a * nil }.should raise_error(TypeError)
+ -> { @a * "a" }.should raise_error(TypeError)
+ -> { @a * [ [1, 2] ] }.should raise_error(TypeError)
+ -> { @a * Object.new }.should raise_error(TypeError)
end
describe "for a subclass of Matrix" do
diff --git a/spec/ruby/library/matrix/normal_spec.rb b/spec/ruby/library/matrix/normal_spec.rb
index 437a3c82c9..ebd73aaf40 100644
--- a/spec/ruby/library/matrix/normal_spec.rb
+++ b/spec/ruby/library/matrix/normal_spec.rb
@@ -18,7 +18,7 @@ describe "Matrix.normal?" do
Matrix.empty(0, 2),
Matrix.empty(2, 0),
].each do |rectangular_matrix|
- lambda {
+ -> {
rectangular_matrix.normal?
}.should raise_error(Matrix::ErrDimensionMismatch)
end
diff --git a/spec/ruby/library/matrix/orthogonal_spec.rb b/spec/ruby/library/matrix/orthogonal_spec.rb
index 81df1d15ee..07b098a58d 100644
--- a/spec/ruby/library/matrix/orthogonal_spec.rb
+++ b/spec/ruby/library/matrix/orthogonal_spec.rb
@@ -18,7 +18,7 @@ describe "Matrix.orthogonal?" do
Matrix.empty(0, 2),
Matrix.empty(2, 0),
].each do |rectangular_matrix|
- lambda {
+ -> {
rectangular_matrix.orthogonal?
}.should raise_error(Matrix::ErrDimensionMismatch)
end
diff --git a/spec/ruby/library/matrix/permutation_spec.rb b/spec/ruby/library/matrix/permutation_spec.rb
index f6666588de..825a9d982c 100644
--- a/spec/ruby/library/matrix/permutation_spec.rb
+++ b/spec/ruby/library/matrix/permutation_spec.rb
@@ -24,7 +24,7 @@ describe "Matrix#permutation?" do
Matrix.empty(0, 2),
Matrix.empty(2, 0),
].each do |rectangular_matrix|
- lambda {
+ -> {
rectangular_matrix.permutation?
}.should raise_error(Matrix::ErrDimensionMismatch)
end
diff --git a/spec/ruby/library/matrix/plus_spec.rb b/spec/ruby/library/matrix/plus_spec.rb
index cad04f80a3..2706bad060 100644
--- a/spec/ruby/library/matrix/plus_spec.rb
+++ b/spec/ruby/library/matrix/plus_spec.rb
@@ -17,20 +17,20 @@ describe "Matrix#+" do
end
it "raises a Matrix::ErrDimensionMismatch if the matrices are different sizes" do
- lambda { @a + Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch)
+ -> { @a + Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch)
end
it "raises a ExceptionForMatrix::ErrOperationNotDefined if other is a Numeric Type" do
- lambda { @a + 2 }.should raise_error(ExceptionForMatrix::ErrOperationNotDefined)
- lambda { @a + 1.2 }.should raise_error(ExceptionForMatrix::ErrOperationNotDefined)
- lambda { @a + bignum_value }.should raise_error(ExceptionForMatrix::ErrOperationNotDefined)
+ -> { @a + 2 }.should raise_error(ExceptionForMatrix::ErrOperationNotDefined)
+ -> { @a + 1.2 }.should raise_error(ExceptionForMatrix::ErrOperationNotDefined)
+ -> { @a + bignum_value }.should raise_error(ExceptionForMatrix::ErrOperationNotDefined)
end
it "raises a TypeError if other is of wrong type" do
- lambda { @a + nil }.should raise_error(TypeError)
- lambda { @a + "a" }.should raise_error(TypeError)
- lambda { @a + [ [1, 2] ] }.should raise_error(TypeError)
- lambda { @a + Object.new }.should raise_error(TypeError)
+ -> { @a + nil }.should raise_error(TypeError)
+ -> { @a + "a" }.should raise_error(TypeError)
+ -> { @a + [ [1, 2] ] }.should raise_error(TypeError)
+ -> { @a + Object.new }.should raise_error(TypeError)
end
describe "for a subclass of Matrix" do
diff --git a/spec/ruby/library/matrix/regular_spec.rb b/spec/ruby/library/matrix/regular_spec.rb
index 5dd4484ce4..3699d0ef8b 100644
--- a/spec/ruby/library/matrix/regular_spec.rb
+++ b/spec/ruby/library/matrix/regular_spec.rb
@@ -20,11 +20,11 @@ describe "Matrix#regular?" do
end
it "raises an error for rectangular matrices" do
- lambda {
+ -> {
Matrix[[1], [2], [3]].regular?
}.should raise_error(Matrix::ErrDimensionMismatch)
- lambda {
+ -> {
Matrix.empty(3,0).regular?
}.should raise_error(Matrix::ErrDimensionMismatch)
end
diff --git a/spec/ruby/library/matrix/row_spec.rb b/spec/ruby/library/matrix/row_spec.rb
index 1cf2c6ae2c..00b1f02a8e 100644
--- a/spec/ruby/library/matrix/row_spec.rb
+++ b/spec/ruby/library/matrix/row_spec.rb
@@ -30,7 +30,7 @@ describe "Matrix#row" do
end
it "never yields when out of bounds" do
- lambda { @m.row(3){ raise } }.should_not raise_error
- lambda { @m.row(-4){ raise } }.should_not raise_error
+ -> { @m.row(3){ raise } }.should_not raise_error
+ -> { @m.row(-4){ raise } }.should_not raise_error
end
end
diff --git a/spec/ruby/library/matrix/shared/determinant.rb b/spec/ruby/library/matrix/shared/determinant.rb
index 47a58c62a6..9e0528c24b 100644
--- a/spec/ruby/library/matrix/shared/determinant.rb
+++ b/spec/ruby/library/matrix/shared/determinant.rb
@@ -27,11 +27,11 @@ describe :determinant, shared: true do
end
it "raises an error for rectangular matrices" do
- lambda {
+ -> {
Matrix[[1], [2], [3]].send(@method)
}.should raise_error(Matrix::ErrDimensionMismatch)
- lambda {
+ -> {
Matrix.empty(3,0).send(@method)
}.should raise_error(Matrix::ErrDimensionMismatch)
end
diff --git a/spec/ruby/library/matrix/shared/inverse.rb b/spec/ruby/library/matrix/shared/inverse.rb
index e1e5ae5758..c8a6b90da5 100644
--- a/spec/ruby/library/matrix/shared/inverse.rb
+++ b/spec/ruby/library/matrix/shared/inverse.rb
@@ -25,7 +25,7 @@ describe :inverse, shared: true do
end
it "raises a ErrDimensionMismatch if the Matrix is not square" do
- lambda{
+ ->{
Matrix[ [1,2,3], [1,2,3] ].send(@method)
}.should raise_error(Matrix::ErrDimensionMismatch)
end
diff --git a/spec/ruby/library/matrix/shared/trace.rb b/spec/ruby/library/matrix/shared/trace.rb
index 2a42839f5d..57b89863f8 100644
--- a/spec/ruby/library/matrix/shared/trace.rb
+++ b/spec/ruby/library/matrix/shared/trace.rb
@@ -6,7 +6,7 @@ describe :trace, shared: true do
end
it "returns the sum of diagonal elements in a rectangular Matrix" do
- lambda{ Matrix[[1,2,3], [4,5,6]].trace}.should raise_error(Matrix::ErrDimensionMismatch)
+ ->{ Matrix[[1,2,3], [4,5,6]].trace}.should raise_error(Matrix::ErrDimensionMismatch)
end
end
diff --git a/spec/ruby/library/matrix/singular_spec.rb b/spec/ruby/library/matrix/singular_spec.rb
index 362f4cbb35..7bba36a54a 100644
--- a/spec/ruby/library/matrix/singular_spec.rb
+++ b/spec/ruby/library/matrix/singular_spec.rb
@@ -19,11 +19,11 @@ describe "Matrix#singular?" do
end
it "raises an error for rectangular matrices" do
- lambda {
+ -> {
Matrix[[1], [2], [3]].singular?
}.should raise_error(Matrix::ErrDimensionMismatch)
- lambda {
+ -> {
Matrix.empty(3,0).singular?
}.should raise_error(Matrix::ErrDimensionMismatch)
end
diff --git a/spec/ruby/library/matrix/symmetric_spec.rb b/spec/ruby/library/matrix/symmetric_spec.rb
index 7b7bce29fc..6f2a99276a 100644
--- a/spec/ruby/library/matrix/symmetric_spec.rb
+++ b/spec/ruby/library/matrix/symmetric_spec.rb
@@ -21,7 +21,7 @@ describe "Matrix.symmetric?" do
Matrix.empty(0, 2),
Matrix.empty(2, 0),
].each do |rectangular_matrix|
- lambda {
+ -> {
rectangular_matrix.symmetric?
}.should raise_error(Matrix::ErrDimensionMismatch)
end
diff --git a/spec/ruby/library/matrix/unitary_spec.rb b/spec/ruby/library/matrix/unitary_spec.rb
index 921ea3dda3..9c2a106ea5 100644
--- a/spec/ruby/library/matrix/unitary_spec.rb
+++ b/spec/ruby/library/matrix/unitary_spec.rb
@@ -20,7 +20,7 @@ describe "Matrix.unitary?" do
Matrix.empty(0, 2),
Matrix.empty(2, 0),
].each do |rectangular_matrix|
- lambda {
+ -> {
rectangular_matrix.unitary?
}.should raise_error(Matrix::ErrDimensionMismatch)
end
diff --git a/spec/ruby/library/matrix/vector/cross_product_spec.rb b/spec/ruby/library/matrix/vector/cross_product_spec.rb
index 5194782edd..c2698ade4c 100644
--- a/spec/ruby/library/matrix/vector/cross_product_spec.rb
+++ b/spec/ruby/library/matrix/vector/cross_product_spec.rb
@@ -7,7 +7,7 @@ describe "Vector#cross_product" do
end
it "raises an error unless both vectors have dimension 3" do
- lambda {
+ -> {
Vector[1, 2, 3].cross_product(Vector[0, -4])
}.should raise_error(Vector::ErrDimensionMismatch)
end
diff --git a/spec/ruby/library/matrix/vector/each2_spec.rb b/spec/ruby/library/matrix/vector/each2_spec.rb
index 844b903336..10d2fc404d 100644
--- a/spec/ruby/library/matrix/vector/each2_spec.rb
+++ b/spec/ruby/library/matrix/vector/each2_spec.rb
@@ -8,8 +8,8 @@ describe "Vector.each2" do
end
it "requires one argument" do
- lambda { @v.each2(@v2, @v2){} }.should raise_error(ArgumentError)
- lambda { @v.each2(){} }.should raise_error(ArgumentError)
+ -> { @v.each2(@v2, @v2){} }.should raise_error(ArgumentError)
+ -> { @v.each2(){} }.should raise_error(ArgumentError)
end
describe "given one argument" do
@@ -20,8 +20,8 @@ describe "Vector.each2" do
end
it "raises a DimensionMismatch error if the Vector size is different" do
- lambda { @v.each2(Vector[1,2]){} }.should raise_error(Vector::ErrDimensionMismatch)
- lambda { @v.each2(Vector[1,2,3,4]){} }.should raise_error(Vector::ErrDimensionMismatch)
+ -> { @v.each2(Vector[1,2]){} }.should raise_error(Vector::ErrDimensionMismatch)
+ -> { @v.each2(Vector[1,2,3,4]){} }.should raise_error(Vector::ErrDimensionMismatch)
end
it "yields arguments in sequence" do
diff --git a/spec/ruby/library/matrix/vector/inner_product_spec.rb b/spec/ruby/library/matrix/vector/inner_product_spec.rb
index 584226c450..1cf8771e04 100644
--- a/spec/ruby/library/matrix/vector/inner_product_spec.rb
+++ b/spec/ruby/library/matrix/vector/inner_product_spec.rb
@@ -11,7 +11,7 @@ describe "Vector#inner_product" do
end
it "raises an error for mismatched vectors" do
- lambda {
+ -> {
Vector[1, 2, 3].inner_product(Vector[0, -4])
}.should raise_error(Vector::ErrDimensionMismatch)
end
diff --git a/spec/ruby/library/matrix/vector/normalize_spec.rb b/spec/ruby/library/matrix/vector/normalize_spec.rb
index 4ff9597c82..527c9260de 100644
--- a/spec/ruby/library/matrix/vector/normalize_spec.rb
+++ b/spec/ruby/library/matrix/vector/normalize_spec.rb
@@ -8,10 +8,10 @@ describe "Vector#normalize" do
end
it "raises an error for zero vectors" do
- lambda {
+ -> {
Vector[].normalize
}.should raise_error(Vector::ZeroVectorError)
- lambda {
+ -> {
Vector[0, 0, 0].normalize
}.should raise_error(Vector::ZeroVectorError)
end
diff --git a/spec/ruby/library/net/ftp/abort_spec.rb b/spec/ruby/library/net/ftp/abort_spec.rb
index ff2144a3a0..57651468d8 100644
--- a/spec/ruby/library/net/ftp/abort_spec.rb
+++ b/spec/ruby/library/net/ftp/abort_spec.rb
@@ -18,7 +18,7 @@ describe "Net::FTP#abort" do
end
it "sends the ABOR command to the server" do
- lambda { @ftp.abort }.should_not raise_error
+ -> { @ftp.abort }.should_not raise_error
end
it "ignores the response" do
@@ -32,31 +32,31 @@ describe "Net::FTP#abort" do
it "does not raise any error when the response code is 225" do
@server.should_receive(:abor).and_respond("225 Data connection open; no transfer in progress.")
- lambda { @ftp.abort }.should_not raise_error
+ -> { @ftp.abort }.should_not raise_error
end
it "does not raise any error when the response code is 226" do
@server.should_receive(:abor).and_respond("226 Closing data connection.")
- lambda { @ftp.abort }.should_not raise_error
+ -> { @ftp.abort }.should_not raise_error
end
it "raises a Net::FTPProtoError when the response code is 500" do
@server.should_receive(:abor).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.abort }.should raise_error(Net::FTPProtoError)
+ -> { @ftp.abort }.should raise_error(Net::FTPProtoError)
end
it "raises a Net::FTPProtoError when the response code is 501" do
@server.should_receive(:abor).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.abort }.should raise_error(Net::FTPProtoError)
+ -> { @ftp.abort }.should raise_error(Net::FTPProtoError)
end
it "raises a Net::FTPProtoError when the response code is 502" do
@server.should_receive(:abor).and_respond("502 Command not implemented.")
- lambda { @ftp.abort }.should raise_error(Net::FTPProtoError)
+ -> { @ftp.abort }.should raise_error(Net::FTPProtoError)
end
it "raises a Net::FTPProtoError when the response code is 421" do
@server.should_receive(:abor).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.abort }.should raise_error(Net::FTPProtoError)
+ -> { @ftp.abort }.should raise_error(Net::FTPProtoError)
end
end
diff --git a/spec/ruby/library/net/ftp/acct_spec.rb b/spec/ruby/library/net/ftp/acct_spec.rb
index 3db51fca0f..d8068dc81e 100644
--- a/spec/ruby/library/net/ftp/acct_spec.rb
+++ b/spec/ruby/library/net/ftp/acct_spec.rb
@@ -28,31 +28,31 @@ describe "Net::FTP#acct" do
it "does not raise any error when the response code is 230" do
@server.should_receive(:acct).and_respond("230 User logged in, proceed.")
- lambda { @ftp.acct("my_account") }.should_not raise_error
+ -> { @ftp.acct("my_account") }.should_not raise_error
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:acct).and_respond("530 Not logged in.")
- lambda { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:acct).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:acct).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 503" do
@server.should_receive(:acct).and_respond("503 Bad sequence of commands.")
- lambda { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:acct).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.acct("my_account") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.acct("my_account") }.should raise_error(Net::FTPTempError)
end
end
diff --git a/spec/ruby/library/net/ftp/chdir_spec.rb b/spec/ruby/library/net/ftp/chdir_spec.rb
index 1f558c47e8..4c10fa78b4 100644
--- a/spec/ruby/library/net/ftp/chdir_spec.rb
+++ b/spec/ruby/library/net/ftp/chdir_spec.rb
@@ -29,32 +29,32 @@ describe "Net::FTP#chdir" do
it "does not raise a Net::FTPPermError when the response code is 500" do
@server.should_receive(:cdup).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.chdir("..") }.should_not raise_error(Net::FTPPermError)
+ -> { @ftp.chdir("..") }.should_not raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:cdup).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.chdir("..") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.chdir("..") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:cdup).and_respond("502 Command not implemented.")
- lambda { @ftp.chdir("..") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.chdir("..") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:cdup).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.chdir("..") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.chdir("..") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:cdup).and_respond("530 Not logged in.")
- lambda { @ftp.chdir("..") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.chdir("..") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 550" do
@server.should_receive(:cdup).and_respond("550 Requested action not taken.")
- lambda { @ftp.chdir("..") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.chdir("..") }.should raise_error(Net::FTPPermError)
end
end
@@ -69,31 +69,31 @@ describe "Net::FTP#chdir" do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:cwd).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.chdir("test") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.chdir("test") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:cwd).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.chdir("test") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.chdir("test") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:cwd).and_respond("502 Command not implemented.")
- lambda { @ftp.chdir("test") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.chdir("test") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:cwd).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.chdir("test") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.chdir("test") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:cwd).and_respond("530 Not logged in.")
- lambda { @ftp.chdir("test") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.chdir("test") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 550" do
@server.should_receive(:cwd).and_respond("550 Requested action not taken.")
- lambda { @ftp.chdir("test") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.chdir("test") }.should raise_error(Net::FTPPermError)
end
end
diff --git a/spec/ruby/library/net/ftp/connect_spec.rb b/spec/ruby/library/net/ftp/connect_spec.rb
index 981751233e..9ee9bcd2c6 100644
--- a/spec/ruby/library/net/ftp/connect_spec.rb
+++ b/spec/ruby/library/net/ftp/connect_spec.rb
@@ -19,7 +19,7 @@ describe "Net::FTP#connect" do
end
it "tries to connect to the FTP Server on the given host and port" do
- lambda { @ftp.connect(@server.hostname, @server.server_port) }.should_not raise_error
+ -> { @ftp.connect(@server.hostname, @server.server_port) }.should_not raise_error
end
it "returns nil" do
@@ -28,22 +28,22 @@ describe "Net::FTP#connect" do
it "prints a small debug line when in debug mode" do
@ftp.debug_mode = true
- lambda { @ftp.connect(@server.hostname, @server.server_port) }.should output(/#{"connect: "}#{@server.hostname}#{", "}#{@server.server_port}#{"\\nget: 220 Dummy FTP Server ready!"}/)
+ -> { @ftp.connect(@server.hostname, @server.server_port) }.should output(/#{"connect: "}#{@server.hostname}#{", "}#{@server.server_port}#{"\\nget: 220 Dummy FTP Server ready!"}/)
@ftp.debug_mode = false
end
it "does not raise any error when the response code is 220" do
@server.connect_message = "220 Dummy FTP Server ready!"
- lambda { @ftp.connect(@server.hostname, @server.server_port) }.should_not raise_error
+ -> { @ftp.connect(@server.hostname, @server.server_port) }.should_not raise_error
end
it "raises a Net::FTPReplyError when the response code is 120" do
@server.connect_message = "120 Service ready in nnn minutes."
- lambda { @ftp.connect(@server.hostname, @server.server_port) }.should raise_error(Net::FTPReplyError)
+ -> { @ftp.connect(@server.hostname, @server.server_port) }.should raise_error(Net::FTPReplyError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.connect_message = "421 Service not available, closing control connection."
- lambda { @ftp.connect(@server.hostname, @server.server_port) }.should raise_error(Net::FTPTempError)
+ -> { @ftp.connect(@server.hostname, @server.server_port) }.should raise_error(Net::FTPTempError)
end
end
diff --git a/spec/ruby/library/net/ftp/delete_spec.rb b/spec/ruby/library/net/ftp/delete_spec.rb
index fa0eddb312..cf8f9332e2 100644
--- a/spec/ruby/library/net/ftp/delete_spec.rb
+++ b/spec/ruby/library/net/ftp/delete_spec.rb
@@ -24,36 +24,36 @@ describe "Net::FTP#delete" do
it "raises a Net::FTPTempError when the response code is 450" do
@server.should_receive(:dele).and_respond("450 Requested file action not taken.")
- lambda { @ftp.delete("test.file") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.delete("test.file") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 550" do
@server.should_receive(:dele).and_respond("550 Requested action not taken.")
- lambda { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:dele).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:dele).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:dele).and_respond("502 Command not implemented.")
- lambda { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:dele).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.delete("test.file") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.delete("test.file") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:dele).and_respond("530 Not logged in.")
- lambda { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError)
end
end
diff --git a/spec/ruby/library/net/ftp/fixtures/server.rb b/spec/ruby/library/net/ftp/fixtures/server.rb
index 65339cfaf9..d4795a5c58 100644
--- a/spec/ruby/library/net/ftp/fixtures/server.rb
+++ b/spec/ruby/library/net/ftp/fixtures/server.rb
@@ -86,7 +86,7 @@ module NetFTPSpecs
end
def and_respond(text)
- @handlers[@handler_for] = lambda { |s, *args| s.response(text) }
+ @handlers[@handler_for] = -> s, *args { s.response(text) }
end
##
diff --git a/spec/ruby/library/net/ftp/help_spec.rb b/spec/ruby/library/net/ftp/help_spec.rb
index c7a089a588..d2e9fe7ee8 100644
--- a/spec/ruby/library/net/ftp/help_spec.rb
+++ b/spec/ruby/library/net/ftp/help_spec.rb
@@ -36,31 +36,31 @@ describe "Net::FTP#help" do
it "does not raise any error when the response code is 211" do
@server.should_receive(:help).and_respond("211 System status, or system help reply.")
- lambda { @ftp.help }.should_not raise_error
+ -> { @ftp.help }.should_not raise_error
end
it "does not raise any error when the response code is 214" do
@server.should_receive(:help).and_respond("214 Help message.")
- lambda { @ftp.help }.should_not raise_error
+ -> { @ftp.help }.should_not raise_error
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:help).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.help }.should raise_error(Net::FTPPermError)
+ -> { @ftp.help }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:help).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.help }.should raise_error(Net::FTPPermError)
+ -> { @ftp.help }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:help).and_respond("502 Command not implemented.")
- lambda { @ftp.help }.should raise_error(Net::FTPPermError)
+ -> { @ftp.help }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:help).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.help }.should raise_error(Net::FTPTempError)
+ -> { @ftp.help }.should raise_error(Net::FTPTempError)
end
end
diff --git a/spec/ruby/library/net/ftp/login_spec.rb b/spec/ruby/library/net/ftp/login_spec.rb
index c4f14f8747..46736851ee 100644
--- a/spec/ruby/library/net/ftp/login_spec.rb
+++ b/spec/ruby/library/net/ftp/login_spec.rb
@@ -32,7 +32,7 @@ describe "Net::FTP#login" do
it "raises a Net::FTPReplyError when the server requests an account" do
@server.should_receive(:user).and_respond("331 User name okay, need password.")
@server.should_receive(:pass).and_respond("332 Need account for login.")
- lambda { @ftp.login }.should raise_error(Net::FTPReplyError)
+ -> { @ftp.login }.should raise_error(Net::FTPReplyError)
end
end
@@ -44,13 +44,13 @@ describe "Net::FTP#login" do
it "raises a Net::FTPReplyError when the server requests a password, but none was given" do
@server.should_receive(:user).and_respond("331 User name okay, need password.")
- lambda { @ftp.login("rubyspec") }.should raise_error(Net::FTPReplyError)
+ -> { @ftp.login("rubyspec") }.should raise_error(Net::FTPReplyError)
end
it "raises a Net::FTPReplyError when the server requests an account, but none was given" do
@server.should_receive(:user).and_respond("331 User name okay, need password.")
@server.should_receive(:pass).and_respond("332 Need account for login.")
- lambda { @ftp.login("rubyspec") }.should raise_error(Net::FTPReplyError)
+ -> { @ftp.login("rubyspec") }.should raise_error(Net::FTPReplyError)
end
end
@@ -69,7 +69,7 @@ describe "Net::FTP#login" do
it "raises a Net::FTPReplyError when the server requests an account" do
@server.should_receive(:user).and_respond("331 User name okay, need password.")
@server.should_receive(:pass).and_respond("332 Need account for login.")
- lambda { @ftp.login("rubyspec", "rocks") }.should raise_error(Net::FTPReplyError)
+ -> { @ftp.login("rubyspec", "rocks") }.should raise_error(Net::FTPReplyError)
end
end
@@ -96,27 +96,27 @@ describe "Net::FTP#login" do
describe "when the USER command fails" do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:user).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:user).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:user).and_respond("502 Command not implemented.")
- lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:user).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:user).and_respond("530 Not logged in.")
- lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
end
@@ -127,32 +127,32 @@ describe "Net::FTP#login" do
it "does not raise an Error when the response code is 202" do
@server.should_receive(:pass).and_respond("202 Command not implemented, superfluous at this site.")
- lambda { @ftp.login("rubyspec", "rocks", "account") }.should_not raise_error
+ -> { @ftp.login("rubyspec", "rocks", "account") }.should_not raise_error
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:pass).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:pass).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:pass).and_respond("502 Command not implemented.")
- lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:pass).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:pass).and_respond("530 Not logged in.")
- lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
end
@@ -164,32 +164,32 @@ describe "Net::FTP#login" do
it "does not raise an Error when the response code is 202" do
@server.should_receive(:acct).and_respond("202 Command not implemented, superfluous at this site.")
- lambda { @ftp.login("rubyspec", "rocks", "account") }.should_not raise_error
+ -> { @ftp.login("rubyspec", "rocks", "account") }.should_not raise_error
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:acct).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:acct).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:acct).and_respond("502 Command not implemented.")
- lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:acct).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:acct).and_respond("530 Not logged in.")
- lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
end
end
diff --git a/spec/ruby/library/net/ftp/mdtm_spec.rb b/spec/ruby/library/net/ftp/mdtm_spec.rb
index ddcc06d708..b74cf8d3c7 100644
--- a/spec/ruby/library/net/ftp/mdtm_spec.rb
+++ b/spec/ruby/library/net/ftp/mdtm_spec.rb
@@ -28,11 +28,11 @@ describe "Net::FTP#mdtm" do
it "raises a Net::FTPPermError when the response code is 550" do
@server.should_receive(:mdtm).and_respond("550 Requested action not taken.")
- lambda { @ftp.mdtm("test.file") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.mdtm("test.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:mdtm).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.mdtm("test.file") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.mdtm("test.file") }.should raise_error(Net::FTPTempError)
end
end
diff --git a/spec/ruby/library/net/ftp/mkdir_spec.rb b/spec/ruby/library/net/ftp/mkdir_spec.rb
index 0d8314bfa3..7dc45b5711 100644
--- a/spec/ruby/library/net/ftp/mkdir_spec.rb
+++ b/spec/ruby/library/net/ftp/mkdir_spec.rb
@@ -31,31 +31,31 @@ describe "Net::FTP#mkdir" do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:mkd).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:mkd).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:mkd).and_respond("502 Command not implemented.")
- lambda { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:mkd).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:mkd).and_respond("530 Not logged in.")
- lambda { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 550" do
@server.should_receive(:mkd).and_respond("550 Requested action not taken.")
- lambda { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError)
end
end
diff --git a/spec/ruby/library/net/ftp/mtime_spec.rb b/spec/ruby/library/net/ftp/mtime_spec.rb
index e05e92f58f..0f6cc1ba20 100644
--- a/spec/ruby/library/net/ftp/mtime_spec.rb
+++ b/spec/ruby/library/net/ftp/mtime_spec.rb
@@ -40,11 +40,11 @@ describe "Net::FTP#mtime" do
it "raises a Net::FTPPermError when the response code is 550" do
@server.should_receive(:mdtm).and_respond("550 Requested action not taken.")
- lambda { @ftp.mtime("test.file") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.mtime("test.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:mdtm).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.mtime("test.file") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.mtime("test.file") }.should raise_error(Net::FTPTempError)
end
end
diff --git a/spec/ruby/library/net/ftp/nlst_spec.rb b/spec/ruby/library/net/ftp/nlst_spec.rb
index 36ca7a6127..34384fb8c4 100644
--- a/spec/ruby/library/net/ftp/nlst_spec.rb
+++ b/spec/ruby/library/net/ftp/nlst_spec.rb
@@ -35,32 +35,32 @@ describe "Net::FTP#nlst" do
describe "when the NLST command fails" do
it "raises a Net::FTPTempError when the response code is 450" do
@server.should_receive(:nlst).and_respond("450 Requested file action not taken..")
- lambda { @ftp.nlst }.should raise_error(Net::FTPTempError)
+ -> { @ftp.nlst }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:nlst).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.nlst }.should raise_error(Net::FTPPermError)
+ -> { @ftp.nlst }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:nlst).and_respond("501 Syntax error, command unrecognized.")
- lambda { @ftp.nlst }.should raise_error(Net::FTPPermError)
+ -> { @ftp.nlst }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:nlst).and_respond("502 Command not implemented.")
- lambda { @ftp.nlst }.should raise_error(Net::FTPPermError)
+ -> { @ftp.nlst }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:nlst).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.nlst }.should raise_error(Net::FTPTempError)
+ -> { @ftp.nlst }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:nlst).and_respond("530 Not logged in.")
- lambda { @ftp.nlst }.should raise_error(Net::FTPPermError)
+ -> { @ftp.nlst }.should raise_error(Net::FTPPermError)
end
end
@@ -68,25 +68,25 @@ describe "Net::FTP#nlst" do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:eprt).and_respond("500 Syntax error, command unrecognized.")
@server.should_receive(:port).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.nlst }.should raise_error(Net::FTPPermError)
+ -> { @ftp.nlst }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:eprt).and_respond("501 Syntax error in parameters or arguments.")
@server.should_receive(:port).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.nlst }.should raise_error(Net::FTPPermError)
+ -> { @ftp.nlst }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:eprt).and_respond("421 Service not available, closing control connection.")
@server.should_receive(:port).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.nlst }.should raise_error(Net::FTPTempError)
+ -> { @ftp.nlst }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:eprt).and_respond("530 Not logged in.")
@server.should_receive(:port).and_respond("530 Not logged in.")
- lambda { @ftp.nlst }.should raise_error(Net::FTPPermError)
+ -> { @ftp.nlst }.should raise_error(Net::FTPPermError)
end
end
end
diff --git a/spec/ruby/library/net/ftp/noop_spec.rb b/spec/ruby/library/net/ftp/noop_spec.rb
index eca8911b7b..070750ced7 100644
--- a/spec/ruby/library/net/ftp/noop_spec.rb
+++ b/spec/ruby/library/net/ftp/noop_spec.rb
@@ -28,11 +28,11 @@ describe "Net::FTP#noop" do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:noop).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.noop }.should raise_error(Net::FTPPermError)
+ -> { @ftp.noop }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:noop).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.noop }.should raise_error(Net::FTPTempError)
+ -> { @ftp.noop }.should raise_error(Net::FTPTempError)
end
end
diff --git a/spec/ruby/library/net/ftp/pwd_spec.rb b/spec/ruby/library/net/ftp/pwd_spec.rb
index f515cd29a0..a3998cc730 100644
--- a/spec/ruby/library/net/ftp/pwd_spec.rb
+++ b/spec/ruby/library/net/ftp/pwd_spec.rb
@@ -28,26 +28,26 @@ describe "Net::FTP#pwd" do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:pwd).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.pwd }.should raise_error(Net::FTPPermError)
+ -> { @ftp.pwd }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:pwd).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.pwd }.should raise_error(Net::FTPPermError)
+ -> { @ftp.pwd }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:pwd).and_respond("502 Command not implemented.")
- lambda { @ftp.pwd }.should raise_error(Net::FTPPermError)
+ -> { @ftp.pwd }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:pwd).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.pwd }.should raise_error(Net::FTPTempError)
+ -> { @ftp.pwd }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 550" do
@server.should_receive(:pwd).and_respond("550 Requested action not taken.")
- lambda { @ftp.pwd }.should raise_error(Net::FTPPermError)
+ -> { @ftp.pwd }.should raise_error(Net::FTPPermError)
end
end
diff --git a/spec/ruby/library/net/ftp/rename_spec.rb b/spec/ruby/library/net/ftp/rename_spec.rb
index e1fd4e47cf..376b203ac9 100644
--- a/spec/ruby/library/net/ftp/rename_spec.rb
+++ b/spec/ruby/library/net/ftp/rename_spec.rb
@@ -31,64 +31,64 @@ describe "Net::FTP#rename" do
describe "when the RNFR command fails" do
it "raises a Net::FTPTempError when the response code is 450" do
@server.should_receive(:rnfr).and_respond("450 Requested file action not taken.")
- lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 550" do
@server.should_receive(:rnfr).and_respond("550 Requested action not taken.")
- lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:rnfr).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:rnfr).and_respond("502 Command not implemented.")
- lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:rnfr).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:rnfr).and_respond("530 Not logged in.")
- lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
end
end
describe "when the RNTO command fails" do
it "raises a Net::FTPPermError when the response code is 532" do
@server.should_receive(:rnfr).and_respond("532 Need account for storing files.")
- lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 553" do
@server.should_receive(:rnto).and_respond("553 Requested action not taken.")
- lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:rnto).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:rnto).and_respond("502 Command not implemented.")
- lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:rnto).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:rnto).and_respond("530 Not logged in.")
- lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
end
end
end
diff --git a/spec/ruby/library/net/ftp/return_code_spec.rb b/spec/ruby/library/net/ftp/return_code_spec.rb
index 605f66ec6e..e4b98c8031 100644
--- a/spec/ruby/library/net/ftp/return_code_spec.rb
+++ b/spec/ruby/library/net/ftp/return_code_spec.rb
@@ -7,7 +7,7 @@ describe "Net::FTP#return_code" do
end
it "outputs a warning and returns a newline" do
- lambda do
+ -> do
@ftp.return_code.should == "\n"
end.should complain(/warning: Net::FTP#return_code is obsolete and do nothing/)
end
@@ -19,6 +19,6 @@ describe "Net::FTP#return_code=" do
end
it "outputs a warning" do
- lambda { @ftp.return_code = 123 }.should complain(/warning: Net::FTP#return_code= is obsolete and do nothing/)
+ -> { @ftp.return_code = 123 }.should complain(/warning: Net::FTP#return_code= is obsolete and do nothing/)
end
end
diff --git a/spec/ruby/library/net/ftp/rmdir_spec.rb b/spec/ruby/library/net/ftp/rmdir_spec.rb
index ab92a8678b..0515897998 100644
--- a/spec/ruby/library/net/ftp/rmdir_spec.rb
+++ b/spec/ruby/library/net/ftp/rmdir_spec.rb
@@ -28,31 +28,31 @@ describe "Net::FTP#rmdir" do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:rmd).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:rmd).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:rmd).and_respond("502 Command not implemented.")
- lambda { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:rmd).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:rmd).and_respond("530 Not logged in.")
- lambda { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 550" do
@server.should_receive(:rmd).and_respond("550 Requested action not taken.")
- lambda { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError)
end
end
diff --git a/spec/ruby/library/net/ftp/sendcmd_spec.rb b/spec/ruby/library/net/ftp/sendcmd_spec.rb
index 631bc10c84..dafa36e032 100644
--- a/spec/ruby/library/net/ftp/sendcmd_spec.rb
+++ b/spec/ruby/library/net/ftp/sendcmd_spec.rb
@@ -28,27 +28,27 @@ describe "Net::FTP#sendcmd" do
it "raises no error when the response code is 1xx, 2xx or 3xx" do
@server.should_receive(:help).and_respond("120 Service ready in nnn minutes.")
- lambda { @ftp.sendcmd("HELP") }.should_not raise_error
+ -> { @ftp.sendcmd("HELP") }.should_not raise_error
@server.should_receive(:help).and_respond("200 Command okay.")
- lambda { @ftp.sendcmd("HELP") }.should_not raise_error
+ -> { @ftp.sendcmd("HELP") }.should_not raise_error
@server.should_receive(:help).and_respond("350 Requested file action pending further information.")
- lambda { @ftp.sendcmd("HELP") }.should_not raise_error
+ -> { @ftp.sendcmd("HELP") }.should_not raise_error
end
it "raises a Net::FTPTempError when the response code is 4xx" do
@server.should_receive(:help).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.sendcmd("HELP") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.sendcmd("HELP") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 5xx" do
@server.should_receive(:help).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.sendcmd("HELP") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.sendcmd("HELP") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPProtoError when the response code is not between 1xx-5xx" do
@server.should_receive(:help).and_respond("999 Invalid response.")
- lambda { @ftp.sendcmd("HELP") }.should raise_error(Net::FTPProtoError)
+ -> { @ftp.sendcmd("HELP") }.should raise_error(Net::FTPProtoError)
end
end
diff --git a/spec/ruby/library/net/ftp/shared/getbinaryfile.rb b/spec/ruby/library/net/ftp/shared/getbinaryfile.rb
index 2252935b2d..f324f5b85d 100644
--- a/spec/ruby/library/net/ftp/shared/getbinaryfile.rb
+++ b/spec/ruby/library/net/ftp/shared/getbinaryfile.rb
@@ -60,32 +60,32 @@ describe :net_ftp_getbinaryfile, shared: :true do
describe "and the REST command fails" do
it "raises a Net::FTPProtoError when the response code is 550" do
@server.should_receive(:rest).and_respond("Requested action not taken.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPProtoError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPProtoError)
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:rest).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:rest).and_respond("501 Syntax error, command unrecognized.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:rest).and_respond("502 Command not implemented.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:rest).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:rest).and_respond("530 Not logged in.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
end
end
@@ -93,32 +93,32 @@ describe :net_ftp_getbinaryfile, shared: :true do
describe "when the RETR command fails" do
it "raises a Net::FTPTempError when the response code is 450" do
@server.should_receive(:retr).and_respond("450 Requested file action not taken.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPProtoError when the response code is 550" do
@server.should_receive(:retr).and_respond("Requested action not taken.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPProtoError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPProtoError)
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:retr).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:retr).and_respond("501 Syntax error, command unrecognized.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:retr).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:retr).and_respond("530 Not logged in.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
end
@@ -126,25 +126,25 @@ describe :net_ftp_getbinaryfile, shared: :true do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:eprt).and_respond("500 Syntax error, command unrecognized.")
@server.should_receive(:port).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:eprt).and_respond("501 Syntax error in parameters or arguments.")
@server.should_receive(:port).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:eprt).and_respond("421 Service not available, closing control connection.")
@server.should_receive(:port).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:eprt).and_respond("530 Not logged in.")
@server.should_receive(:port).and_respond("530 Not logged in.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
end
end
diff --git a/spec/ruby/library/net/ftp/shared/gettextfile.rb b/spec/ruby/library/net/ftp/shared/gettextfile.rb
index 6219581d12..82bec2a4a7 100644
--- a/spec/ruby/library/net/ftp/shared/gettextfile.rb
+++ b/spec/ruby/library/net/ftp/shared/gettextfile.rb
@@ -43,32 +43,32 @@ describe :net_ftp_gettextfile, shared: :true do
describe "when the RETR command fails" do
it "raises a Net::FTPTempError when the response code is 450" do
@server.should_receive(:retr).and_respond("450 Requested file action not taken.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPProtoError when the response code is 550" do
@server.should_receive(:retr).and_respond("Requested action not taken.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPProtoError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPProtoError)
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:retr).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:retr).and_respond("501 Syntax error, command unrecognized.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:retr).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:retr).and_respond("530 Not logged in.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
end
@@ -76,25 +76,25 @@ describe :net_ftp_gettextfile, shared: :true do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:eprt).and_respond("500 Syntax error, command unrecognized.")
@server.should_receive(:port).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:eprt).and_respond("501 Syntax error in parameters or arguments.")
@server.should_receive(:port).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:eprt).and_respond("421 Service not available, closing control connection.")
@server.should_receive(:port).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:eprt).and_respond("530 Not logged in.")
@server.should_receive(:port).and_respond("530 Not logged in.")
- lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
end
end
diff --git a/spec/ruby/library/net/ftp/shared/list.rb b/spec/ruby/library/net/ftp/shared/list.rb
index 50ca8ad119..adc3fa59c1 100644
--- a/spec/ruby/library/net/ftp/shared/list.rb
+++ b/spec/ruby/library/net/ftp/shared/list.rb
@@ -47,32 +47,32 @@ describe :net_ftp_list, shared: true do
describe "when the LIST command fails" do
it "raises a Net::FTPTempError when the response code is 450" do
@server.should_receive(:list).and_respond("450 Requested file action not taken..")
- lambda { @ftp.send(@method) }.should raise_error(Net::FTPTempError)
+ -> { @ftp.send(@method) }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:list).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:list).and_respond("501 Syntax error, command unrecognized.")
- lambda { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:list).and_respond("502 Command not implemented.")
- lambda { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:list).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.send(@method) }.should raise_error(Net::FTPTempError)
+ -> { @ftp.send(@method) }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:list).and_respond("530 Not logged in.")
- lambda { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
end
end
@@ -80,25 +80,25 @@ describe :net_ftp_list, shared: true do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:eprt).and_respond("500 Syntax error, command unrecognized.")
@server.should_receive(:port).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:eprt).and_respond("501 Syntax error in parameters or arguments.")
@server.should_receive(:port).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:eprt).and_respond("421 Service not available, closing control connection.")
@server.should_receive(:port).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.send(@method) }.should raise_error(Net::FTPTempError)
+ -> { @ftp.send(@method) }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:eprt).and_respond("530 Not logged in.")
@server.should_receive(:port).and_respond("530 Not logged in.")
- lambda { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
end
end
end
diff --git a/spec/ruby/library/net/ftp/shared/putbinaryfile.rb b/spec/ruby/library/net/ftp/shared/putbinaryfile.rb
index 74eaf320ae..1163a1cfea 100644
--- a/spec/ruby/library/net/ftp/shared/putbinaryfile.rb
+++ b/spec/ruby/library/net/ftp/shared/putbinaryfile.rb
@@ -67,32 +67,32 @@ describe :net_ftp_putbinaryfile, shared: :true do
describe "and the APPE command fails" do
it "raises a Net::FTPProtoError when the response code is 550" do
@server.should_receive(:appe).and_respond("Requested action not taken.")
- lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPProtoError)
+ -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPProtoError)
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:appe).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:appe).and_respond("501 Syntax error, command unrecognized.")
- lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:appe).and_respond("502 Command not implemented.")
- lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:appe).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:appe).and_respond("530 Not logged in.")
- lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
end
end
@@ -100,42 +100,42 @@ describe :net_ftp_putbinaryfile, shared: :true do
describe "when the STOR command fails" do
it "raises a Net::FTPPermError when the response code is 532" do
@server.should_receive(:stor).and_respond("532 Need account for storing files.")
- lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 450" do
@server.should_receive(:stor).and_respond("450 Requested file action not taken.")
- lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPTempError when the response code is 452" do
@server.should_receive(:stor).and_respond("452 Requested action not taken.")
- lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 553" do
@server.should_receive(:stor).and_respond("553 Requested action not taken.")
- lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:stor).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:stor).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:stor).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:stor).and_respond("530 Not logged in.")
- lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
end
@@ -143,25 +143,25 @@ describe :net_ftp_putbinaryfile, shared: :true do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:eprt).and_respond("500 Syntax error, command unrecognized.")
@server.should_receive(:port).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:eprt).and_respond("501 Syntax error in parameters or arguments.")
@server.should_receive(:port).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:eprt).and_respond("421 Service not available, closing control connection.")
@server.should_receive(:port).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:eprt).and_respond("530 Not logged in.")
@server.should_receive(:port).and_respond("530 Not logged in.")
- lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
end
end
diff --git a/spec/ruby/library/net/ftp/shared/puttextfile.rb b/spec/ruby/library/net/ftp/shared/puttextfile.rb
index 9bfdc7c41e..50e8de28e6 100644
--- a/spec/ruby/library/net/ftp/shared/puttextfile.rb
+++ b/spec/ruby/library/net/ftp/shared/puttextfile.rb
@@ -53,42 +53,42 @@ describe :net_ftp_puttextfile, shared: true do
describe "when the STOR command fails" do
it "raises a Net::FTPPermError when the response code is 532" do
@server.should_receive(:stor).and_respond("532 Need account for storing files.")
- lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 450" do
@server.should_receive(:stor).and_respond("450 Requested file action not taken.")
- lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPTempError when the response code is 452" do
@server.should_receive(:stor).and_respond("452 Requested action not taken.")
- lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 553" do
@server.should_receive(:stor).and_respond("553 Requested action not taken.")
- lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:stor).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:stor).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:stor).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:stor).and_respond("530 Not logged in.")
- lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
end
end
@@ -96,25 +96,25 @@ describe :net_ftp_puttextfile, shared: true do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:eprt).and_respond("500 Syntax error, command unrecognized.")
@server.should_receive(:port).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:eprt).and_respond("501 Syntax error in parameters or arguments.")
@server.should_receive(:port).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:eprt).and_respond("421 Service not available, closing control connection.")
@server.should_receive(:port).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:eprt).and_respond("530 Not logged in.")
@server.should_receive(:port).and_respond("530 Not logged in.")
- lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
end
end
end
diff --git a/spec/ruby/library/net/ftp/site_spec.rb b/spec/ruby/library/net/ftp/site_spec.rb
index 85aa2609c1..4d6a9b4a0c 100644
--- a/spec/ruby/library/net/ftp/site_spec.rb
+++ b/spec/ruby/library/net/ftp/site_spec.rb
@@ -28,26 +28,26 @@ describe "Net::FTP#site" do
it "does not raise an error when the response code is 202" do
@server.should_receive(:site).and_respond("202 Command not implemented, superfluous at this site.")
- lambda { @ftp.site("param") }.should_not raise_error
+ -> { @ftp.site("param") }.should_not raise_error
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:site).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.site("param") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.site("param") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:site).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.site("param") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.site("param") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:site).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.site("param") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.site("param") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:site).and_respond("530 Requested action not taken.")
- lambda { @ftp.site("param") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.site("param") }.should raise_error(Net::FTPPermError)
end
end
diff --git a/spec/ruby/library/net/ftp/size_spec.rb b/spec/ruby/library/net/ftp/size_spec.rb
index eb3ee90d0f..17615079e9 100644
--- a/spec/ruby/library/net/ftp/size_spec.rb
+++ b/spec/ruby/library/net/ftp/size_spec.rb
@@ -28,21 +28,21 @@ describe "Net::FTP#size" do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:size).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.size("test.file") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.size("test.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:size).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.size("test.file") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.size("test.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:size).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.size("test.file") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.size("test.file") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 550" do
@server.should_receive(:size).and_respond("550 Requested action not taken.")
- lambda { @ftp.size("test.file") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.size("test.file") }.should raise_error(Net::FTPPermError)
end
end
diff --git a/spec/ruby/library/net/ftp/status_spec.rb b/spec/ruby/library/net/ftp/status_spec.rb
index c3874ea41e..6e3840bf93 100644
--- a/spec/ruby/library/net/ftp/status_spec.rb
+++ b/spec/ruby/library/net/ftp/status_spec.rb
@@ -32,36 +32,36 @@ describe "Net::FTP#status" do
it "does not raise an error when the response code is 212" do
@server.should_receive(:stat).and_respond("212 Directory status.")
- lambda { @ftp.status }.should_not raise_error
+ -> { @ftp.status }.should_not raise_error
end
it "does not raise an error when the response code is 213" do
@server.should_receive(:stat).and_respond("213 File status.")
- lambda { @ftp.status }.should_not raise_error
+ -> { @ftp.status }.should_not raise_error
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:stat).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.status }.should raise_error(Net::FTPPermError)
+ -> { @ftp.status }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:stat).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.status }.should raise_error(Net::FTPPermError)
+ -> { @ftp.status }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:stat).and_respond("502 Command not implemented.")
- lambda { @ftp.status }.should raise_error(Net::FTPPermError)
+ -> { @ftp.status }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:stat).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.status }.should raise_error(Net::FTPTempError)
+ -> { @ftp.status }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:stat).and_respond("530 Requested action not taken.")
- lambda { @ftp.status }.should raise_error(Net::FTPPermError)
+ -> { @ftp.status }.should raise_error(Net::FTPPermError)
end
end
diff --git a/spec/ruby/library/net/ftp/system_spec.rb b/spec/ruby/library/net/ftp/system_spec.rb
index 73a5ddc72f..749258622d 100644
--- a/spec/ruby/library/net/ftp/system_spec.rb
+++ b/spec/ruby/library/net/ftp/system_spec.rb
@@ -28,21 +28,21 @@ describe "Net::FTP#system" do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:syst).and_respond("500 Syntax error, command unrecognized.")
- lambda { @ftp.system }.should raise_error(Net::FTPPermError)
+ -> { @ftp.system }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:syst).and_respond("501 Syntax error in parameters or arguments.")
- lambda { @ftp.system }.should raise_error(Net::FTPPermError)
+ -> { @ftp.system }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:syst).and_respond("502 Command not implemented.")
- lambda { @ftp.system }.should raise_error(Net::FTPPermError)
+ -> { @ftp.system }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:syst).and_respond("421 Service not available, closing control connection.")
- lambda { @ftp.system }.should raise_error(Net::FTPTempError)
+ -> { @ftp.system }.should raise_error(Net::FTPTempError)
end
end
diff --git a/spec/ruby/library/net/ftp/voidcmd_spec.rb b/spec/ruby/library/net/ftp/voidcmd_spec.rb
index 5e82b70a78..3673c7fd5b 100644
--- a/spec/ruby/library/net/ftp/voidcmd_spec.rb
+++ b/spec/ruby/library/net/ftp/voidcmd_spec.rb
@@ -19,7 +19,7 @@ describe "Net::FTP#voidcmd" do
it "sends the passed command to the server" do
@server.should_receive(:help).and_respond("2xx Does not raise.")
- lambda { @ftp.voidcmd("HELP") }.should_not raise_error
+ -> { @ftp.voidcmd("HELP") }.should_not raise_error
end
it "returns nil" do
@@ -29,26 +29,26 @@ describe "Net::FTP#voidcmd" do
it "raises a Net::FTPReplyError when the response code is 1xx" do
@server.should_receive(:help).and_respond("1xx Does raise a Net::FTPReplyError.")
- lambda { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPReplyError)
+ -> { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPReplyError)
end
it "raises a Net::FTPReplyError when the response code is 3xx" do
@server.should_receive(:help).and_respond("3xx Does raise a Net::FTPReplyError.")
- lambda { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPReplyError)
+ -> { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPReplyError)
end
it "raises a Net::FTPTempError when the response code is 4xx" do
@server.should_receive(:help).and_respond("4xx Does raise a Net::FTPTempError.")
- lambda { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPTempError)
+ -> { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 5xx" do
@server.should_receive(:help).and_respond("5xx Does raise a Net::FTPPermError.")
- lambda { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPPermError)
+ -> { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPProtoError when the response code is not valid" do
@server.should_receive(:help).and_respond("999 Does raise a Net::FTPProtoError.")
- lambda { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPProtoError)
+ -> { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPProtoError)
end
end
diff --git a/spec/ruby/library/net/http/HTTPServerException_spec.rb b/spec/ruby/library/net/http/HTTPServerException_spec.rb
index 3960effadd..87841ab499 100644
--- a/spec/ruby/library/net/http/HTTPServerException_spec.rb
+++ b/spec/ruby/library/net/http/HTTPServerException_spec.rb
@@ -16,11 +16,11 @@ end
ruby_version_is "2.6" do
describe "Net::HTTPServerException" do
it "is a subclass of Net::ProtoServerError and is warned as deprecated" do
- lambda { Net::HTTPServerException.should < Net::ProtoServerError }.should complain(/warning: constant Net::HTTPServerException is deprecated/)
+ -> { Net::HTTPServerException.should < Net::ProtoServerError }.should complain(/warning: constant Net::HTTPServerException is deprecated/)
end
it "includes the Net::HTTPExceptions module and is warned as deprecated" do
- lambda { Net::HTTPServerException.should < Net::HTTPExceptions }.should complain(/warning: constant Net::HTTPServerException is deprecated/)
+ -> { Net::HTTPServerException.should < Net::HTTPExceptions }.should complain(/warning: constant Net::HTTPServerException is deprecated/)
end
end
end
diff --git a/spec/ruby/library/net/http/http/finish_spec.rb b/spec/ruby/library/net/http/http/finish_spec.rb
index b031c58e2c..f98bc7be13 100644
--- a/spec/ruby/library/net/http/http/finish_spec.rb
+++ b/spec/ruby/library/net/http/http/finish_spec.rb
@@ -23,7 +23,7 @@ describe "Net::HTTP#finish" do
describe "when self has not been started yet" do
it "raises an IOError" do
- lambda { @http.finish }.should raise_error(IOError)
+ -> { @http.finish }.should raise_error(IOError)
end
end
end
diff --git a/spec/ruby/library/net/http/http/get_print_spec.rb b/spec/ruby/library/net/http/http/get_print_spec.rb
index 6174e3eb21..f59dd68c81 100644
--- a/spec/ruby/library/net/http/http/get_print_spec.rb
+++ b/spec/ruby/library/net/http/http/get_print_spec.rb
@@ -14,7 +14,7 @@ describe "Net::HTTP.get_print" do
describe "when passed URI" do
it "it prints the body of the specified uri to $stdout" do
- lambda do
+ -> do
Net::HTTP.get_print URI.parse("http://localhost:#{@port}/")
end.should output(/This is the index page\./)
end
@@ -22,7 +22,7 @@ describe "Net::HTTP.get_print" do
describe "when passed host, path, port" do
it "it prints the body of the specified uri to $stdout" do
- lambda do
+ -> do
Net::HTTP.get_print 'localhost', "/", @port
end.should output(/This is the index page\./)
end
diff --git a/spec/ruby/library/net/http/http/set_debug_output_spec.rb b/spec/ruby/library/net/http/http/set_debug_output_spec.rb
index e0fe4796da..94b6f4499d 100644
--- a/spec/ruby/library/net/http/http/set_debug_output_spec.rb
+++ b/spec/ruby/library/net/http/http/set_debug_output_spec.rb
@@ -28,6 +28,6 @@ describe "Net::HTTP#set_debug_output when passed io" do
it "outputs a warning when the connection has already been started" do
@http.start
- lambda { @http.set_debug_output(StringIO.new) }.should complain(/Net::HTTP#set_debug_output called after HTTP started/)
+ -> { @http.set_debug_output(StringIO.new) }.should complain(/Net::HTTP#set_debug_output called after HTTP started/)
end
end
diff --git a/spec/ruby/library/net/http/http/start_spec.rb b/spec/ruby/library/net/http/http/start_spec.rb
index e23f9183f7..a2768eed18 100644
--- a/spec/ruby/library/net/http/http/start_spec.rb
+++ b/spec/ruby/library/net/http/http/start_spec.rb
@@ -81,7 +81,7 @@ describe "Net::HTTP#start" do
describe "when self has already been started" do
it "raises an IOError" do
@http.start
- lambda { @http.start }.should raise_error(IOError)
+ -> { @http.start }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/net/http/httpgenericrequest/body_exist_spec.rb b/spec/ruby/library/net/http/httpgenericrequest/body_exist_spec.rb
index 9b04bffb2e..7d081939b8 100644
--- a/spec/ruby/library/net/http/httpgenericrequest/body_exist_spec.rb
+++ b/spec/ruby/library/net/http/httpgenericrequest/body_exist_spec.rb
@@ -13,7 +13,7 @@ describe "Net::HTTPGenericRequest#body_exist?" do
describe "when $VERBOSE is true" do
it "emits a warning" do
request = Net::HTTPGenericRequest.new("POST", true, false, "/some/path")
- lambda {
+ -> {
request.body_exist?
}.should complain(/body_exist\? is obsolete/, verbose: true)
end
diff --git a/spec/ruby/library/net/http/httpgenericrequest/exec_spec.rb b/spec/ruby/library/net/http/httpgenericrequest/exec_spec.rb
index 90e158a159..da5b1a63be 100644
--- a/spec/ruby/library/net/http/httpgenericrequest/exec_spec.rb
+++ b/spec/ruby/library/net/http/httpgenericrequest/exec_spec.rb
@@ -125,7 +125,7 @@ describe "Net::HTTPGenericRequest#exec when passed socket, version, path" do
"Content-Type" => "text/html")
request.body_stream = StringIO.new("Some Content")
- lambda { request.exec(@buffered_socket, "1.1", "/some/other/path") }.should raise_error(ArgumentError)
+ -> { request.exec(@buffered_socket, "1.1", "/some/other/path") }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/library/net/http/httpgenericrequest/set_body_internal_spec.rb b/spec/ruby/library/net/http/httpgenericrequest/set_body_internal_spec.rb
index ef2edc019a..7494c69173 100644
--- a/spec/ruby/library/net/http/httpgenericrequest/set_body_internal_spec.rb
+++ b/spec/ruby/library/net/http/httpgenericrequest/set_body_internal_spec.rb
@@ -13,9 +13,9 @@ describe "Net::HTTPGenericRequest#set_body_internal when passed string" do
it "raises an ArgumentError when the body or body_stream of self have already been set" do
@request.body = "Some Content"
- lambda { @request.set_body_internal("Some other Content") }.should raise_error(ArgumentError)
+ -> { @request.set_body_internal("Some other Content") }.should raise_error(ArgumentError)
@request.body_stream = "Some Content"
- lambda { @request.set_body_internal("Some other Content") }.should raise_error(ArgumentError)
+ -> { @request.set_body_internal("Some other Content") }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/net/http/httpheader/content_length_spec.rb b/spec/ruby/library/net/http/httpheader/content_length_spec.rb
index 44c971c98e..e344817e82 100644
--- a/spec/ruby/library/net/http/httpheader/content_length_spec.rb
+++ b/spec/ruby/library/net/http/httpheader/content_length_spec.rb
@@ -13,7 +13,7 @@ describe "Net::HTTPHeader#content_length" do
it "raises a Net::HTTPHeaderSyntaxError when the 'Content-Length' header entry has an invalid format" do
@headers["Content-Length"] = "invalid"
- lambda { @headers.content_length }.should raise_error(Net::HTTPHeaderSyntaxError)
+ -> { @headers.content_length }.should raise_error(Net::HTTPHeaderSyntaxError)
end
it "returns the value of the 'Content-Length' header entry as an Integer" do
diff --git a/spec/ruby/library/net/http/httpheader/content_range_spec.rb b/spec/ruby/library/net/http/httpheader/content_range_spec.rb
index 23dc92348b..ba75f9a9a1 100644
--- a/spec/ruby/library/net/http/httpheader/content_range_spec.rb
+++ b/spec/ruby/library/net/http/httpheader/content_range_spec.rb
@@ -21,12 +21,12 @@ describe "Net::HTTPHeader#content_range" do
it "raises a Net::HTTPHeaderSyntaxError when the 'Content-Range' has an invalid format" do
@headers["Content-Range"] = "invalid"
- lambda { @headers.content_range }.should raise_error(Net::HTTPHeaderSyntaxError)
+ -> { @headers.content_range }.should raise_error(Net::HTTPHeaderSyntaxError)
@headers["Content-Range"] = "bytes 123-abc"
- lambda { @headers.content_range }.should raise_error(Net::HTTPHeaderSyntaxError)
+ -> { @headers.content_range }.should raise_error(Net::HTTPHeaderSyntaxError)
@headers["Content-Range"] = "bytes abc-123"
- lambda { @headers.content_range }.should raise_error(Net::HTTPHeaderSyntaxError)
+ -> { @headers.content_range }.should raise_error(Net::HTTPHeaderSyntaxError)
end
end
diff --git a/spec/ruby/library/net/http/httpheader/fetch_spec.rb b/spec/ruby/library/net/http/httpheader/fetch_spec.rb
index 4d608cdb0d..ea15679acb 100644
--- a/spec/ruby/library/net/http/httpheader/fetch_spec.rb
+++ b/spec/ruby/library/net/http/httpheader/fetch_spec.rb
@@ -25,7 +25,7 @@ describe "Net::HTTPHeader#fetch" do
end
it "returns nil when there is no entry for the passed key" do
- lambda { @headers.fetch("my-header") }.should raise_error(IndexError)
+ -> { @headers.fetch("my-header") }.should raise_error(IndexError)
end
end
diff --git a/spec/ruby/library/net/http/httpheader/initialize_http_header_spec.rb b/spec/ruby/library/net/http/httpheader/initialize_http_header_spec.rb
index 35768b4e7e..efc5e7d0b2 100644
--- a/spec/ruby/library/net/http/httpheader/initialize_http_header_spec.rb
+++ b/spec/ruby/library/net/http/httpheader/initialize_http_header_spec.rb
@@ -14,7 +14,7 @@ describe "Net::HTTPHeader#initialize_http_header when passed Hash" do
end
it "complains about duplicate keys when in verbose mode" do
- lambda do
+ -> do
@headers.initialize_http_header("My-Header" => "test", "my-header" => "another test")
end.should complain(/duplicated HTTP header/, verbose: true)
end
diff --git a/spec/ruby/library/net/http/httpheader/range_length_spec.rb b/spec/ruby/library/net/http/httpheader/range_length_spec.rb
index 4415c8e5ba..b8fce4f690 100644
--- a/spec/ruby/library/net/http/httpheader/range_length_spec.rb
+++ b/spec/ruby/library/net/http/httpheader/range_length_spec.rb
@@ -21,12 +21,12 @@ describe "Net::HTTPHeader#range_length" do
it "raises a Net::HTTPHeaderSyntaxError when the 'Content-Range' has an invalid format" do
@headers["Content-Range"] = "invalid"
- lambda { @headers.range_length }.should raise_error(Net::HTTPHeaderSyntaxError)
+ -> { @headers.range_length }.should raise_error(Net::HTTPHeaderSyntaxError)
@headers["Content-Range"] = "bytes 123-abc"
- lambda { @headers.range_length }.should raise_error(Net::HTTPHeaderSyntaxError)
+ -> { @headers.range_length }.should raise_error(Net::HTTPHeaderSyntaxError)
@headers["Content-Range"] = "bytes abc-123"
- lambda { @headers.range_length }.should raise_error(Net::HTTPHeaderSyntaxError)
+ -> { @headers.range_length }.should raise_error(Net::HTTPHeaderSyntaxError)
end
end
diff --git a/spec/ruby/library/net/http/httpheader/range_spec.rb b/spec/ruby/library/net/http/httpheader/range_spec.rb
index 5f06e03a1c..005177f6be 100644
--- a/spec/ruby/library/net/http/httpheader/range_spec.rb
+++ b/spec/ruby/library/net/http/httpheader/range_spec.rb
@@ -28,18 +28,18 @@ describe "Net::HTTPHeader#range" do
it "raises a Net::HTTPHeaderSyntaxError when the 'Range' has an invalid format" do
@headers["Range"] = "invalid"
- lambda { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError)
+ -> { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError)
@headers["Range"] = "bytes 123-abc"
- lambda { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError)
+ -> { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError)
@headers["Range"] = "bytes abc-123"
- lambda { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError)
+ -> { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError)
end
it "raises a Net::HTTPHeaderSyntaxError when the 'Range' was not specified" do
@headers["Range"] = "bytes=-"
- lambda { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError)
+ -> { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError)
end
end
diff --git a/spec/ruby/library/net/http/httpheader/shared/set_range.rb b/spec/ruby/library/net/http/httpheader/shared/set_range.rb
index 6a98edbe10..87f51d46f3 100644
--- a/spec/ruby/library/net/http/httpheader/shared/set_range.rb
+++ b/spec/ruby/library/net/http/httpheader/shared/set_range.rb
@@ -50,15 +50,15 @@ describe :net_httpheader_set_range, shared: true do
end
it "raises a Net::HTTPHeaderSyntaxError when the first Range element is negative" do
- lambda { @headers.send(@method, -10..5) }.should raise_error(Net::HTTPHeaderSyntaxError)
+ -> { @headers.send(@method, -10..5) }.should raise_error(Net::HTTPHeaderSyntaxError)
end
it "raises a Net::HTTPHeaderSyntaxError when the last Range element is negative" do
- lambda { @headers.send(@method, 10..-5) }.should raise_error(Net::HTTPHeaderSyntaxError)
+ -> { @headers.send(@method, 10..-5) }.should raise_error(Net::HTTPHeaderSyntaxError)
end
it "raises a Net::HTTPHeaderSyntaxError when the last Range element is smaller than the first" do
- lambda { @headers.send(@method, 10..5) }.should raise_error(Net::HTTPHeaderSyntaxError)
+ -> { @headers.send(@method, 10..5) }.should raise_error(Net::HTTPHeaderSyntaxError)
end
end
@@ -75,15 +75,15 @@ describe :net_httpheader_set_range, shared: true do
end
it "raises a Net::HTTPHeaderSyntaxError when start is negative" do
- lambda { @headers.send(@method, -10, 5) }.should raise_error(Net::HTTPHeaderSyntaxError)
+ -> { @headers.send(@method, -10, 5) }.should raise_error(Net::HTTPHeaderSyntaxError)
end
it "raises a Net::HTTPHeaderSyntaxError when start + length is negative" do
- lambda { @headers.send(@method, 10, -15) }.should raise_error(Net::HTTPHeaderSyntaxError)
+ -> { @headers.send(@method, 10, -15) }.should raise_error(Net::HTTPHeaderSyntaxError)
end
it "raises a Net::HTTPHeaderSyntaxError when length is negative" do
- lambda { @headers.send(@method, 10, -4) }.should raise_error(Net::HTTPHeaderSyntaxError)
+ -> { @headers.send(@method, 10, -4) }.should raise_error(Net::HTTPHeaderSyntaxError)
end
end
end
diff --git a/spec/ruby/library/net/http/httpresponse/error_spec.rb b/spec/ruby/library/net/http/httpresponse/error_spec.rb
index a3a3cee162..d2b2f53d89 100644
--- a/spec/ruby/library/net/http/httpresponse/error_spec.rb
+++ b/spec/ruby/library/net/http/httpresponse/error_spec.rb
@@ -4,26 +4,26 @@ require 'net/http'
describe "Net::HTTPResponse#error!" do
it "raises self's class 'EXCEPTION_TYPE' Exception" do
res = Net::HTTPUnknownResponse.new("1.0", "???", "test response")
- lambda { res.error! }.should raise_error(Net::HTTPError)
+ -> { res.error! }.should raise_error(Net::HTTPError)
res = Net::HTTPInformation.new("1.0", "1xx", "test response")
- lambda { res.error! }.should raise_error(Net::HTTPError)
+ -> { res.error! }.should raise_error(Net::HTTPError)
res = Net::HTTPSuccess.new("1.0", "2xx", "test response")
- lambda { res.error! }.should raise_error(Net::HTTPError)
+ -> { res.error! }.should raise_error(Net::HTTPError)
res = Net::HTTPRedirection.new("1.0", "3xx", "test response")
- lambda { res.error! }.should raise_error(Net::HTTPRetriableError)
+ -> { res.error! }.should raise_error(Net::HTTPRetriableError)
res = Net::HTTPClientError.new("1.0", "4xx", "test response")
ruby_version_is ""..."2.6" do
- lambda { res.error! }.should raise_error(Net::HTTPServerException)
+ -> { res.error! }.should raise_error(Net::HTTPServerException)
end
ruby_version_is "2.6" do
- lambda { res.error! }.should raise_error(Net::HTTPClientException)
+ -> { res.error! }.should raise_error(Net::HTTPClientException)
end
res = Net::HTTPServerError.new("1.0", "5xx", "test response")
- lambda { res.error! }.should raise_error(Net::HTTPFatalError)
+ -> { res.error! }.should raise_error(Net::HTTPFatalError)
end
end
diff --git a/spec/ruby/library/net/http/httpresponse/read_body_spec.rb b/spec/ruby/library/net/http/httpresponse/read_body_spec.rb
index a050eca594..99d8e5fa88 100644
--- a/spec/ruby/library/net/http/httpresponse/read_body_spec.rb
+++ b/spec/ruby/library/net/http/httpresponse/read_body_spec.rb
@@ -40,7 +40,7 @@ describe "Net::HTTPResponse#read_body" do
it "raises an IOError if called a second time" do
@res.reading_body(@socket, true) do
@res.read_body("")
- lambda { @res.read_body("") }.should raise_error(IOError)
+ -> { @res.read_body("") }.should raise_error(IOError)
end
end
end
@@ -70,7 +70,7 @@ describe "Net::HTTPResponse#read_body" do
it "raises an IOError if called a second time" do
@res.reading_body(@socket, true) do
@res.read_body {}
- lambda { @res.read_body {} }.should raise_error(IOError)
+ -> { @res.read_body {} }.should raise_error(IOError)
end
end
end
@@ -78,7 +78,7 @@ describe "Net::HTTPResponse#read_body" do
describe "when passed buffer and block" do
it "raises an ArgumentError" do
@res.reading_body(@socket, true) do
- lambda { @res.read_body("") {} }.should raise_error(ArgumentError)
+ -> { @res.read_body("") {} }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/library/net/http/httpresponse/value_spec.rb b/spec/ruby/library/net/http/httpresponse/value_spec.rb
index 1b19d1d6f7..4a5930d4e5 100644
--- a/spec/ruby/library/net/http/httpresponse/value_spec.rb
+++ b/spec/ruby/library/net/http/httpresponse/value_spec.rb
@@ -4,26 +4,26 @@ require 'net/http'
describe "Net::HTTPResponse#value" do
it "raises an HTTP error for non 2xx HTTP Responses" do
res = Net::HTTPUnknownResponse.new("1.0", "???", "test response")
- lambda { res.value }.should raise_error(Net::HTTPError)
+ -> { res.value }.should raise_error(Net::HTTPError)
res = Net::HTTPInformation.new("1.0", "1xx", "test response")
- lambda { res.value }.should raise_error(Net::HTTPError)
+ -> { res.value }.should raise_error(Net::HTTPError)
res = Net::HTTPSuccess.new("1.0", "2xx", "test response")
- lambda { res.value }.should_not raise_error(Net::HTTPError)
+ -> { res.value }.should_not raise_error(Net::HTTPError)
res = Net::HTTPRedirection.new("1.0", "3xx", "test response")
- lambda { res.value }.should raise_error(Net::HTTPRetriableError)
+ -> { res.value }.should raise_error(Net::HTTPRetriableError)
res = Net::HTTPClientError.new("1.0", "4xx", "test response")
ruby_version_is ""..."2.6" do
- lambda { res.value }.should raise_error(Net::HTTPServerException)
+ -> { res.value }.should raise_error(Net::HTTPServerException)
end
ruby_version_is "2.6" do
- lambda { res.value }.should raise_error(Net::HTTPClientException)
+ -> { res.value }.should raise_error(Net::HTTPClientException)
end
res = Net::HTTPServerError.new("1.0", "5xx", "test response")
- lambda { res.value }.should raise_error(Net::HTTPFatalError)
+ -> { res.value }.should raise_error(Net::HTTPFatalError)
end
end
diff --git a/spec/ruby/library/observer/notify_observers_spec.rb b/spec/ruby/library/observer/notify_observers_spec.rb
index 86422fc4a0..31f82e9266 100644
--- a/spec/ruby/library/observer/notify_observers_spec.rb
+++ b/spec/ruby/library/observer/notify_observers_spec.rb
@@ -16,7 +16,7 @@ describe "Observer#notify_observers" do
end
it "verifies observer responds to update" do
- lambda {
+ -> {
@observable.add_observer(@observable)
}.should raise_error(NoMethodError)
end
diff --git a/spec/ruby/library/openssl/config/freeze_spec.rb b/spec/ruby/library/openssl/config/freeze_spec.rb
index 69c96cf85e..1876095d9f 100644
--- a/spec/ruby/library/openssl/config/freeze_spec.rb
+++ b/spec/ruby/library/openssl/config/freeze_spec.rb
@@ -8,12 +8,12 @@ describe "OpenSSL::Config#freeze" do
it "freezes" do
c = OpenSSL::Config.new
- lambda {
+ -> {
c['foo'] = [ ['key', 'value'] ]
}.should_not raise_error
c.freeze
c.frozen?.should be_true
- lambda {
+ -> {
c['foo'] = [ ['key', 'value'] ]
}.should raise_error(TypeError)
end
diff --git a/spec/ruby/library/openssl/random/shared/random_bytes.rb b/spec/ruby/library/openssl/random/shared/random_bytes.rb
index 3a3a6b2bc4..037f10d409 100644
--- a/spec/ruby/library/openssl/random/shared/random_bytes.rb
+++ b/spec/ruby/library/openssl/random/shared/random_bytes.rb
@@ -22,7 +22,7 @@ describe :openssl_random_bytes, shared: true do |cmd|
end
it "raises ArgumentError on negative arguments" do
- lambda {
+ -> {
OpenSSL::Random.send(@method, -1)
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/openssl/x509/name/parse_spec.rb b/spec/ruby/library/openssl/x509/name/parse_spec.rb
index 6a43f5aea3..6624161d83 100644
--- a/spec/ruby/library/openssl/x509/name/parse_spec.rb
+++ b/spec/ruby/library/openssl/x509/name/parse_spec.rb
@@ -35,13 +35,13 @@ describe "OpenSSL::X509::Name.parse" do
end
it "raises TypeError if the given string contains no key/value pairs" do
- lambda do
+ -> do
OpenSSL::X509::Name.parse("hello")
end.should raise_error(TypeError)
end
it "raises OpenSSL::X509::NameError if the given string contains invalid keys" do
- lambda do
+ -> do
OpenSSL::X509::Name.parse("hello=goodbye")
end.should raise_error(OpenSSL::X509::NameError)
end
diff --git a/spec/ruby/library/openstruct/frozen_spec.rb b/spec/ruby/library/openstruct/frozen_spec.rb
index 142adcb278..63767bb54d 100644
--- a/spec/ruby/library/openstruct/frozen_spec.rb
+++ b/spec/ruby/library/openstruct/frozen_spec.rb
@@ -15,18 +15,18 @@ describe "OpenStruct.new when frozen" do
end
it "is not writable" do
- lambda{ @os.age = 42 }.should raise_error( RuntimeError )
+ ->{ @os.age = 42 }.should raise_error( RuntimeError )
end
it "cannot create new fields" do
- lambda{ @os.state = :new }.should raise_error( RuntimeError )
+ ->{ @os.state = :new }.should raise_error( RuntimeError )
end
it "creates a frozen clone" do
f = @os.clone
f.age.should == 70
- lambda{ f.age = 0 }.should raise_error( RuntimeError )
- lambda{ f.state = :newer }.should raise_error( RuntimeError )
+ ->{ f.age = 0 }.should raise_error( RuntimeError )
+ ->{ f.state = :newer }.should raise_error( RuntimeError )
end
it "creates an unfrozen dup" do
diff --git a/spec/ruby/library/openstruct/method_missing_spec.rb b/spec/ruby/library/openstruct/method_missing_spec.rb
index 5f85b2e513..1992b7255c 100644
--- a/spec/ruby/library/openstruct/method_missing_spec.rb
+++ b/spec/ruby/library/openstruct/method_missing_spec.rb
@@ -7,12 +7,12 @@ describe "OpenStruct#method_missing when called with a method name ending in '='
end
it "raises an ArgumentError when not passed any additional arguments" do
- lambda { @os.method_missing(:test=) }.should raise_error(ArgumentError)
+ -> { @os.method_missing(:test=) }.should raise_error(ArgumentError)
end
it "raises a TypeError when self is frozen" do
@os.freeze
- lambda { @os.method_missing(:test=, "test") }.should raise_error(RuntimeError)
+ -> { @os.method_missing(:test=, "test") }.should raise_error(RuntimeError)
end
it "creates accessor methods" do
@@ -29,13 +29,13 @@ end
describe "OpenStruct#method_missing when passed additional arguments" do
it "raises a NoMethodError when the key does not exist" do
os = OpenStruct.new
- lambda { os.method_missing(:test, 1, 2, 3) }.should raise_error(NoMethodError)
+ -> { os.method_missing(:test, 1, 2, 3) }.should raise_error(NoMethodError)
end
ruby_version_is "2.7" do
it "raises an ArgumentError when the key exists" do
os = OpenStruct.new(test: 20)
- lambda { os.method_missing(:test, 1, 2, 3) }.should raise_error(ArgumentError)
+ -> { os.method_missing(:test, 1, 2, 3) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/library/pathname/new_spec.rb b/spec/ruby/library/pathname/new_spec.rb
index 4f519af398..f400444887 100644
--- a/spec/ruby/library/pathname/new_spec.rb
+++ b/spec/ruby/library/pathname/new_spec.rb
@@ -7,7 +7,7 @@ describe "Pathname.new" do
end
it "raises an ArgumentError when called with \0" do
- lambda { Pathname.new("\0")}.should raise_error(ArgumentError)
+ -> { Pathname.new("\0")}.should raise_error(ArgumentError)
end
it "is tainted if path is tainted" do
@@ -16,10 +16,10 @@ describe "Pathname.new" do
end
it "raises a TypeError if not passed a String type" do
- lambda { Pathname.new(nil) }.should raise_error(TypeError)
- lambda { Pathname.new(0) }.should raise_error(TypeError)
- lambda { Pathname.new(true) }.should raise_error(TypeError)
- lambda { Pathname.new(false) }.should raise_error(TypeError)
+ -> { Pathname.new(nil) }.should raise_error(TypeError)
+ -> { Pathname.new(0) }.should raise_error(TypeError)
+ -> { Pathname.new(true) }.should raise_error(TypeError)
+ -> { Pathname.new(false) }.should raise_error(TypeError)
end
it "initializes with an object with to_path" do
diff --git a/spec/ruby/library/pathname/relative_path_from_spec.rb b/spec/ruby/library/pathname/relative_path_from_spec.rb
index 1a941be926..abe9c80a45 100644
--- a/spec/ruby/library/pathname/relative_path_from_spec.rb
+++ b/spec/ruby/library/pathname/relative_path_from_spec.rb
@@ -7,11 +7,11 @@ describe "Pathname#relative_path_from" do
end
it "raises an error when the two paths do not share a common prefix" do
- lambda { relative_path_str('/usr', 'foo') }.should raise_error(ArgumentError)
+ -> { relative_path_str('/usr', 'foo') }.should raise_error(ArgumentError)
end
it "raises an error when the base directory has .." do
- lambda { relative_path_str('a', '..') }.should raise_error(ArgumentError)
+ -> { relative_path_str('a', '..') }.should raise_error(ArgumentError)
end
it "returns a path relative from root" do
diff --git a/spec/ruby/library/pp/pp_spec.rb b/spec/ruby/library/pp/pp_spec.rb
index c4559b35ca..06b22601d8 100644
--- a/spec/ruby/library/pp/pp_spec.rb
+++ b/spec/ruby/library/pp/pp_spec.rb
@@ -5,7 +5,7 @@ describe "PP.pp" do
it 'works with default arguments' do
array = [1, 2, 3]
- lambda {
+ -> {
PP.pp array
}.should output "[1, 2, 3]\n"
end
@@ -14,7 +14,7 @@ describe "PP.pp" do
array = [1, 2, 3]
other_out = IOStub.new
- lambda {
+ -> {
PP.pp array, other_out
}.should output "" # no output on stdout
diff --git a/spec/ruby/library/prime/instance_spec.rb b/spec/ruby/library/prime/instance_spec.rb
index 156337c46a..5183f36901 100644
--- a/spec/ruby/library/prime/instance_spec.rb
+++ b/spec/ruby/library/prime/instance_spec.rb
@@ -12,10 +12,10 @@ describe "Prime.instance" do
end
it "does not complain anything" do
- lambda { Prime.instance }.should_not complain
+ -> { Prime.instance }.should_not complain
end
it "raises a ArgumentError when is called with some arguments" do
- lambda { Prime.instance(1) }.should raise_error(ArgumentError)
+ -> { Prime.instance(1) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/prime/integer/prime_division_spec.rb b/spec/ruby/library/prime/integer/prime_division_spec.rb
index 60ba21037f..be03438a6f 100644
--- a/spec/ruby/library/prime/integer/prime_division_spec.rb
+++ b/spec/ruby/library/prime/integer/prime_division_spec.rb
@@ -14,6 +14,6 @@ describe "Integer#prime_division" do
-1.prime_division.should == [[-1, 1]]
end
it "raises ZeroDivisionError for 0" do
- lambda { 0.prime_division }.should raise_error(ZeroDivisionError)
+ -> { 0.prime_division }.should raise_error(ZeroDivisionError)
end
end
diff --git a/spec/ruby/library/prime/prime_division_spec.rb b/spec/ruby/library/prime/prime_division_spec.rb
index 151b046f44..6293478f59 100644
--- a/spec/ruby/library/prime/prime_division_spec.rb
+++ b/spec/ruby/library/prime/prime_division_spec.rb
@@ -20,6 +20,6 @@ describe "Prime.prime_division" do
end
it "raises ZeroDivisionError for 0" do
- lambda { Prime.prime_division(0) }.should raise_error(ZeroDivisionError)
+ -> { Prime.prime_division(0) }.should raise_error(ZeroDivisionError)
end
end
diff --git a/spec/ruby/library/readline/completion_proc_spec.rb b/spec/ruby/library/readline/completion_proc_spec.rb
index 721acaa1d0..2d7a353ec5 100644
--- a/spec/ruby/library/readline/completion_proc_spec.rb
+++ b/spec/ruby/library/readline/completion_proc_spec.rb
@@ -16,7 +16,7 @@ with_feature :readline do
end
it "returns an ArgumentError if not given an Proc or #call" do
- lambda { Readline.completion_proc = "test" }.should raise_error(ArgumentError)
+ -> { Readline.completion_proc = "test" }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/library/readline/history/append_spec.rb b/spec/ruby/library/readline/history/append_spec.rb
index ee26b01255..5383271374 100644
--- a/spec/ruby/library/readline/history/append_spec.rb
+++ b/spec/ruby/library/readline/history/append_spec.rb
@@ -22,7 +22,7 @@ with_feature :readline do
end
it "raises a TypeError when the passed Object can't be converted to a String" do
- lambda { Readline::HISTORY << mock("Object") }.should raise_error(TypeError)
+ -> { Readline::HISTORY << mock("Object") }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/library/readline/history/delete_at_spec.rb b/spec/ruby/library/readline/history/delete_at_spec.rb
index 407006c20c..8dcce259bb 100644
--- a/spec/ruby/library/readline/history/delete_at_spec.rb
+++ b/spec/ruby/library/readline/history/delete_at_spec.rb
@@ -31,8 +31,8 @@ with_feature :readline do
end
it "raises an IndexError when the given index is greater than the history size" do
- lambda { Readline::HISTORY.delete_at(10) }.should raise_error(IndexError)
- lambda { Readline::HISTORY.delete_at(-10) }.should raise_error(IndexError)
+ -> { Readline::HISTORY.delete_at(10) }.should raise_error(IndexError)
+ -> { Readline::HISTORY.delete_at(-10) }.should raise_error(IndexError)
end
it "taints the returned strings" do
diff --git a/spec/ruby/library/readline/history/element_reference_spec.rb b/spec/ruby/library/readline/history/element_reference_spec.rb
index a85d069111..09cac5e28f 100644
--- a/spec/ruby/library/readline/history/element_reference_spec.rb
+++ b/spec/ruby/library/readline/history/element_reference_spec.rb
@@ -28,13 +28,13 @@ with_feature :readline do
end
it "raises an IndexError when there is no item at the passed index" do
- lambda { Readline::HISTORY[-10] }.should raise_error(IndexError)
- lambda { Readline::HISTORY[-9] }.should raise_error(IndexError)
- lambda { Readline::HISTORY[-8] }.should raise_error(IndexError)
+ -> { Readline::HISTORY[-10] }.should raise_error(IndexError)
+ -> { Readline::HISTORY[-9] }.should raise_error(IndexError)
+ -> { Readline::HISTORY[-8] }.should raise_error(IndexError)
- lambda { Readline::HISTORY[8] }.should raise_error(IndexError)
- lambda { Readline::HISTORY[9] }.should raise_error(IndexError)
- lambda { Readline::HISTORY[10] }.should raise_error(IndexError)
+ -> { Readline::HISTORY[8] }.should raise_error(IndexError)
+ -> { Readline::HISTORY[9] }.should raise_error(IndexError)
+ -> { Readline::HISTORY[10] }.should raise_error(IndexError)
end
end
end
diff --git a/spec/ruby/library/readline/history/element_set_spec.rb b/spec/ruby/library/readline/history/element_set_spec.rb
index 67ecf0ef2b..776adaacd1 100644
--- a/spec/ruby/library/readline/history/element_set_spec.rb
+++ b/spec/ruby/library/readline/history/element_set_spec.rb
@@ -17,7 +17,7 @@ with_feature :readline do
end
it "raises an IndexError when there is no item at the passed positive index" do
- lambda { Readline::HISTORY[10] = "test" }.should raise_error(IndexError)
+ -> { Readline::HISTORY[10] = "test" }.should raise_error(IndexError)
end
it "sets the item at the given index" do
@@ -29,7 +29,7 @@ with_feature :readline do
end
it "raises an IndexError when there is no item at the passed negative index" do
- lambda { Readline::HISTORY[10] = "test" }.should raise_error(IndexError)
+ -> { Readline::HISTORY[10] = "test" }.should raise_error(IndexError)
end
end
end
diff --git a/spec/ruby/library/readline/history/push_spec.rb b/spec/ruby/library/readline/history/push_spec.rb
index f91121f351..53505ccba6 100644
--- a/spec/ruby/library/readline/history/push_spec.rb
+++ b/spec/ruby/library/readline/history/push_spec.rb
@@ -20,7 +20,7 @@ with_feature :readline do
end
it "raises a TypeError when the passed Object can't be converted to a String" do
- lambda { Readline::HISTORY.push(mock("Object")) }.should raise_error(TypeError)
+ -> { Readline::HISTORY.push(mock("Object")) }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/library/resolv/get_address_spec.rb b/spec/ruby/library/resolv/get_address_spec.rb
index baa2b118f3..ecc2cdf7de 100644
--- a/spec/ruby/library/resolv/get_address_spec.rb
+++ b/spec/ruby/library/resolv/get_address_spec.rb
@@ -12,7 +12,7 @@ describe "Resolv#getaddress" do
it "raises ResolvError if the name can not be looked up" do
res = Resolv.new([])
- lambda {
+ -> {
res.getaddress("should.raise.error.")
}.should raise_error(Resolv::ResolvError)
end
diff --git a/spec/ruby/library/resolv/get_name_spec.rb b/spec/ruby/library/resolv/get_name_spec.rb
index 70b91e19e8..3ef97a2cea 100644
--- a/spec/ruby/library/resolv/get_name_spec.rb
+++ b/spec/ruby/library/resolv/get_name_spec.rb
@@ -11,7 +11,7 @@ describe "Resolv#getname" do
it "raises ResolvError when there is no result" do
res = Resolv.new([])
- lambda {
+ -> {
res.getname("should.raise.error")
}.should raise_error(Resolv::ResolvError)
end
diff --git a/spec/ruby/library/rexml/attribute/remove_spec.rb b/spec/ruby/library/rexml/attribute/remove_spec.rb
index b97b860a5f..08d22cb6ba 100644
--- a/spec/ruby/library/rexml/attribute/remove_spec.rb
+++ b/spec/ruby/library/rexml/attribute/remove_spec.rb
@@ -15,6 +15,6 @@ describe "REXML::Attribute#remove" do
end
it "does not anything if element has no parent" do
- lambda {@attr.remove}.should_not raise_error(Exception)
+ -> {@attr.remove}.should_not raise_error(Exception)
end
end
diff --git a/spec/ruby/library/rexml/attribute/xpath_spec.rb b/spec/ruby/library/rexml/attribute/xpath_spec.rb
index beefb036cc..8335e0a8ef 100644
--- a/spec/ruby/library/rexml/attribute/xpath_spec.rb
+++ b/spec/ruby/library/rexml/attribute/xpath_spec.rb
@@ -14,6 +14,6 @@ describe "REXML::Attribute#xpath" do
end
it "raises an error if attribute has no parent" do
- lambda { @attr.xpath }.should raise_error(Exception)
+ -> { @attr.xpath }.should raise_error(Exception)
end
end
diff --git a/spec/ruby/library/rexml/document/add_spec.rb b/spec/ruby/library/rexml/document/add_spec.rb
index a200da1e3d..db95114e7e 100644
--- a/spec/ruby/library/rexml/document/add_spec.rb
+++ b/spec/ruby/library/rexml/document/add_spec.rb
@@ -44,7 +44,7 @@ describe :rexml_document_add, shared: true do
end
it "refuses to add second root" do
- lambda { @doc.send(@method, REXML::Element.new("foo")) }.should raise_error(RuntimeError)
+ -> { @doc.send(@method, REXML::Element.new("foo")) }.should raise_error(RuntimeError)
end
end
diff --git a/spec/ruby/library/rexml/document/new_spec.rb b/spec/ruby/library/rexml/document/new_spec.rb
index 39e806a472..3ff5e99b25 100644
--- a/spec/ruby/library/rexml/document/new_spec.rb
+++ b/spec/ruby/library/rexml/document/new_spec.rb
@@ -27,7 +27,7 @@ describe "REXML::Document#new" do
end
it "raises an error if source is not a Document, String or IO" do
- lambda {REXML::Document.new(3)}.should raise_error(RuntimeError)
+ -> {REXML::Document.new(3)}.should raise_error(RuntimeError)
end
it "does not perform XML validation" do
diff --git a/spec/ruby/library/rexml/text/new_spec.rb b/spec/ruby/library/rexml/text/new_spec.rb
index a1fdcddf28..3c081dec30 100644
--- a/spec/ruby/library/rexml/text/new_spec.rb
+++ b/spec/ruby/library/rexml/text/new_spec.rb
@@ -28,12 +28,12 @@ describe "REXML::Text.new" do
t = REXML::Text.new("&lt;&amp;&gt;", false, nil, true)
t.should == "&lt;&amp;&gt;"
- lambda{ REXML::Text.new("<&>", false, nil, true)}.should raise_error(Exception)
+ ->{ REXML::Text.new("<&>", false, nil, true)}.should raise_error(Exception)
end
it "uses raw value of the parent if raw is nil" do
e1 = REXML::Element.new("root", nil, { raw: :all})
- lambda {REXML::Text.new("<&>", false, e1)}.should raise_error(Exception)
+ -> {REXML::Text.new("<&>", false, e1)}.should raise_error(Exception)
e2 = REXML::Element.new("root", nil, { raw: []})
e2.raw.should be_false
diff --git a/spec/ruby/library/rexml/text/read_with_substitution_spec.rb b/spec/ruby/library/rexml/text/read_with_substitution_spec.rb
index a9b4d30bc5..83b42f6d6b 100644
--- a/spec/ruby/library/rexml/text/read_with_substitution_spec.rb
+++ b/spec/ruby/library/rexml/text/read_with_substitution_spec.rb
@@ -7,6 +7,6 @@ describe "REXML::Text.read_with_substitution" do
end
it "accepts an regex for invalid expressions and raises an error if text matches" do
- lambda {REXML::Text.read_with_substitution("this is illegal", /illegal/)}.should raise_error(Exception)
+ -> {REXML::Text.read_with_substitution("this is illegal", /illegal/)}.should raise_error(Exception)
end
end
diff --git a/spec/ruby/library/securerandom/base64_spec.rb b/spec/ruby/library/securerandom/base64_spec.rb
index c0ddbf85ce..34cd419ce2 100644
--- a/spec/ruby/library/securerandom/base64_spec.rb
+++ b/spec/ruby/library/securerandom/base64_spec.rb
@@ -42,7 +42,7 @@ describe "SecureRandom.base64" do
end
it "raises ArgumentError on negative arguments" do
- lambda {
+ -> {
SecureRandom.base64(-1)
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/securerandom/hex_spec.rb b/spec/ruby/library/securerandom/hex_spec.rb
index 525b4d1e35..bdb920b217 100644
--- a/spec/ruby/library/securerandom/hex_spec.rb
+++ b/spec/ruby/library/securerandom/hex_spec.rb
@@ -41,7 +41,7 @@ describe "SecureRandom.hex" do
end
it "raises ArgumentError on negative arguments" do
- lambda {
+ -> {
SecureRandom.hex(-1)
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/securerandom/random_bytes_spec.rb b/spec/ruby/library/securerandom/random_bytes_spec.rb
index 7ab949f5d4..275a897315 100644
--- a/spec/ruby/library/securerandom/random_bytes_spec.rb
+++ b/spec/ruby/library/securerandom/random_bytes_spec.rb
@@ -37,7 +37,7 @@ describe "SecureRandom.random_bytes" do
end
it "raises ArgumentError on negative arguments" do
- lambda {
+ -> {
SecureRandom.random_bytes(-1)
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/securerandom/random_number_spec.rb b/spec/ruby/library/securerandom/random_number_spec.rb
index 6b3279e6d7..3c86f55bf5 100644
--- a/spec/ruby/library/securerandom/random_number_spec.rb
+++ b/spec/ruby/library/securerandom/random_number_spec.rb
@@ -86,7 +86,7 @@ describe "SecureRandom.random_number" do
end
it "raises ArgumentError if the argument is non-numeric" do
- lambda {
+ -> {
SecureRandom.random_number(Object.new)
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/set/compare_by_identity_spec.rb b/spec/ruby/library/set/compare_by_identity_spec.rb
index 01b66ec92b..a6ad794ad3 100644
--- a/spec/ruby/library/set/compare_by_identity_spec.rb
+++ b/spec/ruby/library/set/compare_by_identity_spec.rb
@@ -93,7 +93,7 @@ describe "Set#compare_by_identity" do
it "raises a #{frozen_error_class} on frozen sets" do
set = Set.new.freeze
- lambda {
+ -> {
set.compare_by_identity
}.should raise_error(frozen_error_class, /frozen Hash/)
end
diff --git a/spec/ruby/library/set/exclusion_spec.rb b/spec/ruby/library/set/exclusion_spec.rb
index c9fa0e287e..5bc4b5a2bf 100644
--- a/spec/ruby/library/set/exclusion_spec.rb
+++ b/spec/ruby/library/set/exclusion_spec.rb
@@ -12,7 +12,7 @@ describe "Set#^" do
end
it "raises an ArgumentError when passed a non-Enumerable" do
- lambda { @set ^ 3 }.should raise_error(ArgumentError)
- lambda { @set ^ Object.new }.should raise_error(ArgumentError)
+ -> { @set ^ 3 }.should raise_error(ArgumentError)
+ -> { @set ^ Object.new }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/set/flatten_merge_spec.rb b/spec/ruby/library/set/flatten_merge_spec.rb
index b4494b13a7..f2c99a9481 100644
--- a/spec/ruby/library/set/flatten_merge_spec.rb
+++ b/spec/ruby/library/set/flatten_merge_spec.rb
@@ -18,6 +18,6 @@ describe "Set#flatten_merge" do
set2 = Set[5, 6, 7]
set2 << set2
- lambda { set1.send(:flatten_merge, set2) }.should raise_error(ArgumentError)
+ -> { set1.send(:flatten_merge, set2) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/set/flatten_spec.rb b/spec/ruby/library/set/flatten_spec.rb
index be94630f48..4ac83ea825 100644
--- a/spec/ruby/library/set/flatten_spec.rb
+++ b/spec/ruby/library/set/flatten_spec.rb
@@ -13,7 +13,7 @@ describe "Set#flatten" do
it "raises an ArgumentError when self is recursive" do
(set = Set[]) << set
- lambda { set.flatten }.should raise_error(ArgumentError)
+ -> { set.flatten }.should raise_error(ArgumentError)
end
context "when Set contains a Set-like object" do
@@ -42,7 +42,7 @@ describe "Set#flatten!" do
it "raises an ArgumentError when self is recursive" do
(set = Set[]) << set
- lambda { set.flatten! }.should raise_error(ArgumentError)
+ -> { set.flatten! }.should raise_error(ArgumentError)
end
context "when Set contains a Set-like object" do
diff --git a/spec/ruby/library/set/merge_spec.rb b/spec/ruby/library/set/merge_spec.rb
index 5c65af0a9b..a8e3ffc870 100644
--- a/spec/ruby/library/set/merge_spec.rb
+++ b/spec/ruby/library/set/merge_spec.rb
@@ -13,7 +13,7 @@ describe "Set#merge" do
end
it "raises an ArgumentError when passed a non-Enumerable" do
- lambda { Set[1, 2].merge(1) }.should raise_error(ArgumentError)
- lambda { Set[1, 2].merge(Object.new) }.should raise_error(ArgumentError)
+ -> { Set[1, 2].merge(1) }.should raise_error(ArgumentError)
+ -> { Set[1, 2].merge(Object.new) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/set/proper_subset_spec.rb b/spec/ruby/library/set/proper_subset_spec.rb
index 20c354b655..1f496a6199 100644
--- a/spec/ruby/library/set/proper_subset_spec.rb
+++ b/spec/ruby/library/set/proper_subset_spec.rb
@@ -27,10 +27,10 @@ describe "Set#proper_subset?" do
end
it "raises an ArgumentError when passed a non-Set" do
- lambda { Set[].proper_subset?([]) }.should raise_error(ArgumentError)
- lambda { Set[].proper_subset?(1) }.should raise_error(ArgumentError)
- lambda { Set[].proper_subset?("test") }.should raise_error(ArgumentError)
- lambda { Set[].proper_subset?(Object.new) }.should raise_error(ArgumentError)
+ -> { Set[].proper_subset?([]) }.should raise_error(ArgumentError)
+ -> { Set[].proper_subset?(1) }.should raise_error(ArgumentError)
+ -> { Set[].proper_subset?("test") }.should raise_error(ArgumentError)
+ -> { Set[].proper_subset?(Object.new) }.should raise_error(ArgumentError)
end
context "when comparing to a Set-like object" do
diff --git a/spec/ruby/library/set/proper_superset_spec.rb b/spec/ruby/library/set/proper_superset_spec.rb
index abc0e44f96..a386c8c097 100644
--- a/spec/ruby/library/set/proper_superset_spec.rb
+++ b/spec/ruby/library/set/proper_superset_spec.rb
@@ -27,10 +27,10 @@ describe "Set#proper_superset?" do
end
it "raises an ArgumentError when passed a non-Set" do
- lambda { Set[].proper_superset?([]) }.should raise_error(ArgumentError)
- lambda { Set[].proper_superset?(1) }.should raise_error(ArgumentError)
- lambda { Set[].proper_superset?("test") }.should raise_error(ArgumentError)
- lambda { Set[].proper_superset?(Object.new) }.should raise_error(ArgumentError)
+ -> { Set[].proper_superset?([]) }.should raise_error(ArgumentError)
+ -> { Set[].proper_superset?(1) }.should raise_error(ArgumentError)
+ -> { Set[].proper_superset?("test") }.should raise_error(ArgumentError)
+ -> { Set[].proper_superset?(Object.new) }.should raise_error(ArgumentError)
end
context "when comparing to a Set-like object" do
diff --git a/spec/ruby/library/set/shared/difference.rb b/spec/ruby/library/set/shared/difference.rb
index 52807709c3..f88987ed2a 100644
--- a/spec/ruby/library/set/shared/difference.rb
+++ b/spec/ruby/library/set/shared/difference.rb
@@ -9,7 +9,7 @@ describe :set_difference, shared: true do
end
it "raises an ArgumentError when passed a non-Enumerable" do
- lambda { @set.send(@method, 1) }.should raise_error(ArgumentError)
- lambda { @set.send(@method, Object.new) }.should raise_error(ArgumentError)
+ -> { @set.send(@method, 1) }.should raise_error(ArgumentError)
+ -> { @set.send(@method, Object.new) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/set/shared/intersection.rb b/spec/ruby/library/set/shared/intersection.rb
index ed0db7457d..5ae4199c94 100644
--- a/spec/ruby/library/set/shared/intersection.rb
+++ b/spec/ruby/library/set/shared/intersection.rb
@@ -9,7 +9,7 @@ describe :set_intersection, shared: true do
end
it "raises an ArgumentError when passed a non-Enumerable" do
- lambda { @set.send(@method, 1) }.should raise_error(ArgumentError)
- lambda { @set.send(@method, Object.new) }.should raise_error(ArgumentError)
+ -> { @set.send(@method, 1) }.should raise_error(ArgumentError)
+ -> { @set.send(@method, Object.new) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/set/shared/union.rb b/spec/ruby/library/set/shared/union.rb
index 81920f5687..314f0e852d 100644
--- a/spec/ruby/library/set/shared/union.rb
+++ b/spec/ruby/library/set/shared/union.rb
@@ -9,7 +9,7 @@ describe :set_union, shared: true do
end
it "raises an ArgumentError when passed a non-Enumerable" do
- lambda { @set.send(@method, 1) }.should raise_error(ArgumentError)
- lambda { @set.send(@method, Object.new) }.should raise_error(ArgumentError)
+ -> { @set.send(@method, 1) }.should raise_error(ArgumentError)
+ -> { @set.send(@method, Object.new) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/set/sortedset/add_spec.rb b/spec/ruby/library/set/sortedset/add_spec.rb
index 721ac7fac0..5f8bde02f5 100644
--- a/spec/ruby/library/set/sortedset/add_spec.rb
+++ b/spec/ruby/library/set/sortedset/add_spec.rb
@@ -8,13 +8,13 @@ describe "SortedSet#add" do
it "takes only values which responds <=>" do
obj = mock('no_comparison_operator')
obj.stub!(:respond_to?).with(:<=>).and_return(false)
- lambda { SortedSet["hello"].add(obj) }.should raise_error(ArgumentError)
+ -> { SortedSet["hello"].add(obj) }.should raise_error(ArgumentError)
end
it "raises on incompatible <=> comparison" do
# Use #to_a here as elements are sorted only when needed.
# Therefore the <=> incompatibility is only noticed on sorting.
- lambda { SortedSet['1', '2'].add(3).to_a }.should raise_error(ArgumentError)
+ -> { SortedSet['1', '2'].add(3).to_a }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/set/sortedset/exclusion_spec.rb b/spec/ruby/library/set/sortedset/exclusion_spec.rb
index 59f9f1dfd8..d0f1ab95cb 100644
--- a/spec/ruby/library/set/sortedset/exclusion_spec.rb
+++ b/spec/ruby/library/set/sortedset/exclusion_spec.rb
@@ -12,7 +12,7 @@ describe "SortedSet#^" do
end
it "raises an ArgumentError when passed a non-Enumerable" do
- lambda { @set ^ 3 }.should raise_error(ArgumentError)
- lambda { @set ^ Object.new }.should raise_error(ArgumentError)
+ -> { @set ^ 3 }.should raise_error(ArgumentError)
+ -> { @set ^ Object.new }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/set/sortedset/initialize_spec.rb b/spec/ruby/library/set/sortedset/initialize_spec.rb
index cdf756f6b8..1238f4efc4 100644
--- a/spec/ruby/library/set/sortedset/initialize_spec.rb
+++ b/spec/ruby/library/set/sortedset/initialize_spec.rb
@@ -25,6 +25,6 @@ describe "SortedSet#initialize" do
it "raises on incompatible <=> comparison" do
# Use #to_a here as elements are sorted only when needed.
# Therefore the <=> incompatibility is only noticed on sorting.
- lambda { SortedSet.new(['00', nil]).to_a }.should raise_error(ArgumentError)
+ -> { SortedSet.new(['00', nil]).to_a }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/set/sortedset/merge_spec.rb b/spec/ruby/library/set/sortedset/merge_spec.rb
index f98f2c83ce..31570ad4db 100644
--- a/spec/ruby/library/set/sortedset/merge_spec.rb
+++ b/spec/ruby/library/set/sortedset/merge_spec.rb
@@ -13,7 +13,7 @@ describe "SortedSet#merge" do
end
it "raises an ArgumentError when passed a non-Enumerable" do
- lambda { SortedSet[1, 2].merge(1) }.should raise_error(ArgumentError)
- lambda { SortedSet[1, 2].merge(Object.new) }.should raise_error(ArgumentError)
+ -> { SortedSet[1, 2].merge(1) }.should raise_error(ArgumentError)
+ -> { SortedSet[1, 2].merge(Object.new) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/set/sortedset/proper_subset_spec.rb b/spec/ruby/library/set/sortedset/proper_subset_spec.rb
index 3b3c2e5c4c..818173a7f9 100644
--- a/spec/ruby/library/set/sortedset/proper_subset_spec.rb
+++ b/spec/ruby/library/set/sortedset/proper_subset_spec.rb
@@ -25,9 +25,9 @@ describe "SortedSet#proper_subset?" do
end
it "raises an ArgumentError when passed a non-SortedSet" do
- lambda { SortedSet[].proper_subset?([]) }.should raise_error(ArgumentError)
- lambda { SortedSet[].proper_subset?(1) }.should raise_error(ArgumentError)
- lambda { SortedSet[].proper_subset?("test") }.should raise_error(ArgumentError)
- lambda { SortedSet[].proper_subset?(Object.new) }.should raise_error(ArgumentError)
+ -> { SortedSet[].proper_subset?([]) }.should raise_error(ArgumentError)
+ -> { SortedSet[].proper_subset?(1) }.should raise_error(ArgumentError)
+ -> { SortedSet[].proper_subset?("test") }.should raise_error(ArgumentError)
+ -> { SortedSet[].proper_subset?(Object.new) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/set/sortedset/proper_superset_spec.rb b/spec/ruby/library/set/sortedset/proper_superset_spec.rb
index 72ae71e2f1..2699290f0e 100644
--- a/spec/ruby/library/set/sortedset/proper_superset_spec.rb
+++ b/spec/ruby/library/set/sortedset/proper_superset_spec.rb
@@ -25,9 +25,9 @@ describe "SortedSet#proper_superset?" do
end
it "raises an ArgumentError when passed a non-SortedSet" do
- lambda { SortedSet[].proper_superset?([]) }.should raise_error(ArgumentError)
- lambda { SortedSet[].proper_superset?(1) }.should raise_error(ArgumentError)
- lambda { SortedSet[].proper_superset?("test") }.should raise_error(ArgumentError)
- lambda { SortedSet[].proper_superset?(Object.new) }.should raise_error(ArgumentError)
+ -> { SortedSet[].proper_superset?([]) }.should raise_error(ArgumentError)
+ -> { SortedSet[].proper_superset?(1) }.should raise_error(ArgumentError)
+ -> { SortedSet[].proper_superset?("test") }.should raise_error(ArgumentError)
+ -> { SortedSet[].proper_superset?(Object.new) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/set/sortedset/shared/difference.rb b/spec/ruby/library/set/sortedset/shared/difference.rb
index cf50ff0eb2..688e23a7a7 100644
--- a/spec/ruby/library/set/sortedset/shared/difference.rb
+++ b/spec/ruby/library/set/sortedset/shared/difference.rb
@@ -9,7 +9,7 @@ describe :sorted_set_difference, shared: true do
end
it "raises an ArgumentError when passed a non-Enumerable" do
- lambda { @set.send(@method, 1) }.should raise_error(ArgumentError)
- lambda { @set.send(@method, Object.new) }.should raise_error(ArgumentError)
+ -> { @set.send(@method, 1) }.should raise_error(ArgumentError)
+ -> { @set.send(@method, Object.new) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/set/sortedset/shared/intersection.rb b/spec/ruby/library/set/sortedset/shared/intersection.rb
index d3cfa96656..045716ad05 100644
--- a/spec/ruby/library/set/sortedset/shared/intersection.rb
+++ b/spec/ruby/library/set/sortedset/shared/intersection.rb
@@ -9,7 +9,7 @@ describe :sorted_set_intersection, shared: true do
end
it "raises an ArgumentError when passed a non-Enumerable" do
- lambda { @set.send(@method, 1) }.should raise_error(ArgumentError)
- lambda { @set.send(@method, Object.new) }.should raise_error(ArgumentError)
+ -> { @set.send(@method, 1) }.should raise_error(ArgumentError)
+ -> { @set.send(@method, Object.new) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/set/sortedset/shared/union.rb b/spec/ruby/library/set/sortedset/shared/union.rb
index 4ff07ef5cc..9015bdc8e3 100644
--- a/spec/ruby/library/set/sortedset/shared/union.rb
+++ b/spec/ruby/library/set/sortedset/shared/union.rb
@@ -9,7 +9,7 @@ describe :sorted_set_union, shared: true do
end
it "raises an ArgumentError when passed a non-Enumerable" do
- lambda { @set.send(@method, 1) }.should raise_error(ArgumentError)
- lambda { @set.send(@method, Object.new) }.should raise_error(ArgumentError)
+ -> { @set.send(@method, 1) }.should raise_error(ArgumentError)
+ -> { @set.send(@method, Object.new) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/set/sortedset/subset_spec.rb b/spec/ruby/library/set/sortedset/subset_spec.rb
index cdada2cdfb..7768692df6 100644
--- a/spec/ruby/library/set/sortedset/subset_spec.rb
+++ b/spec/ruby/library/set/sortedset/subset_spec.rb
@@ -25,9 +25,9 @@ describe "SortedSet#subset?" do
end
it "raises an ArgumentError when passed a non-SortedSet" do
- lambda { SortedSet[].subset?([]) }.should raise_error(ArgumentError)
- lambda { SortedSet[].subset?(1) }.should raise_error(ArgumentError)
- lambda { SortedSet[].subset?("test") }.should raise_error(ArgumentError)
- lambda { SortedSet[].subset?(Object.new) }.should raise_error(ArgumentError)
+ -> { SortedSet[].subset?([]) }.should raise_error(ArgumentError)
+ -> { SortedSet[].subset?(1) }.should raise_error(ArgumentError)
+ -> { SortedSet[].subset?("test") }.should raise_error(ArgumentError)
+ -> { SortedSet[].subset?(Object.new) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/set/sortedset/superset_spec.rb b/spec/ruby/library/set/sortedset/superset_spec.rb
index 663b179a0c..823781b860 100644
--- a/spec/ruby/library/set/sortedset/superset_spec.rb
+++ b/spec/ruby/library/set/sortedset/superset_spec.rb
@@ -25,9 +25,9 @@ describe "SortedSet#superset?" do
end
it "raises an ArgumentError when passed a non-SortedSet" do
- lambda { SortedSet[].superset?([]) }.should raise_error(ArgumentError)
- lambda { SortedSet[].superset?(1) }.should raise_error(ArgumentError)
- lambda { SortedSet[].superset?("test") }.should raise_error(ArgumentError)
- lambda { SortedSet[].superset?(Object.new) }.should raise_error(ArgumentError)
+ -> { SortedSet[].superset?([]) }.should raise_error(ArgumentError)
+ -> { SortedSet[].superset?(1) }.should raise_error(ArgumentError)
+ -> { SortedSet[].superset?("test") }.should raise_error(ArgumentError)
+ -> { SortedSet[].superset?(Object.new) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/set/subset_spec.rb b/spec/ruby/library/set/subset_spec.rb
index a1aed45ad0..f375efa6df 100644
--- a/spec/ruby/library/set/subset_spec.rb
+++ b/spec/ruby/library/set/subset_spec.rb
@@ -27,10 +27,10 @@ describe "Set#subset?" do
end
it "raises an ArgumentError when passed a non-Set" do
- lambda { Set[].subset?([]) }.should raise_error(ArgumentError)
- lambda { Set[].subset?(1) }.should raise_error(ArgumentError)
- lambda { Set[].subset?("test") }.should raise_error(ArgumentError)
- lambda { Set[].subset?(Object.new) }.should raise_error(ArgumentError)
+ -> { Set[].subset?([]) }.should raise_error(ArgumentError)
+ -> { Set[].subset?(1) }.should raise_error(ArgumentError)
+ -> { Set[].subset?("test") }.should raise_error(ArgumentError)
+ -> { Set[].subset?(Object.new) }.should raise_error(ArgumentError)
end
context "when comparing to a Set-like object" do
diff --git a/spec/ruby/library/set/superset_spec.rb b/spec/ruby/library/set/superset_spec.rb
index 1336975a9b..bd9d2f3eee 100644
--- a/spec/ruby/library/set/superset_spec.rb
+++ b/spec/ruby/library/set/superset_spec.rb
@@ -27,10 +27,10 @@ describe "Set#superset?" do
end
it "raises an ArgumentError when passed a non-Set" do
- lambda { Set[].superset?([]) }.should raise_error(ArgumentError)
- lambda { Set[].superset?(1) }.should raise_error(ArgumentError)
- lambda { Set[].superset?("test") }.should raise_error(ArgumentError)
- lambda { Set[].superset?(Object.new) }.should raise_error(ArgumentError)
+ -> { Set[].superset?([]) }.should raise_error(ArgumentError)
+ -> { Set[].superset?(1) }.should raise_error(ArgumentError)
+ -> { Set[].superset?("test") }.should raise_error(ArgumentError)
+ -> { Set[].superset?(Object.new) }.should raise_error(ArgumentError)
end
context "when comparing to a Set-like object" do
diff --git a/spec/ruby/library/shellwords/shellwords_spec.rb b/spec/ruby/library/shellwords/shellwords_spec.rb
index bb6bcb3d30..2975fd9974 100644
--- a/spec/ruby/library/shellwords/shellwords_spec.rb
+++ b/spec/ruby/library/shellwords/shellwords_spec.rb
@@ -20,11 +20,11 @@ describe "Shellwords#shellwords" do
end
it "raises ArgumentError when double quoted strings are misquoted" do
- lambda { shellwords('a "b c d e') }.should raise_error(ArgumentError)
+ -> { shellwords('a "b c d e') }.should raise_error(ArgumentError)
end
it "raises ArgumentError when single quoted strings are misquoted" do
- lambda { shellwords("a 'b c d e") }.should raise_error(ArgumentError)
+ -> { shellwords("a 'b c d e") }.should raise_error(ArgumentError)
end
# https://bugs.ruby-lang.org/issues/10055
diff --git a/spec/ruby/library/singleton/allocate_spec.rb b/spec/ruby/library/singleton/allocate_spec.rb
index 689ecc57c6..6a1512d53b 100644
--- a/spec/ruby/library/singleton/allocate_spec.rb
+++ b/spec/ruby/library/singleton/allocate_spec.rb
@@ -3,6 +3,6 @@ require_relative 'fixtures/classes'
describe "Singleton.allocate" do
it "is a private method" do
- lambda { SingletonSpecs::MyClass.allocate }.should raise_error(NoMethodError)
+ -> { SingletonSpecs::MyClass.allocate }.should raise_error(NoMethodError)
end
end
diff --git a/spec/ruby/library/singleton/clone_spec.rb b/spec/ruby/library/singleton/clone_spec.rb
index 7392d7ff6e..3635bcd594 100644
--- a/spec/ruby/library/singleton/clone_spec.rb
+++ b/spec/ruby/library/singleton/clone_spec.rb
@@ -3,6 +3,6 @@ require_relative 'fixtures/classes'
describe "Singleton#clone" do
it "is prevented" do
- lambda { SingletonSpecs::MyClass.instance.clone }.should raise_error(TypeError)
+ -> { SingletonSpecs::MyClass.instance.clone }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/singleton/dup_spec.rb b/spec/ruby/library/singleton/dup_spec.rb
index c5c02a0357..13d5a213e9 100644
--- a/spec/ruby/library/singleton/dup_spec.rb
+++ b/spec/ruby/library/singleton/dup_spec.rb
@@ -3,6 +3,6 @@ require_relative 'fixtures/classes'
describe "Singleton#dup" do
it "is prevented" do
- lambda { SingletonSpecs::MyClass.instance.dup }.should raise_error(TypeError)
+ -> { SingletonSpecs::MyClass.instance.dup }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/singleton/new_spec.rb b/spec/ruby/library/singleton/new_spec.rb
index babd50fbc3..2f45db819c 100644
--- a/spec/ruby/library/singleton/new_spec.rb
+++ b/spec/ruby/library/singleton/new_spec.rb
@@ -3,6 +3,6 @@ require_relative 'fixtures/classes'
describe "Singleton.new" do
it "is a private method" do
- lambda { SingletonSpecs::NewSpec.new }.should raise_error(NoMethodError)
+ -> { SingletonSpecs::NewSpec.new }.should raise_error(NoMethodError)
end
end
diff --git a/spec/ruby/library/socket/addrinfo/family_addrinfo_spec.rb b/spec/ruby/library/socket/addrinfo/family_addrinfo_spec.rb
index d3419daaaf..2bc3b6a2e3 100644
--- a/spec/ruby/library/socket/addrinfo/family_addrinfo_spec.rb
+++ b/spec/ruby/library/socket/addrinfo/family_addrinfo_spec.rb
@@ -4,7 +4,7 @@ describe 'Addrinfo#family_addrinfo' do
it 'raises ArgumentError if no arguments are given' do
addr = Addrinfo.tcp('127.0.0.1', 0)
- lambda { addr.family_addrinfo }.should raise_error(ArgumentError)
+ -> { addr.family_addrinfo }.should raise_error(ArgumentError)
end
describe 'using multiple arguments' do
@@ -14,11 +14,11 @@ describe 'Addrinfo#family_addrinfo' do
end
it 'raises ArgumentError if only 1 argument is given' do
- lambda { @source.family_addrinfo('127.0.0.1') }.should raise_error(ArgumentError)
+ -> { @source.family_addrinfo('127.0.0.1') }.should raise_error(ArgumentError)
end
it 'raises ArgumentError if more than 2 arguments are given' do
- lambda { @source.family_addrinfo('127.0.0.1', 0, 666) }.should raise_error(ArgumentError)
+ -> { @source.family_addrinfo('127.0.0.1', 0, 666) }.should raise_error(ArgumentError)
end
it 'returns an Addrinfo when a host and port are given' do
@@ -57,7 +57,7 @@ describe 'Addrinfo#family_addrinfo' do
end
it 'raises ArgumentError if more than 1 argument is given' do
- lambda { @source.family_addrinfo('foo', 'bar') }.should raise_error(ArgumentError)
+ -> { @source.family_addrinfo('foo', 'bar') }.should raise_error(ArgumentError)
end
it 'returns an Addrinfo when a UNIX socket path is given' do
@@ -99,17 +99,17 @@ describe 'Addrinfo#family_addrinfo' do
it 'raises ArgumentError if more than 1 argument is given' do
input = Addrinfo.tcp('127.0.0.2', 0)
- lambda { @source.family_addrinfo(input, 666) }.should raise_error(ArgumentError)
+ -> { @source.family_addrinfo(input, 666) }.should raise_error(ArgumentError)
end
it "raises ArgumentError if the protocol families don't match" do
input = Addrinfo.tcp('::1', 0)
- lambda { @source.family_addrinfo(input) }.should raise_error(ArgumentError)
+ -> { @source.family_addrinfo(input) }.should raise_error(ArgumentError)
end
it "raises ArgumentError if the socket types don't match" do
input = Addrinfo.udp('127.0.0.1', 0)
- lambda { @source.family_addrinfo(input) }.should raise_error(ArgumentError)
+ -> { @source.family_addrinfo(input) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/library/socket/addrinfo/initialize_spec.rb b/spec/ruby/library/socket/addrinfo/initialize_spec.rb
index 460fc28d49..8354553f61 100644
--- a/spec/ruby/library/socket/addrinfo/initialize_spec.rb
+++ b/spec/ruby/library/socket/addrinfo/initialize_spec.rb
@@ -198,7 +198,7 @@ describe "Addrinfo#initialize" do
describe 'with an invalid IP address' do
it 'raises SocketError' do
- block = lambda { Addrinfo.new(['AF_INET6', 80, 'hostname', '127.0.0.1']) }
+ block = -> { Addrinfo.new(['AF_INET6', 80, 'hostname', '127.0.0.1']) }
block.should raise_error(SocketError)
end
@@ -290,7 +290,7 @@ describe "Addrinfo#initialize" do
it "raises SocketError when using SOCK_RDM" do
sockaddr = ['AF_INET', 80, 'hostname', '127.0.0.1']
value = Socket::SOCK_RDM
- block = lambda { Addrinfo.new(sockaddr, nil, value) }
+ block = -> { Addrinfo.new(sockaddr, nil, value) }
block.should raise_error(SocketError)
end
@@ -364,7 +364,7 @@ describe "Addrinfo#initialize" do
(Socket.constants.grep(/^IPPROTO/) - valid).each do |type|
it "raises SocketError when using #{type}" do
value = Socket.const_get(type)
- block = lambda { Addrinfo.new(@sockaddr, nil, nil, value) }
+ block = -> { Addrinfo.new(@sockaddr, nil, nil, value) }
block.should raise_error(SocketError)
end
@@ -392,7 +392,7 @@ describe "Addrinfo#initialize" do
(Socket.constants.grep(/^IPPROTO/) - valid).each do |type|
it "raises SocketError when using #{type}" do
value = Socket.const_get(type)
- block = lambda { Addrinfo.new(@sockaddr, nil, @socktype, value) }
+ block = -> { Addrinfo.new(@sockaddr, nil, @socktype, value) }
block.should raise_error(SocketError)
end
@@ -409,7 +409,7 @@ describe "Addrinfo#initialize" do
Socket.constants.grep(/^IPPROTO/).each do |type|
it "raises SocketError when using #{type}" do
value = Socket.const_get(type)
- block = lambda { Addrinfo.new(@sockaddr, nil, @socktype, value) }
+ block = -> { Addrinfo.new(@sockaddr, nil, @socktype, value) }
block.should raise_error(SocketError)
end
@@ -440,7 +440,7 @@ describe "Addrinfo#initialize" do
Socket.constants.grep(/^IPPROTO/).each do |type|
it "raises SocketError when using #{type}" do
value = Socket.const_get(type)
- block = lambda { Addrinfo.new(@sockaddr, nil, @socktype, value) }
+ block = -> { Addrinfo.new(@sockaddr, nil, @socktype, value) }
block.should raise_error(SocketError)
end
@@ -467,7 +467,7 @@ describe "Addrinfo#initialize" do
(Socket.constants.grep(/^IPPROTO/) - valid).each do |type|
it "raises SocketError when using #{type}" do
value = Socket.const_get(type)
- block = lambda { Addrinfo.new(@sockaddr, nil, @socktype, value) }
+ block = -> { Addrinfo.new(@sockaddr, nil, @socktype, value) }
block.should raise_error(SocketError)
end
@@ -495,7 +495,7 @@ describe "Addrinfo#initialize" do
(Socket.constants.grep(/^IPPROTO/) - valid).each do |type|
it "raises SocketError when using #{type}" do
value = Socket.const_get(type)
- block = lambda { Addrinfo.new(@sockaddr, nil, @socktype, value) }
+ block = -> { Addrinfo.new(@sockaddr, nil, @socktype, value) }
block.should raise_error(SocketError)
end
diff --git a/spec/ruby/library/socket/addrinfo/ip_address_spec.rb b/spec/ruby/library/socket/addrinfo/ip_address_spec.rb
index d53c00267a..4522cf5cfd 100644
--- a/spec/ruby/library/socket/addrinfo/ip_address_spec.rb
+++ b/spec/ruby/library/socket/addrinfo/ip_address_spec.rb
@@ -28,7 +28,7 @@ describe "Addrinfo#ip_address" do
end
it "raises an exception" do
- lambda { @addrinfo.ip_address }.should raise_error(SocketError)
+ -> { @addrinfo.ip_address }.should raise_error(SocketError)
end
end
end
diff --git a/spec/ruby/library/socket/addrinfo/ip_port_spec.rb b/spec/ruby/library/socket/addrinfo/ip_port_spec.rb
index 6cf9e7a18e..4118607db0 100644
--- a/spec/ruby/library/socket/addrinfo/ip_port_spec.rb
+++ b/spec/ruby/library/socket/addrinfo/ip_port_spec.rb
@@ -28,7 +28,7 @@ describe "Addrinfo#ip_port" do
end
it "raises an exception" do
- lambda { @addrinfo.ip_port }.should raise_error(SocketError)
+ -> { @addrinfo.ip_port }.should raise_error(SocketError)
end
end
end
diff --git a/spec/ruby/library/socket/addrinfo/ip_unpack_spec.rb b/spec/ruby/library/socket/addrinfo/ip_unpack_spec.rb
index 57ae79a6c8..6c81c48d1c 100644
--- a/spec/ruby/library/socket/addrinfo/ip_unpack_spec.rb
+++ b/spec/ruby/library/socket/addrinfo/ip_unpack_spec.rb
@@ -28,7 +28,7 @@ describe "Addrinfo#ip_unpack" do
end
it "raises an exception" do
- lambda { @addrinfo.ip_unpack }.should raise_error(SocketError)
+ -> { @addrinfo.ip_unpack }.should raise_error(SocketError)
end
end
end
diff --git a/spec/ruby/library/socket/addrinfo/unix_path_spec.rb b/spec/ruby/library/socket/addrinfo/unix_path_spec.rb
index 0f25881724..6bfb56a4ac 100644
--- a/spec/ruby/library/socket/addrinfo/unix_path_spec.rb
+++ b/spec/ruby/library/socket/addrinfo/unix_path_spec.rb
@@ -9,7 +9,7 @@ with_feature :unix_socket do
end
it "raises an exception" do
- lambda { @addrinfo.unix_path }.should raise_error(SocketError)
+ -> { @addrinfo.unix_path }.should raise_error(SocketError)
end
end
@@ -20,7 +20,7 @@ with_feature :unix_socket do
end
it "raises an exception" do
- lambda { @addrinfo.unix_path }.should raise_error(SocketError)
+ -> { @addrinfo.unix_path }.should raise_error(SocketError)
end
end
diff --git a/spec/ruby/library/socket/ancillarydata/cmsg_is_spec.rb b/spec/ruby/library/socket/ancillarydata/cmsg_is_spec.rb
index 50763e28b1..c54ee29825 100644
--- a/spec/ruby/library/socket/ancillarydata/cmsg_is_spec.rb
+++ b/spec/ruby/library/socket/ancillarydata/cmsg_is_spec.rb
@@ -26,7 +26,7 @@ with_feature :ancillary_data do
end
it 'raises SocketError when comparing with :IPV6 and :RIGHTS' do
- lambda { @data.cmsg_is?(:IPV6, :RIGHTS) }.should raise_error(SocketError)
+ -> { @data.cmsg_is?(:IPV6, :RIGHTS) }.should raise_error(SocketError)
end
end
end
diff --git a/spec/ruby/library/socket/ancillarydata/initialize_spec.rb b/spec/ruby/library/socket/ancillarydata/initialize_spec.rb
index d4788d0f68..344d1485c5 100644
--- a/spec/ruby/library/socket/ancillarydata/initialize_spec.rb
+++ b/spec/ruby/library/socket/ancillarydata/initialize_spec.rb
@@ -113,25 +113,25 @@ with_feature :ancillary_data do
end
it 'raises TypeError when using a numeric string as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :IGMP, Socket::SCM_RIGHTS.to_s, '')
}.should raise_error(TypeError)
end
it 'raises SocketError when using :RECVTTL as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :SOCKET, :RECVTTL, '')
}.should raise_error(SocketError)
end
it 'raises SocketError when using :MOO as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :SOCKET, :MOO, '')
}.should raise_error(SocketError)
end
it 'raises SocketError when using :IP_RECVTTL as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :SOCKET, :IP_RECVTTL, '')
}.should raise_error(SocketError)
end
@@ -155,13 +155,13 @@ with_feature :ancillary_data do
end
it 'raises SocketError when using :RIGHTS as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :IP, :RIGHTS, '')
}.should raise_error(SocketError)
end
it 'raises SocketError when using :MOO as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :IP, :MOO, '')
}.should raise_error(SocketError)
end
@@ -179,13 +179,13 @@ with_feature :ancillary_data do
end
it 'raises SocketError when using :RIGHTS as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :IPV6, :RIGHTS, '')
}.should raise_error(SocketError)
end
it 'raises SocketError when using :MOO as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :IPV6, :MOO, '')
}.should raise_error(SocketError)
end
@@ -205,13 +205,13 @@ with_feature :ancillary_data do
end
it 'raises SocketError when using :RIGHTS as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :TCP, :RIGHTS, '')
}.should raise_error(SocketError)
end
it 'raises SocketError when using :MOO as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :TCP, :MOO, '')
}.should raise_error(SocketError)
end
@@ -225,13 +225,13 @@ with_feature :ancillary_data do
end
it 'raises SocketError when using :RIGHTS as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :UDP, :RIGHTS, '')
}.should raise_error(SocketError)
end
it 'raises SocketError when using :MOO as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :UDP, :MOO, '')
}.should raise_error(SocketError)
end
@@ -243,7 +243,7 @@ with_feature :ancillary_data do
end
it 'raises SocketError when using :CORK sa the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:UNIX, :SOCKET, :CORK, '')
}.should raise_error(SocketError)
end
@@ -251,7 +251,7 @@ with_feature :ancillary_data do
describe 'using :AF_UNIX as the family and :IP as the level' do
it 'raises SocketError' do
- lambda {
+ -> {
Socket::AncillaryData.new(:UNIX, :IP, :RECVTTL, '')
}.should raise_error(SocketError)
end
@@ -259,7 +259,7 @@ with_feature :ancillary_data do
describe 'using :AF_UNIX as the family and :IPV6 as the level' do
it 'raises SocketError' do
- lambda {
+ -> {
Socket::AncillaryData.new(:UNIX, :IPV6, :NEXTHOP, '')
}.should raise_error(SocketError)
end
@@ -267,7 +267,7 @@ with_feature :ancillary_data do
describe 'using :AF_UNIX as the family and :TCP as the level' do
it 'raises SocketError' do
- lambda {
+ -> {
Socket::AncillaryData.new(:UNIX, :TCP, :CORK, '')
}.should raise_error(SocketError)
end
@@ -275,7 +275,7 @@ with_feature :ancillary_data do
describe 'using :AF_UNIX as the family and :UDP as the level' do
it 'raises SocketError' do
- lambda {
+ -> {
Socket::AncillaryData.new(:UNIX, :UDP, :CORK, '')
}.should raise_error(SocketError)
end
diff --git a/spec/ruby/library/socket/ancillarydata/int_spec.rb b/spec/ruby/library/socket/ancillarydata/int_spec.rb
index 0d7c5e3652..fe41a30a1a 100644
--- a/spec/ruby/library/socket/ancillarydata/int_spec.rb
+++ b/spec/ruby/library/socket/ancillarydata/int_spec.rb
@@ -37,7 +37,7 @@ with_feature :ancillary_data do
it 'raises when the data is not an Integer' do
data = Socket::AncillaryData.new(:UNIX, :SOCKET, :RIGHTS, 'ugh')
- lambda { data.int }.should raise_error(TypeError)
+ -> { data.int }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/library/socket/ancillarydata/ip_pktinfo_spec.rb b/spec/ruby/library/socket/ancillarydata/ip_pktinfo_spec.rb
index 9fc4e8c201..84910a038a 100644
--- a/spec/ruby/library/socket/ancillarydata/ip_pktinfo_spec.rb
+++ b/spec/ruby/library/socket/ancillarydata/ip_pktinfo_spec.rb
@@ -89,7 +89,7 @@ with_feature :ancillary_data, :pktinfo do
end
it 'is not the same object as the input Addrinfo' do
- @addr.should_not.equal? @source
+ @addr.should_not equal @source
end
end
@@ -109,7 +109,7 @@ with_feature :ancillary_data, :pktinfo do
end
it 'is not the same object as the input Addrinfo' do
- @addr.should_not.equal? @dest
+ @addr.should_not equal @dest
end
end
end
diff --git a/spec/ruby/library/socket/ancillarydata/ipv6_pktinfo_spec.rb b/spec/ruby/library/socket/ancillarydata/ipv6_pktinfo_spec.rb
index 6f576f5169..0fffc720dc 100644
--- a/spec/ruby/library/socket/ancillarydata/ipv6_pktinfo_spec.rb
+++ b/spec/ruby/library/socket/ancillarydata/ipv6_pktinfo_spec.rb
@@ -58,7 +58,7 @@ with_feature :ancillary_data, :ipv6_pktinfo do
end
it 'is not the same object as the input Addrinfo' do
- @addr.should_not.equal? @source
+ @addr.should_not equal @source
end
end
diff --git a/spec/ruby/library/socket/ancillarydata/unix_rights_spec.rb b/spec/ruby/library/socket/ancillarydata/unix_rights_spec.rb
index 34d954af81..65ffcb01af 100644
--- a/spec/ruby/library/socket/ancillarydata/unix_rights_spec.rb
+++ b/spec/ruby/library/socket/ancillarydata/unix_rights_spec.rb
@@ -26,7 +26,7 @@ with_feature :ancillary_data do
describe 'using non IO objects' do
it 'raises TypeError' do
- lambda { Socket::AncillaryData.unix_rights(10) }.should raise_error(TypeError)
+ -> { Socket::AncillaryData.unix_rights(10) }.should raise_error(TypeError)
end
end
end
@@ -47,14 +47,14 @@ with_feature :ancillary_data do
it 'raises TypeError when the level is not SOL_SOCKET' do
data = Socket::AncillaryData.new(:INET, :IP, :RECVTTL, '')
- lambda { data.unix_rights }.should raise_error(TypeError)
+ -> { data.unix_rights }.should raise_error(TypeError)
end
platform_is_not :"solaris2.10", :aix do
it 'raises TypeError when the type is not SCM_RIGHTS' do
data = Socket::AncillaryData.new(:INET, :SOCKET, :TIMESTAMP, '')
- lambda { data.unix_rights }.should raise_error(TypeError)
+ -> { data.unix_rights }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/library/socket/basicsocket/close_read_spec.rb b/spec/ruby/library/socket/basicsocket/close_read_spec.rb
index c989fcaf72..f317b34955 100644
--- a/spec/ruby/library/socket/basicsocket/close_read_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/close_read_spec.rb
@@ -12,13 +12,13 @@ describe "Socket::BasicSocket#close_read" do
it "closes the reading end of the socket" do
@server.close_read
- lambda { @server.read }.should raise_error(IOError)
+ -> { @server.read }.should raise_error(IOError)
end
it 'does not raise when called on a socket already closed for reading' do
@server.close_read
@server.close_read
- lambda { @server.read }.should raise_error(IOError)
+ -> { @server.read }.should raise_error(IOError)
end
it 'does not fully close the socket' do
@@ -34,7 +34,7 @@ describe "Socket::BasicSocket#close_read" do
it 'raises IOError when called on a fully closed socket' do
@server.close
- lambda { @server.close_read }.should raise_error(IOError)
+ -> { @server.close_read }.should raise_error(IOError)
end
it "returns nil" do
diff --git a/spec/ruby/library/socket/basicsocket/close_write_spec.rb b/spec/ruby/library/socket/basicsocket/close_write_spec.rb
index f37e0e5074..232cfbb7c6 100644
--- a/spec/ruby/library/socket/basicsocket/close_write_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/close_write_spec.rb
@@ -12,13 +12,13 @@ describe "Socket::BasicSocket#close_write" do
it "closes the writing end of the socket" do
@server.close_write
- lambda { @server.write("foo") }.should raise_error(IOError)
+ -> { @server.write("foo") }.should raise_error(IOError)
end
it 'does not raise when called on a socket already closed for writing' do
@server.close_write
@server.close_write
- lambda { @server.write("foo") }.should raise_error(IOError)
+ -> { @server.write("foo") }.should raise_error(IOError)
end
it 'does not fully close the socket' do
@@ -39,7 +39,7 @@ describe "Socket::BasicSocket#close_write" do
it 'raises IOError when called on a fully closed socket' do
@server.close
- lambda { @server.close_write }.should raise_error(IOError)
+ -> { @server.close_write }.should raise_error(IOError)
end
it "returns nil" do
diff --git a/spec/ruby/library/socket/basicsocket/connect_address_spec.rb b/spec/ruby/library/socket/basicsocket/connect_address_spec.rb
index 18baac7f17..1a1c9982d9 100644
--- a/spec/ruby/library/socket/basicsocket/connect_address_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/connect_address_spec.rb
@@ -10,7 +10,7 @@ describe 'Socket#connect_address' do
it 'raises SocketError' do
@sock = Socket.new(:INET, :STREAM)
- lambda { @sock.connect_address }.should raise_error(SocketError)
+ -> { @sock.connect_address }.should raise_error(SocketError)
end
end
@@ -110,7 +110,7 @@ describe 'Socket#connect_address' do
end
it 'raises SocketError' do
- lambda { @client.connect_address }.should raise_error(SocketError)
+ -> { @client.connect_address }.should raise_error(SocketError)
end
end
end
diff --git a/spec/ruby/library/socket/basicsocket/getpeereid_spec.rb b/spec/ruby/library/socket/basicsocket/getpeereid_spec.rb
index 9eeb6d0e0b..6179211d96 100644
--- a/spec/ruby/library/socket/basicsocket/getpeereid_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/getpeereid_spec.rb
@@ -30,7 +30,7 @@ describe 'BasicSocket#getpeereid' do
it 'raises NoMethodError' do
@sock = TCPServer.new('127.0.0.1', 0)
- lambda { @sock.getpeereid }.should raise_error(NoMethodError)
+ -> { @sock.getpeereid }.should raise_error(NoMethodError)
end
end
end
diff --git a/spec/ruby/library/socket/basicsocket/getpeername_spec.rb b/spec/ruby/library/socket/basicsocket/getpeername_spec.rb
index 23c73056cd..0b93f02eef 100644
--- a/spec/ruby/library/socket/basicsocket/getpeername_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/getpeername_spec.rb
@@ -20,6 +20,6 @@ describe "Socket::BasicSocket#getpeername" do
end
it 'raises Errno::ENOTCONN for a disconnected socket' do
- lambda { @server.getpeername }.should raise_error(Errno::ENOTCONN)
+ -> { @server.getpeername }.should raise_error(Errno::ENOTCONN)
end
end
diff --git a/spec/ruby/library/socket/basicsocket/getsockopt_spec.rb b/spec/ruby/library/socket/basicsocket/getsockopt_spec.rb
index aad21ca535..ce65d6c92b 100644
--- a/spec/ruby/library/socket/basicsocket/getsockopt_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/getsockopt_spec.rb
@@ -41,7 +41,7 @@ describe "BasicSocket#getsockopt" do
end
it "raises a SystemCallError with an invalid socket option" do
- lambda { @sock.getsockopt Socket::SOL_SOCKET, -1 }.should raise_error(Errno::ENOPROTOOPT)
+ -> { @sock.getsockopt Socket::SOL_SOCKET, -1 }.should raise_error(Errno::ENOPROTOOPT)
end
it 'returns a Socket::Option using a constant' do
@@ -69,7 +69,7 @@ describe "BasicSocket#getsockopt" do
end
it 'raises Errno::ENOPROTOOPT when requesting an invalid option' do
- lambda { @sock.getsockopt(Socket::SOL_SOCKET, -1) }.should raise_error(Errno::ENOPROTOOPT)
+ -> { @sock.getsockopt(Socket::SOL_SOCKET, -1) }.should raise_error(Errno::ENOPROTOOPT)
end
describe 'using Symbols as arguments' do
diff --git a/spec/ruby/library/socket/basicsocket/recv_nonblock_spec.rb b/spec/ruby/library/socket/basicsocket/recv_nonblock_spec.rb
index 26683b3d23..0363f2f8de 100644
--- a/spec/ruby/library/socket/basicsocket/recv_nonblock_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/recv_nonblock_spec.rb
@@ -16,14 +16,14 @@ describe "Socket::BasicSocket#recv_nonblock" do
platform_is_not :windows do
describe 'using an unbound socket' do
it 'raises an exception extending IO::WaitReadable' do
- lambda { @s1.recv_nonblock(1) }.should raise_error(IO::WaitReadable)
+ -> { @s1.recv_nonblock(1) }.should raise_error(IO::WaitReadable)
end
end
end
it "raises an exception extending IO::WaitReadable if there's no data available" do
@s1.bind(Socket.pack_sockaddr_in(0, ip_address))
- lambda {
+ -> {
@s1.recv_nonblock(5)
}.should raise_error(IO::WaitReadable) { |e|
platform_is_not :windows do
@@ -62,7 +62,7 @@ describe "Socket::BasicSocket#recv_nonblock" do
@s2.send("a", 0, @s1.getsockname)
IO.select([@s1], nil, nil, 2)
@s1.recv_nonblock(1).should == "a"
- lambda {
+ -> {
@s1.recv_nonblock(5)
}.should raise_error(IO::WaitReadable)
end
diff --git a/spec/ruby/library/socket/basicsocket/recv_spec.rb b/spec/ruby/library/socket/basicsocket/recv_spec.rb
index a277dc2d97..b6ccda5d00 100644
--- a/spec/ruby/library/socket/basicsocket/recv_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/recv_spec.rb
@@ -107,7 +107,7 @@ describe 'BasicSocket#recv' do
describe 'using an unbound socket' do
it 'blocks the caller' do
- lambda { @server.recv(4) }.should block_caller
+ -> { @server.recv(4) }.should block_caller
end
end
@@ -118,7 +118,7 @@ describe 'BasicSocket#recv' do
describe 'without any data available' do
it 'blocks the caller' do
- lambda { @server.recv(4) }.should block_caller
+ -> { @server.recv(4) }.should block_caller
end
end
@@ -144,7 +144,7 @@ describe 'BasicSocket#recv' do
@server.recv(2).should == 'he'
- lambda { @server.recv(4) }.should block_caller
+ -> { @server.recv(4) }.should block_caller
end
it 'takes a peek at the data when using the MSG_PEEK flag' do
diff --git a/spec/ruby/library/socket/basicsocket/recvmsg_nonblock_spec.rb b/spec/ruby/library/socket/basicsocket/recvmsg_nonblock_spec.rb
index c440bac8bf..8e6c232c59 100644
--- a/spec/ruby/library/socket/basicsocket/recvmsg_nonblock_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/recvmsg_nonblock_spec.rb
@@ -17,7 +17,7 @@ describe 'BasicSocket#recvmsg_nonblock' do
platform_is_not :windows do
describe 'using an unbound socket' do
it 'raises an exception extending IO::WaitReadable' do
- lambda { @server.recvmsg_nonblock }.should raise_error(IO::WaitReadable)
+ -> { @server.recvmsg_nonblock }.should raise_error(IO::WaitReadable)
end
end
end
@@ -29,7 +29,7 @@ describe 'BasicSocket#recvmsg_nonblock' do
describe 'without any data available' do
it 'raises an exception extending IO::WaitReadable' do
- lambda { @server.recvmsg_nonblock }.should raise_error(IO::WaitReadable)
+ -> { @server.recvmsg_nonblock }.should raise_error(IO::WaitReadable)
end
it 'returns :wait_readable with exception: false' do
@@ -132,7 +132,7 @@ describe 'BasicSocket#recvmsg_nonblock' do
describe 'without any data available' do
it 'raises IO::WaitReadable' do
- lambda {
+ -> {
socket, _ = @server.accept
begin
socket.recvmsg_nonblock
@@ -182,7 +182,7 @@ describe 'BasicSocket#recvmsg_nonblock' do
end
it 'raises when receiving the ip_address message' do
- lambda { @addr.ip_address }.should raise_error(SocketError)
+ -> { @addr.ip_address }.should raise_error(SocketError)
end
it 'uses the correct address family' do
@@ -198,7 +198,7 @@ describe 'BasicSocket#recvmsg_nonblock' do
end
it 'raises when receiving the ip_port message' do
- lambda { @addr.ip_port }.should raise_error(SocketError)
+ -> { @addr.ip_port }.should raise_error(SocketError)
end
end
end
diff --git a/spec/ruby/library/socket/basicsocket/recvmsg_spec.rb b/spec/ruby/library/socket/basicsocket/recvmsg_spec.rb
index 58eb8d0360..8063723701 100644
--- a/spec/ruby/library/socket/basicsocket/recvmsg_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/recvmsg_spec.rb
@@ -17,7 +17,7 @@ describe 'BasicSocket#recvmsg' do
platform_is_not :windows do
describe 'using an unbound socket' do
it 'blocks the caller' do
- lambda { @server.recvmsg }.should block_caller
+ -> { @server.recvmsg }.should block_caller
end
end
end
@@ -29,7 +29,7 @@ describe 'BasicSocket#recvmsg' do
describe 'without any data available' do
it 'blocks the caller' do
- lambda { @server.recvmsg }.should block_caller
+ -> { @server.recvmsg }.should block_caller
end
end
@@ -126,7 +126,7 @@ describe 'BasicSocket#recvmsg' do
it 'blocks the caller' do
socket, _ = @server.accept
begin
- lambda { socket.recvmsg }.should block_caller
+ -> { socket.recvmsg }.should block_caller
ensure
socket.close
end
@@ -170,7 +170,7 @@ describe 'BasicSocket#recvmsg' do
end
it 'raises when receiving the ip_address message' do
- lambda { @addr.ip_address }.should raise_error(SocketError)
+ -> { @addr.ip_address }.should raise_error(SocketError)
end
it 'uses the correct address family' do
@@ -186,7 +186,7 @@ describe 'BasicSocket#recvmsg' do
end
it 'raises when receiving the ip_port message' do
- lambda { @addr.ip_port }.should raise_error(SocketError)
+ -> { @addr.ip_port }.should raise_error(SocketError)
end
end
end
diff --git a/spec/ruby/library/socket/basicsocket/send_spec.rb b/spec/ruby/library/socket/basicsocket/send_spec.rb
index c4845fc09e..041ee46998 100644
--- a/spec/ruby/library/socket/basicsocket/send_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/send_spec.rb
@@ -101,7 +101,7 @@ describe 'BasicSocket#send' do
describe 'without a destination address' do
it "raises #{SocketSpecs.dest_addr_req_error}" do
- lambda { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error)
+ -> { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error)
end
end
@@ -113,7 +113,7 @@ describe 'BasicSocket#send' do
it 'does not persist the connection after writing to the socket' do
@client.send('hello', 0, @server.getsockname)
- lambda { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error)
+ -> { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error)
end
end
@@ -161,7 +161,7 @@ describe 'BasicSocket#send' do
it 'sends the message to the given address instead' do
@client.send('hello', 0, @alt_server.getsockname).should == 5
- lambda { @server.recv(5) }.should block_caller
+ -> { @server.recv(5) }.should block_caller
@alt_server.recv(5).should == 'hello'
end
diff --git a/spec/ruby/library/socket/basicsocket/sendmsg_nonblock_spec.rb b/spec/ruby/library/socket/basicsocket/sendmsg_nonblock_spec.rb
index 000971f6af..c112f2ab4a 100644
--- a/spec/ruby/library/socket/basicsocket/sendmsg_nonblock_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/sendmsg_nonblock_spec.rb
@@ -18,7 +18,7 @@ describe 'BasicSocket#sendmsg_nonblock' do
describe 'without a destination address' do
it "raises #{SocketSpecs.dest_addr_req_error}" do
- lambda { @client.sendmsg_nonblock('hello') }.should raise_error(SocketSpecs.dest_addr_req_error)
+ -> { @client.sendmsg_nonblock('hello') }.should raise_error(SocketSpecs.dest_addr_req_error)
end
end
@@ -70,7 +70,7 @@ describe 'BasicSocket#sendmsg_nonblock' do
it 'sends the message to the given address instead' do
@client.sendmsg_nonblock('hello', 0, @alt_server.getsockname).should == 5
- lambda { @server.recv(5) }.should block_caller
+ -> { @server.recv(5) }.should block_caller
@alt_server.recv(5).should == 'hello'
end
end
@@ -94,7 +94,7 @@ describe 'BasicSocket#sendmsg_nonblock' do
end
it 'raises IO::WaitWritable when the underlying buffer is full' do
- lambda {
+ -> {
10.times { @client.sendmsg_nonblock('hello' * 1_000_000) }
}.should raise_error(IO::WaitWritable)
end
diff --git a/spec/ruby/library/socket/basicsocket/sendmsg_spec.rb b/spec/ruby/library/socket/basicsocket/sendmsg_spec.rb
index f2c11f443a..7ff336c0b7 100644
--- a/spec/ruby/library/socket/basicsocket/sendmsg_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/sendmsg_spec.rb
@@ -19,7 +19,7 @@ describe 'BasicSocket#sendmsg' do
platform_is_not :windows do
describe 'without a destination address' do
it "raises #{SocketSpecs.dest_addr_req_error}" do
- lambda { @client.sendmsg('hello') }.should raise_error(SocketSpecs.dest_addr_req_error)
+ -> { @client.sendmsg('hello') }.should raise_error(SocketSpecs.dest_addr_req_error)
end
end
end
@@ -74,7 +74,7 @@ describe 'BasicSocket#sendmsg' do
it 'sends the message to the given address instead' do
@client.sendmsg('hello', 0, @alt_server.getsockname).should == 5
- lambda { @server.recv(5) }.should block_caller
+ -> { @server.recv(5) }.should block_caller
@alt_server.recv(5).should == 'hello'
end
@@ -101,7 +101,7 @@ describe 'BasicSocket#sendmsg' do
it 'blocks when the underlying buffer is full' do
# Buffer sizes may differ per platform, so sadly this is the only
# reliable way of testing blocking behaviour.
- lambda do
+ -> do
10.times { @client.sendmsg('hello' * 1_000_000) }
end.should block_caller
end
diff --git a/spec/ruby/library/socket/basicsocket/setsockopt_spec.rb b/spec/ruby/library/socket/basicsocket/setsockopt_spec.rb
index 1471b03798..1e8d84e1c9 100644
--- a/spec/ruby/library/socket/basicsocket/setsockopt_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/setsockopt_spec.rb
@@ -38,7 +38,7 @@ describe "BasicSocket#setsockopt" do
platform_is_not :windows do
it "raises EINVAL if passed wrong linger value" do
- lambda do
+ -> do
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, 0)
end.should raise_error(Errno::EINVAL)
end
@@ -70,7 +70,7 @@ describe "BasicSocket#setsockopt" do
n.should_not == [0].pack("i")
platform_is_not :windows do
- lambda {
+ -> {
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, "")
}.should raise_error(SystemCallError)
end
@@ -80,7 +80,7 @@ describe "BasicSocket#setsockopt" do
n.should_not == [0].pack("i")
platform_is_not :windows do
- lambda {
+ -> {
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, "0")
}.should raise_error(SystemCallError)
end
@@ -90,13 +90,13 @@ describe "BasicSocket#setsockopt" do
n.should == [0].pack("i")
platform_is_not :windows do
- lambda {
+ -> {
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, "1")
}.should raise_error(SystemCallError)
end
platform_is_not :windows do
- lambda {
+ -> {
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, "\x00\x00\x00")
}.should raise_error(SystemCallError)
end
@@ -125,7 +125,7 @@ describe "BasicSocket#setsockopt" do
n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF).to_s
n.unpack('i')[0].should >= 1
- lambda {
+ -> {
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, nil).should == 0
}.should raise_error(TypeError)
@@ -137,23 +137,23 @@ describe "BasicSocket#setsockopt" do
n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF).to_s
n.unpack('i')[0].should >= 2
- lambda {
+ -> {
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, "")
}.should raise_error(SystemCallError)
- lambda {
+ -> {
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, "bla")
}.should raise_error(SystemCallError)
- lambda {
+ -> {
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, "0")
}.should raise_error(SystemCallError)
- lambda {
+ -> {
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, "1")
}.should raise_error(SystemCallError)
- lambda {
+ -> {
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, "\x00\x00\x00")
}.should raise_error(SystemCallError)
@@ -224,7 +224,7 @@ describe 'BasicSocket#setsockopt' do
describe 'using separate arguments with Symbols' do
it 'raises TypeError when the first argument is nil' do
- lambda { @socket.setsockopt(nil, :REUSEADDR, true) }.should raise_error(TypeError)
+ -> { @socket.setsockopt(nil, :REUSEADDR, true) }.should raise_error(TypeError)
end
it 'sets a boolean option' do
@@ -251,7 +251,7 @@ describe 'BasicSocket#setsockopt' do
platform_is_not :windows do
it 'raises Errno::EINVAL when setting an invalid option value' do
- lambda { @socket.setsockopt(:SOCKET, :OOBINLINE, 'bla') }.should raise_error(Errno::EINVAL)
+ -> { @socket.setsockopt(:SOCKET, :OOBINLINE, 'bla') }.should raise_error(Errno::EINVAL)
end
end
end
@@ -305,12 +305,12 @@ describe 'BasicSocket#setsockopt' do
it 'raises ArgumentError when passing 2 arguments' do
option = Socket::Option.bool(:INET, :SOCKET, :REUSEADDR, true)
- lambda { @socket.setsockopt(option, :REUSEADDR) }.should raise_error(ArgumentError)
+ -> { @socket.setsockopt(option, :REUSEADDR) }.should raise_error(ArgumentError)
end
it 'raises TypeError when passing 3 arguments' do
option = Socket::Option.bool(:INET, :SOCKET, :REUSEADDR, true)
- lambda { @socket.setsockopt(option, :REUSEADDR, true) }.should raise_error(TypeError)
+ -> { @socket.setsockopt(option, :REUSEADDR, true) }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/library/socket/basicsocket/shutdown_spec.rb b/spec/ruby/library/socket/basicsocket/shutdown_spec.rb
index 87a32ae1dc..41d9581bde 100644
--- a/spec/ruby/library/socket/basicsocket/shutdown_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/shutdown_spec.rb
@@ -29,7 +29,7 @@ platform_is_not :windows do # hangs
it 'shuts down a socket for writing' do
@client.shutdown(Socket::SHUT_WR)
- lambda { @client.write('hello') }.should raise_error(Errno::EPIPE)
+ -> { @client.write('hello') }.should raise_error(Errno::EPIPE)
end
it 'shuts down a socket for reading and writing' do
@@ -37,11 +37,11 @@ platform_is_not :windows do # hangs
@client.recv(1).should be_empty
- lambda { @client.write('hello') }.should raise_error(Errno::EPIPE)
+ -> { @client.write('hello') }.should raise_error(Errno::EPIPE)
end
it 'raises ArgumentError when using an invalid option' do
- lambda { @server.shutdown(666) }.should raise_error(ArgumentError)
+ -> { @server.shutdown(666) }.should raise_error(ArgumentError)
end
end
@@ -61,13 +61,13 @@ platform_is_not :windows do # hangs
it 'shuts down a socket for writing using :WR' do
@client.shutdown(:WR)
- lambda { @client.write('hello') }.should raise_error(Errno::EPIPE)
+ -> { @client.write('hello') }.should raise_error(Errno::EPIPE)
end
it 'shuts down a socket for writing using :SHUT_WR' do
@client.shutdown(:SHUT_WR)
- lambda { @client.write('hello') }.should raise_error(Errno::EPIPE)
+ -> { @client.write('hello') }.should raise_error(Errno::EPIPE)
end
it 'shuts down a socket for reading and writing' do
@@ -75,11 +75,11 @@ platform_is_not :windows do # hangs
@client.recv(1).should be_empty
- lambda { @client.write('hello') }.should raise_error(Errno::EPIPE)
+ -> { @client.write('hello') }.should raise_error(Errno::EPIPE)
end
it 'raises ArgumentError when using an invalid option' do
- lambda { @server.shutdown(:Nope) }.should raise_error(SocketError)
+ -> { @server.shutdown(:Nope) }.should raise_error(SocketError)
end
end
@@ -99,17 +99,17 @@ platform_is_not :windows do # hangs
it 'shuts down a socket for writing using "WR"' do
@client.shutdown('WR')
- lambda { @client.write('hello') }.should raise_error(Errno::EPIPE)
+ -> { @client.write('hello') }.should raise_error(Errno::EPIPE)
end
it 'shuts down a socket for writing using "SHUT_WR"' do
@client.shutdown('SHUT_WR')
- lambda { @client.write('hello') }.should raise_error(Errno::EPIPE)
+ -> { @client.write('hello') }.should raise_error(Errno::EPIPE)
end
it 'raises ArgumentError when using an invalid option' do
- lambda { @server.shutdown('Nope') }.should raise_error(SocketError)
+ -> { @server.shutdown('Nope') }.should raise_error(SocketError)
end
end
@@ -141,13 +141,13 @@ platform_is_not :windows do # hangs
@client.recv(1).should be_empty
- lambda { @client.write('hello') }.should raise_error(Errno::EPIPE)
+ -> { @client.write('hello') }.should raise_error(Errno::EPIPE)
end
end
describe 'using an object that does not respond to #to_str' do
it 'raises TypeError' do
- lambda { @server.shutdown(mock(:dummy)) }.should raise_error(TypeError)
+ -> { @server.shutdown(mock(:dummy)) }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/library/socket/ipsocket/addr_spec.rb b/spec/ruby/library/socket/ipsocket/addr_spec.rb
index 07f4cb20c9..199eb85ab7 100644
--- a/spec/ruby/library/socket/ipsocket/addr_spec.rb
+++ b/spec/ruby/library/socket/ipsocket/addr_spec.rb
@@ -81,7 +81,7 @@ describe 'Socket::IPSocket#addr' do
describe 'using :cats as the argument' do
it 'raises ArgumentError' do
- lambda { @server.addr(:cats) }.should raise_error(ArgumentError)
+ -> { @server.addr(:cats) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/library/socket/ipsocket/getaddress_spec.rb b/spec/ruby/library/socket/ipsocket/getaddress_spec.rb
index 8e14707d4f..746d2ab86b 100644
--- a/spec/ruby/library/socket/ipsocket/getaddress_spec.rb
+++ b/spec/ruby/library/socket/ipsocket/getaddress_spec.rb
@@ -18,7 +18,7 @@ describe "Socket::IPSocket#getaddress" do
# DNS servers like opendns return A records for ANY host, including
# traditionally invalidly named ones.
it "raises an error on unknown hostnames" do
- lambda {
+ -> {
IPSocket.getaddress("rubyspecdoesntexist.fallingsnow.net")
}.should raise_error(SocketError)
end
diff --git a/spec/ruby/library/socket/ipsocket/peeraddr_spec.rb b/spec/ruby/library/socket/ipsocket/peeraddr_spec.rb
index 26aa61d1c4..702650940b 100644
--- a/spec/ruby/library/socket/ipsocket/peeraddr_spec.rb
+++ b/spec/ruby/library/socket/ipsocket/peeraddr_spec.rb
@@ -16,7 +16,7 @@ describe "Socket::IPSocket#peeraddr" do
end
it "raises error if socket is not connected" do
- lambda {
+ -> {
@server.peeraddr
}.should raise_error(Errno::ENOTCONN)
end
@@ -92,7 +92,7 @@ describe 'Socket::IPSocket#peeraddr' do
describe 'using :cats as the argument' do
it 'raises ArgumentError' do
- lambda { @client.peeraddr(:cats) }.should raise_error(ArgumentError)
+ -> { @client.peeraddr(:cats) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/library/socket/option/bool_spec.rb b/spec/ruby/library/socket/option/bool_spec.rb
index c4f8a277ba..144a78043d 100644
--- a/spec/ruby/library/socket/option/bool_spec.rb
+++ b/spec/ruby/library/socket/option/bool_spec.rb
@@ -21,7 +21,7 @@ describe "Socket::Option#bool" do
platform_is_not :windows do
it 'raises TypeError when called on a non boolean option' do
opt = Socket::Option.linger(1, 4)
- lambda { opt.bool }.should raise_error(TypeError)
+ -> { opt.bool }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/library/socket/option/initialize_spec.rb b/spec/ruby/library/socket/option/initialize_spec.rb
index 0d4621b71e..8071ad7ef0 100644
--- a/spec/ruby/library/socket/option/initialize_spec.rb
+++ b/spec/ruby/library/socket/option/initialize_spec.rb
@@ -32,19 +32,19 @@ describe 'Socket::Option#initialize' do
end
it 'raises when using an invalid address family' do
- lambda {
+ -> {
Socket::Option.new(:INET2, :SOCKET, :KEEPALIVE, @bool)
}.should raise_error(SocketError)
end
it 'raises when using an invalid level' do
- lambda {
+ -> {
Socket::Option.new(:INET, :CATS, :KEEPALIVE, @bool)
}.should raise_error(SocketError)
end
it 'raises when using an invalid option name' do
- lambda {
+ -> {
Socket::Option.new(:INET, :SOCKET, :CATS, @bool)
}.should raise_error(SocketError)
end
@@ -63,19 +63,19 @@ describe 'Socket::Option#initialize' do
end
it 'raises when using an invalid address family' do
- lambda {
+ -> {
Socket::Option.new('INET2', 'SOCKET', 'KEEPALIVE', @bool)
}.should raise_error(SocketError)
end
it 'raises when using an invalid level' do
- lambda {
+ -> {
Socket::Option.new('INET', 'CATS', 'KEEPALIVE', @bool)
}.should raise_error(SocketError)
end
it 'raises when using an invalid option name' do
- lambda {
+ -> {
Socket::Option.new('INET', 'SOCKET', 'CATS', @bool)
}.should raise_error(SocketError)
end
diff --git a/spec/ruby/library/socket/option/int_spec.rb b/spec/ruby/library/socket/option/int_spec.rb
index 5c67ec26d8..8c69ef6cbd 100644
--- a/spec/ruby/library/socket/option/int_spec.rb
+++ b/spec/ruby/library/socket/option/int_spec.rb
@@ -37,7 +37,7 @@ describe "Socket::Option#int" do
platform_is_not :windows do
it 'raises TypeError when called on a non integer option' do
opt = Socket::Option.linger(1, 4)
- lambda { opt.int }.should raise_error(TypeError)
+ -> { opt.int }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/library/socket/option/linger_spec.rb b/spec/ruby/library/socket/option/linger_spec.rb
index 94467ebf71..ee987db85b 100644
--- a/spec/ruby/library/socket/option/linger_spec.rb
+++ b/spec/ruby/library/socket/option/linger_spec.rb
@@ -52,25 +52,25 @@ describe "Socket::Option#linger" do
it "raises TypeError if not a SO_LINGER" do
so = Socket::Option.int(:AF_UNSPEC, :SOL_SOCKET, :KEEPALIVE, 1)
- lambda { so.linger }.should raise_error(TypeError)
+ -> { so.linger }.should raise_error(TypeError)
end
it 'raises TypeError when called on a non SOL_SOCKET/SO_LINGER option' do
opt = Socket::Option.int(:INET, :IP, :TTL, 4)
- lambda { opt.linger }.should raise_error(TypeError)
+ -> { opt.linger }.should raise_error(TypeError)
end
platform_is_not :windows do
it "raises TypeError if option has not good size" do
so = Socket::Option.int(:AF_UNSPEC, :SOL_SOCKET, :LINGER, 1)
- lambda { so.linger }.should raise_error(TypeError)
+ -> { so.linger }.should raise_error(TypeError)
end
end
it 'raises TypeError when called on a non linger option' do
opt = Socket::Option.new(:INET, :SOCKET, :LINGER, '')
- lambda { opt.linger }.should raise_error(TypeError)
+ -> { opt.linger }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/socket/option/new_spec.rb b/spec/ruby/library/socket/option/new_spec.rb
index f3b7b31c91..a9e6f09097 100644
--- a/spec/ruby/library/socket/option/new_spec.rb
+++ b/spec/ruby/library/socket/option/new_spec.rb
@@ -22,14 +22,14 @@ describe "Socket::Option.new" do
end
it "should raise error on unknown family" do
- lambda { Socket::Option.new(:INET4, :SOCKET, :KEEPALIVE, [0].pack('i')) }.should raise_error(SocketError)
+ -> { Socket::Option.new(:INET4, :SOCKET, :KEEPALIVE, [0].pack('i')) }.should raise_error(SocketError)
end
it "should raise error on unknown level" do
- lambda { Socket::Option.new(:INET, :ROCKET, :KEEPALIVE, [0].pack('i')) }.should raise_error(SocketError)
+ -> { Socket::Option.new(:INET, :ROCKET, :KEEPALIVE, [0].pack('i')) }.should raise_error(SocketError)
end
it "should raise error on unknown option name" do
- lambda { Socket::Option.new(:INET, :SOCKET, :ALIVE, [0].pack('i')) }.should raise_error(SocketError)
+ -> { Socket::Option.new(:INET, :SOCKET, :ALIVE, [0].pack('i')) }.should raise_error(SocketError)
end
end
diff --git a/spec/ruby/library/socket/shared/pack_sockaddr.rb b/spec/ruby/library/socket/shared/pack_sockaddr.rb
index 40b0d8d59e..2df09027c9 100644
--- a/spec/ruby/library/socket/shared/pack_sockaddr.rb
+++ b/spec/ruby/library/socket/shared/pack_sockaddr.rb
@@ -93,7 +93,7 @@ describe :socket_pack_sockaddr_un, shared: true do
it "raises ArgumentError for paths that are too long" do
# AIX doesn't raise error
long_path = 'a' * 110
- lambda { Socket.public_send(@method, long_path) }.should raise_error(ArgumentError)
+ -> { Socket.public_send(@method, long_path) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/library/socket/shared/socketpair.rb b/spec/ruby/library/socket/shared/socketpair.rb
index 08db2e59b8..25146cfff6 100644
--- a/spec/ruby/library/socket/shared/socketpair.rb
+++ b/spec/ruby/library/socket/shared/socketpair.rb
@@ -42,11 +42,11 @@ describe :socket_socketpair, shared: true do
end
it 'raises SocketError for an unknown address family' do
- lambda { Socket.public_send(@method, :CATS, :STREAM) }.should raise_error(SocketError)
+ -> { Socket.public_send(@method, :CATS, :STREAM) }.should raise_error(SocketError)
end
it 'raises SocketError for an unknown socket type' do
- lambda { Socket.public_send(@method, :UNIX, :CATS) }.should raise_error(SocketError)
+ -> { Socket.public_send(@method, :UNIX, :CATS) }.should raise_error(SocketError)
end
end
@@ -61,11 +61,11 @@ describe :socket_socketpair, shared: true do
end
it 'raises SocketError for an unknown address family' do
- lambda { Socket.public_send(@method, 'CATS', 'STREAM') }.should raise_error(SocketError)
+ -> { Socket.public_send(@method, 'CATS', 'STREAM') }.should raise_error(SocketError)
end
it 'raises SocketError for an unknown socket type' do
- lambda { Socket.public_send(@method, 'UNIX', 'CATS') }.should raise_error(SocketError)
+ -> { Socket.public_send(@method, 'UNIX', 'CATS') }.should raise_error(SocketError)
end
end
@@ -92,7 +92,7 @@ describe :socket_socketpair, shared: true do
family.stub!(:to_str).and_return(Socket::AF_UNIX)
type.stub!(:to_str).and_return(Socket::SOCK_STREAM)
- lambda { Socket.public_send(@method, family, type) }.should raise_error(TypeError)
+ -> { Socket.public_send(@method, family, type) }.should raise_error(TypeError)
end
it 'raises SocketError for an unknown address family' do
@@ -102,7 +102,7 @@ describe :socket_socketpair, shared: true do
family.stub!(:to_str).and_return('CATS')
type.stub!(:to_str).and_return('STREAM')
- lambda { Socket.public_send(@method, family, type) }.should raise_error(SocketError)
+ -> { Socket.public_send(@method, family, type) }.should raise_error(SocketError)
end
it 'raises SocketError for an unknown socket type' do
@@ -112,7 +112,7 @@ describe :socket_socketpair, shared: true do
family.stub!(:to_str).and_return('UNIX')
type.stub!(:to_str).and_return('CATS')
- lambda { Socket.public_send(@method, family, type) }.should raise_error(SocketError)
+ -> { Socket.public_send(@method, family, type) }.should raise_error(SocketError)
end
end
diff --git a/spec/ruby/library/socket/socket/accept_loop_spec.rb b/spec/ruby/library/socket/socket/accept_loop_spec.rb
index ee11569da3..78e8c3fa4a 100644
--- a/spec/ruby/library/socket/socket/accept_loop_spec.rb
+++ b/spec/ruby/library/socket/socket/accept_loop_spec.rb
@@ -20,7 +20,7 @@ describe 'Socket.accept_loop' do
# https://ci.appveyor.com/project/ruby/ruby/builds/20817932/job/dor2ipny7ru4erpa
platform_is_not :windows do
it 'blocks the caller' do
- lambda { Socket.accept_loop([@server]) }.should block_caller
+ -> { Socket.accept_loop([@server]) }.should block_caller
end
end
end
@@ -53,7 +53,7 @@ describe 'Socket.accept_loop' do
describe 'using separate Socket arguments' do
describe 'without any available connections' do
it 'blocks the caller' do
- lambda { Socket.accept_loop(@server) }.should block_caller
+ -> { Socket.accept_loop(@server) }.should block_caller
end
end
diff --git a/spec/ruby/library/socket/socket/accept_nonblock_spec.rb b/spec/ruby/library/socket/socket/accept_nonblock_spec.rb
index cde9e6a4b6..3221f0b128 100644
--- a/spec/ruby/library/socket/socket/accept_nonblock_spec.rb
+++ b/spec/ruby/library/socket/socket/accept_nonblock_spec.rb
@@ -15,7 +15,7 @@ describe "Socket#accept_nonblock" do
end
it "raises IO::WaitReadable if the connection is not accepted yet" do
- lambda {
+ -> {
@socket.accept_nonblock
}.should raise_error(IO::WaitReadable) { |e|
platform_is_not :windows do
@@ -45,7 +45,7 @@ describe 'Socket#accept_nonblock' do
describe 'using an unbound socket' do
it 'raises Errno::EINVAL' do
- lambda { @server.accept_nonblock }.should raise_error(Errno::EINVAL)
+ -> { @server.accept_nonblock }.should raise_error(Errno::EINVAL)
end
end
@@ -55,7 +55,7 @@ describe 'Socket#accept_nonblock' do
end
it 'raises Errno::EINVAL' do
- lambda { @server.accept_nonblock }.should raise_error(Errno::EINVAL)
+ -> { @server.accept_nonblock }.should raise_error(Errno::EINVAL)
end
end
@@ -63,7 +63,7 @@ describe 'Socket#accept_nonblock' do
it 'raises IOError' do
@server.close
- lambda { @server.accept_nonblock }.should raise_error(IOError)
+ -> { @server.accept_nonblock }.should raise_error(IOError)
end
end
@@ -75,7 +75,7 @@ describe 'Socket#accept_nonblock' do
describe 'without a connected client' do
it 'raises IO::WaitReadable' do
- lambda { @server.accept_nonblock }.should raise_error(IO::WaitReadable)
+ -> { @server.accept_nonblock }.should raise_error(IO::WaitReadable)
end
end
diff --git a/spec/ruby/library/socket/socket/accept_spec.rb b/spec/ruby/library/socket/socket/accept_spec.rb
index a0778caa23..417f996c55 100644
--- a/spec/ruby/library/socket/socket/accept_spec.rb
+++ b/spec/ruby/library/socket/socket/accept_spec.rb
@@ -15,7 +15,7 @@ describe 'Socket#accept' do
platform_is :linux do # hangs on other platforms
describe 'using an unbound socket' do
it 'raises Errno::EINVAL' do
- lambda { @server.accept }.should raise_error(Errno::EINVAL)
+ -> { @server.accept }.should raise_error(Errno::EINVAL)
end
end
@@ -25,7 +25,7 @@ describe 'Socket#accept' do
end
it 'raises Errno::EINVAL' do
- lambda { @server.accept }.should raise_error(Errno::EINVAL)
+ -> { @server.accept }.should raise_error(Errno::EINVAL)
end
end
end
@@ -34,7 +34,7 @@ describe 'Socket#accept' do
it 'raises IOError' do
@server.close
- lambda { @server.accept }.should raise_error(IOError)
+ -> { @server.accept }.should raise_error(IOError)
end
end
@@ -56,7 +56,6 @@ describe 'Socket#accept' do
client.connect(@server_addr)
- thread.join(5)
value = thread.value
begin
value.should be_an_instance_of(Array)
diff --git a/spec/ruby/library/socket/socket/bind_spec.rb b/spec/ruby/library/socket/socket/bind_spec.rb
index 3a7df6ed71..0349df84a6 100644
--- a/spec/ruby/library/socket/socket/bind_spec.rb
+++ b/spec/ruby/library/socket/socket/bind_spec.rb
@@ -13,7 +13,7 @@ describe "Socket#bind on SOCK_DGRAM socket" do
end
it "binds to a port" do
- lambda { @sock.bind(@sockaddr) }.should_not raise_error
+ -> { @sock.bind(@sockaddr) }.should_not raise_error
end
it "returns 0 if successful" do
@@ -23,19 +23,19 @@ describe "Socket#bind on SOCK_DGRAM socket" do
it "raises Errno::EINVAL when already bound" do
@sock.bind(@sockaddr)
- lambda { @sock.bind(@sockaddr) }.should raise_error(Errno::EINVAL)
+ -> { @sock.bind(@sockaddr) }.should raise_error(Errno::EINVAL)
end
it "raises Errno::EADDRNOTAVAIL when the specified sockaddr is not available from the local machine" do
sockaddr1 = Socket.pack_sockaddr_in(0, "4.3.2.1")
- lambda { @sock.bind(sockaddr1) }.should raise_error(Errno::EADDRNOTAVAIL)
+ -> { @sock.bind(sockaddr1) }.should raise_error(Errno::EADDRNOTAVAIL)
end
platform_is_not :windows, :cygwin do
as_user do
it "raises Errno::EACCES when the current user does not have permission to bind" do
sockaddr1 = Socket.pack_sockaddr_in(1, "127.0.0.1")
- lambda { @sock.bind(sockaddr1) }.should raise_error(Errno::EACCES)
+ -> { @sock.bind(sockaddr1) }.should raise_error(Errno::EACCES)
end
end
end
@@ -54,7 +54,7 @@ describe "Socket#bind on SOCK_STREAM socket" do
end
it "binds to a port" do
- lambda { @sock.bind(@sockaddr) }.should_not raise_error
+ -> { @sock.bind(@sockaddr) }.should_not raise_error
end
it "returns 0 if successful" do
@@ -64,19 +64,19 @@ describe "Socket#bind on SOCK_STREAM socket" do
it "raises Errno::EINVAL when already bound" do
@sock.bind(@sockaddr)
- lambda { @sock.bind(@sockaddr) }.should raise_error(Errno::EINVAL)
+ -> { @sock.bind(@sockaddr) }.should raise_error(Errno::EINVAL)
end
it "raises Errno::EADDRNOTAVAIL when the specified sockaddr is not available from the local machine" do
sockaddr1 = Socket.pack_sockaddr_in(0, "4.3.2.1")
- lambda { @sock.bind(sockaddr1) }.should raise_error(Errno::EADDRNOTAVAIL)
+ -> { @sock.bind(sockaddr1) }.should raise_error(Errno::EADDRNOTAVAIL)
end
platform_is_not :windows, :cygwin do
as_user do
it "raises Errno::EACCES when the current user does not have permission to bind" do
sockaddr1 = Socket.pack_sockaddr_in(1, "127.0.0.1")
- lambda { @sock.bind(sockaddr1) }.should raise_error(Errno::EACCES)
+ -> { @sock.bind(sockaddr1) }.should raise_error(Errno::EACCES)
end
end
end
@@ -101,14 +101,14 @@ describe 'Socket#bind' do
it 'raises Errno::EINVAL when binding to an already bound port' do
@socket.bind(@sockaddr)
- lambda { @socket.bind(@sockaddr) }.should raise_error(Errno::EINVAL)
+ -> { @socket.bind(@sockaddr) }.should raise_error(Errno::EINVAL)
end
it 'raises Errno::EADDRNOTAVAIL when the specified sockaddr is not available' do
ip = family == Socket::AF_INET ? '4.3.2.1' : '::2'
sockaddr1 = Socket.sockaddr_in(0, ip)
- lambda { @socket.bind(sockaddr1) }.should raise_error(Errno::EADDRNOTAVAIL)
+ -> { @socket.bind(sockaddr1) }.should raise_error(Errno::EADDRNOTAVAIL)
end
platform_is_not :windows do
@@ -116,7 +116,7 @@ describe 'Socket#bind' do
it 'raises Errno::EACCES when the user is not allowed to bind to the port' do
sockaddr1 = Socket.pack_sockaddr_in(1, ip_address)
- lambda { @socket.bind(sockaddr1) }.should raise_error(Errno::EACCES)
+ -> { @socket.bind(sockaddr1) }.should raise_error(Errno::EACCES)
end
end
end
diff --git a/spec/ruby/library/socket/socket/connect_nonblock_spec.rb b/spec/ruby/library/socket/socket/connect_nonblock_spec.rb
index b5f416d96f..3cf667fc4a 100644
--- a/spec/ruby/library/socket/socket/connect_nonblock_spec.rb
+++ b/spec/ruby/library/socket/socket/connect_nonblock_spec.rb
@@ -53,13 +53,13 @@ describe "Socket#connect_nonblock" do
platform_is_not :freebsd, :solaris, :aix do
it "raises Errno::EINPROGRESS when the connect would block" do
- lambda do
+ -> do
@socket.connect_nonblock(@addr)
end.should raise_error(Errno::EINPROGRESS)
end
it "raises Errno::EINPROGRESS with IO::WaitWritable mixed in when the connect would block" do
- lambda do
+ -> do
@socket.connect_nonblock(@addr)
end.should raise_error(IO::WaitWritable)
end
@@ -95,7 +95,7 @@ describe 'Socket#connect_nonblock' do
end
it 'raises TypeError when passed an Integer' do
- lambda { @client.connect_nonblock(666) }.should raise_error(TypeError)
+ -> { @client.connect_nonblock(666) }.should raise_error(TypeError)
end
end
@@ -116,7 +116,7 @@ describe 'Socket#connect_nonblock' do
@server.listen(1)
@client.connect(@server.connect_address).should == 0
- lambda {
+ -> {
@client.connect_nonblock(@server.connect_address)
# A second call needed if non-blocking sockets become default
@@ -139,7 +139,7 @@ describe 'Socket#connect_nonblock' do
it 'raises IO:EINPROGRESSWaitWritable when the connection would block' do
@server.bind(@sockaddr)
- lambda {
+ -> {
@client.connect_nonblock(@server.connect_address)
}.should raise_error(IO::EINPROGRESSWaitWritable)
end
diff --git a/spec/ruby/library/socket/socket/connect_spec.rb b/spec/ruby/library/socket/socket/connect_spec.rb
index df5cc5bf34..8653fba552 100644
--- a/spec/ruby/library/socket/socket/connect_spec.rb
+++ b/spec/ruby/library/socket/socket/connect_spec.rb
@@ -32,7 +32,7 @@ describe 'Socket#connect' do
@client.connect(@server.getsockname).should == 0
- lambda {
+ -> {
@client.connect(@server.getsockname)
# A second call needed if non-blocking sockets become default
diff --git a/spec/ruby/library/socket/socket/gethostbyaddr_spec.rb b/spec/ruby/library/socket/socket/gethostbyaddr_spec.rb
index 639a318132..5d97341103 100644
--- a/spec/ruby/library/socket/socket/gethostbyaddr_spec.rb
+++ b/spec/ruby/library/socket/socket/gethostbyaddr_spec.rb
@@ -57,7 +57,7 @@ describe 'Socket.gethostbyaddr' do
end
it 'raises SocketError when the address is not supported by the family' do
- lambda { Socket.gethostbyaddr(@addr, :INET6) }.should raise_error(SocketError)
+ -> { Socket.gethostbyaddr(@addr, :INET6) }.should raise_error(SocketError)
end
end
end
@@ -115,7 +115,7 @@ describe 'Socket.gethostbyaddr' do
platform_is_not :windows do
it 'raises SocketError when the address is not supported by the family' do
- lambda { Socket.gethostbyaddr(@addr, :INET) }.should raise_error(SocketError)
+ -> { Socket.gethostbyaddr(@addr, :INET) }.should raise_error(SocketError)
end
end
end
diff --git a/spec/ruby/library/socket/socket/getnameinfo_spec.rb b/spec/ruby/library/socket/socket/getnameinfo_spec.rb
index fbbbcb53c5..b406348aa8 100644
--- a/spec/ruby/library/socket/socket/getnameinfo_spec.rb
+++ b/spec/ruby/library/socket/socket/getnameinfo_spec.rb
@@ -69,7 +69,7 @@ describe 'Socket.getnameinfo' do
end
it 'raises SocketError or TypeError when using an invalid String' do
- lambda { Socket.getnameinfo('cats') }.should raise_error(Exception) { |e|
+ -> { Socket.getnameinfo('cats') }.should raise_error(Exception) { |e|
[SocketError, TypeError].should include(e.class)
}
end
@@ -102,7 +102,7 @@ describe 'Socket.getnameinfo' do
end
it 'raises ArgumentError when using an invalid Array' do
- lambda { Socket.getnameinfo([family_name]) }.should raise_error(ArgumentError)
+ -> { Socket.getnameinfo([family_name]) }.should raise_error(ArgumentError)
end
platform_is_not :windows do
diff --git a/spec/ruby/library/socket/socket/getservbyname_spec.rb b/spec/ruby/library/socket/socket/getservbyname_spec.rb
index 9479b26228..d361e619f2 100644
--- a/spec/ruby/library/socket/socket/getservbyname_spec.rb
+++ b/spec/ruby/library/socket/socket/getservbyname_spec.rb
@@ -27,6 +27,6 @@ describe "Socket#getservbyname" do
end
it "raises a SocketError when the service or port is invalid" do
- lambda { Socket.getservbyname('invalid') }.should raise_error(SocketError)
+ -> { Socket.getservbyname('invalid') }.should raise_error(SocketError)
end
end
diff --git a/spec/ruby/library/socket/socket/getservbyport_spec.rb b/spec/ruby/library/socket/socket/getservbyport_spec.rb
index 9be2ac527e..563c592b54 100644
--- a/spec/ruby/library/socket/socket/getservbyport_spec.rb
+++ b/spec/ruby/library/socket/socket/getservbyport_spec.rb
@@ -18,6 +18,6 @@ describe 'Socket.getservbyport' do
end
it 'raises SocketError for an unknown port number' do
- lambda { Socket.getservbyport(0) }.should raise_error(SocketError)
+ -> { Socket.getservbyport(0) }.should raise_error(SocketError)
end
end
diff --git a/spec/ruby/library/socket/socket/initialize_spec.rb b/spec/ruby/library/socket/socket/initialize_spec.rb
index 2343c6e289..f8337bcaa5 100644
--- a/spec/ruby/library/socket/socket/initialize_spec.rb
+++ b/spec/ruby/library/socket/socket/initialize_spec.rb
@@ -53,7 +53,7 @@ describe 'Socket#initialize' do
family.stub!(:to_str).and_return(Socket::AF_INET)
type.stub!(:to_str).and_return(Socket::SOCK_STREAM)
- lambda { Socket.new(family, type) }.should raise_error(TypeError)
+ -> { Socket.new(family, type) }.should raise_error(TypeError)
end
end
@@ -65,7 +65,7 @@ describe 'Socket#initialize' do
end
it 'raises TypeError when using a Symbol' do
- lambda { Socket.new(:INET, :STREAM, :TCP) }.should raise_error(TypeError)
+ -> { Socket.new(:INET, :STREAM, :TCP) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/socket/socket/listen_spec.rb b/spec/ruby/library/socket/socket/listen_spec.rb
index d0f9c70c4e..5de70d6db0 100644
--- a/spec/ruby/library/socket/socket/listen_spec.rb
+++ b/spec/ruby/library/socket/socket/listen_spec.rb
@@ -35,7 +35,7 @@ describe 'Socket#listen' do
end
it 'raises Errno::EOPNOTSUPP' do
- lambda { @server.listen(1) }.should raise_error(Errno::EOPNOTSUPP)
+ -> { @server.listen(1) }.should raise_error(Errno::EOPNOTSUPP)
end
end
@@ -57,7 +57,7 @@ describe 'Socket#listen' do
end
it "raises when the given argument can't be coerced to an Integer" do
- lambda { @server.listen('cats') }.should raise_error(TypeError)
+ -> { @server.listen('cats') }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb b/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb
index 5f717d4b54..94f58ac49f 100644
--- a/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb
+++ b/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb
@@ -16,7 +16,7 @@ describe 'Socket#recvfrom_nonblock' do
platform_is_not :windows do
describe 'using an unbound socket' do
it 'raises IO::WaitReadable' do
- lambda { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable)
+ -> { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable)
end
end
end
@@ -29,7 +29,7 @@ describe 'Socket#recvfrom_nonblock' do
describe 'without any data available' do
it 'raises IO::WaitReadable' do
- lambda { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable)
+ -> { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable)
end
it 'returns :wait_readable with exception: false' do
diff --git a/spec/ruby/library/socket/socket/recvfrom_spec.rb b/spec/ruby/library/socket/socket/recvfrom_spec.rb
index 7f0714511c..faf161e4a5 100644
--- a/spec/ruby/library/socket/socket/recvfrom_spec.rb
+++ b/spec/ruby/library/socket/socket/recvfrom_spec.rb
@@ -15,7 +15,7 @@ describe 'Socket#recvfrom' do
describe 'using an unbound socket' do
it 'blocks the caller' do
- lambda { @server.recvfrom(1) }.should block_caller
+ -> { @server.recvfrom(1) }.should block_caller
end
end
@@ -27,7 +27,7 @@ describe 'Socket#recvfrom' do
describe 'without any data available' do
it 'blocks the caller' do
- lambda { @server.recvfrom(1) }.should block_caller
+ -> { @server.recvfrom(1) }.should block_caller
end
end
diff --git a/spec/ruby/library/socket/socket/sysaccept_spec.rb b/spec/ruby/library/socket/socket/sysaccept_spec.rb
index f039096707..92ac21124e 100644
--- a/spec/ruby/library/socket/socket/sysaccept_spec.rb
+++ b/spec/ruby/library/socket/socket/sysaccept_spec.rb
@@ -15,7 +15,7 @@ describe 'Socket#sysaccept' do
platform_is :linux do # hangs on other platforms
describe 'using an unbound socket' do
it 'raises Errno::EINVAL' do
- lambda { @server.sysaccept }.should raise_error(Errno::EINVAL)
+ -> { @server.sysaccept }.should raise_error(Errno::EINVAL)
end
end
@@ -25,7 +25,7 @@ describe 'Socket#sysaccept' do
end
it 'raises Errno::EINVAL' do
- lambda { @server.sysaccept }.should raise_error(Errno::EINVAL)
+ -> { @server.sysaccept }.should raise_error(Errno::EINVAL)
end
end
end
@@ -59,8 +59,6 @@ describe 'Socket#sysaccept' do
@client.connect(@server_addr)
- thread.join(5)
-
thread.value.should be_an_instance_of(Array)
end
end
diff --git a/spec/ruby/library/socket/socket/tcp_server_loop_spec.rb b/spec/ruby/library/socket/socket/tcp_server_loop_spec.rb
index 05ecad67d1..a46c6df5c6 100644
--- a/spec/ruby/library/socket/socket/tcp_server_loop_spec.rb
+++ b/spec/ruby/library/socket/socket/tcp_server_loop_spec.rb
@@ -4,7 +4,7 @@ require_relative '../fixtures/classes'
describe 'Socket.tcp_server_loop' do
describe 'when no connections are available' do
it 'blocks the caller' do
- lambda { Socket.tcp_server_loop('127.0.0.1', 0) }.should block_caller
+ -> { Socket.tcp_server_loop('127.0.0.1', 0) }.should block_caller
end
end
@@ -45,7 +45,7 @@ describe 'Socket.tcp_server_loop' do
# At this point the connection has been set up but the thread may not yet
# have returned, thus we'll need to wait a little longer for it to
# complete.
- thread.join(2)
+ thread.join
@sock.should be_an_instance_of(Socket)
addr.should be_an_instance_of(Addrinfo)
diff --git a/spec/ruby/library/socket/socket/tcp_spec.rb b/spec/ruby/library/socket/socket/tcp_spec.rb
index 29f166ffc5..d36e3e6adb 100644
--- a/spec/ruby/library/socket/socket/tcp_spec.rb
+++ b/spec/ruby/library/socket/socket/tcp_spec.rb
@@ -49,7 +49,7 @@ describe 'Socket.tcp' do
end
it 'raises ArgumentError when 6 arguments are provided' do
- lambda {
+ -> {
Socket.tcp(@host, @port, @host, 0, {:connect_timeout => 1}, 10)
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/socket/socket/udp_server_loop_on_spec.rb b/spec/ruby/library/socket/socket/udp_server_loop_on_spec.rb
index 1cb82d72be..cb8c5c5587 100644
--- a/spec/ruby/library/socket/socket/udp_server_loop_on_spec.rb
+++ b/spec/ruby/library/socket/socket/udp_server_loop_on_spec.rb
@@ -13,7 +13,7 @@ describe 'Socket.udp_server_loop_on' do
describe 'when no connections are available' do
it 'blocks the caller' do
- lambda { Socket.udp_server_loop_on([@server]) }.should block_caller
+ -> { Socket.udp_server_loop_on([@server]) }.should block_caller
end
end
diff --git a/spec/ruby/library/socket/socket/udp_server_loop_spec.rb b/spec/ruby/library/socket/socket/udp_server_loop_spec.rb
index 168c17545f..66563bc742 100644
--- a/spec/ruby/library/socket/socket/udp_server_loop_spec.rb
+++ b/spec/ruby/library/socket/socket/udp_server_loop_spec.rb
@@ -4,7 +4,7 @@ require_relative '../fixtures/classes'
describe 'Socket.udp_server_loop' do
describe 'when no connections are available' do
it 'blocks the caller' do
- lambda { Socket.udp_server_loop('127.0.0.1', 0) }.should block_caller
+ -> { Socket.udp_server_loop('127.0.0.1', 0) }.should block_caller
end
end
diff --git a/spec/ruby/library/socket/socket/unix_server_loop_spec.rb b/spec/ruby/library/socket/socket/unix_server_loop_spec.rb
index a2d2ad9fdb..0f34d4a50b 100644
--- a/spec/ruby/library/socket/socket/unix_server_loop_spec.rb
+++ b/spec/ruby/library/socket/socket/unix_server_loop_spec.rb
@@ -13,7 +13,7 @@ with_feature :unix_socket do
describe 'when no connections are available' do
it 'blocks the caller' do
- lambda { Socket.unix_server_loop(@path) }.should block_caller
+ -> { Socket.unix_server_loop(@path) }.should block_caller
end
end
@@ -48,7 +48,7 @@ with_feature :unix_socket do
end
end
- thread.join(2)
+ thread.join
@sock.should be_an_instance_of(Socket)
addr.should be_an_instance_of(Addrinfo)
diff --git a/spec/ruby/library/socket/socket/unpack_sockaddr_in_spec.rb b/spec/ruby/library/socket/socket/unpack_sockaddr_in_spec.rb
index 579ae307df..79ec68cd18 100644
--- a/spec/ruby/library/socket/socket/unpack_sockaddr_in_spec.rb
+++ b/spec/ruby/library/socket/socket/unpack_sockaddr_in_spec.rb
@@ -35,12 +35,12 @@ describe "Socket.unpack_sockaddr_in" do
with_feature :unix_socket do
it "raises an ArgumentError when the sin_family is not AF_INET" do
sockaddr = Socket.sockaddr_un '/tmp/x'
- lambda { Socket.unpack_sockaddr_in sockaddr }.should raise_error(ArgumentError)
+ -> { Socket.unpack_sockaddr_in sockaddr }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when passed addrinfo is not AF_INET/AF_INET6" do
addrinfo = Addrinfo.unix('/tmp/sock')
- lambda { Socket.unpack_sockaddr_in(addrinfo) }.should raise_error(ArgumentError)
+ -> { Socket.unpack_sockaddr_in(addrinfo) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/library/socket/socket/unpack_sockaddr_un_spec.rb b/spec/ruby/library/socket/socket/unpack_sockaddr_un_spec.rb
index 39e33c90e9..bd95f1db08 100644
--- a/spec/ruby/library/socket/socket/unpack_sockaddr_un_spec.rb
+++ b/spec/ruby/library/socket/socket/unpack_sockaddr_un_spec.rb
@@ -15,12 +15,12 @@ with_feature :unix_socket do
it 'raises an ArgumentError when the sin_family is not AF_UNIX' do
sockaddr = Socket.sockaddr_in(0, '127.0.0.1')
- lambda { Socket.unpack_sockaddr_un(sockaddr) }.should raise_error(ArgumentError)
+ -> { Socket.unpack_sockaddr_un(sockaddr) }.should raise_error(ArgumentError)
end
it 'raises an ArgumentError when passed addrinfo is not AF_UNIX' do
addrinfo = Addrinfo.tcp('127.0.0.1', 0)
- lambda { Socket.unpack_sockaddr_un(addrinfo) }.should raise_error(ArgumentError)
+ -> { Socket.unpack_sockaddr_un(addrinfo) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/library/socket/tcpserver/accept_nonblock_spec.rb b/spec/ruby/library/socket/tcpserver/accept_nonblock_spec.rb
index 6f118026ae..91f6a327f0 100644
--- a/spec/ruby/library/socket/tcpserver/accept_nonblock_spec.rb
+++ b/spec/ruby/library/socket/tcpserver/accept_nonblock_spec.rb
@@ -13,7 +13,7 @@ describe "Socket::TCPServer.accept_nonblock" do
it "accepts non blocking connections" do
@server.listen(5)
- lambda {
+ -> {
@server.accept_nonblock
}.should raise_error(IO::WaitReadable)
@@ -33,12 +33,12 @@ describe "Socket::TCPServer.accept_nonblock" do
it "raises an IOError if the socket is closed" do
@server.close
- lambda { @server.accept }.should raise_error(IOError)
+ -> { @server.accept }.should raise_error(IOError)
end
describe 'without a connected client' do
it 'raises error' do
- lambda { @server.accept_nonblock }.should raise_error(IO::WaitReadable)
+ -> { @server.accept_nonblock }.should raise_error(IO::WaitReadable)
end
it 'returns :wait_readable in exceptionless mode' do
@@ -59,7 +59,7 @@ describe 'TCPServer#accept_nonblock' do
describe 'without a connected client' do
it 'raises IO::WaitReadable' do
- lambda { @server.accept_nonblock }.should raise_error(IO::WaitReadable)
+ -> { @server.accept_nonblock }.should raise_error(IO::WaitReadable)
end
end
diff --git a/spec/ruby/library/socket/tcpserver/accept_spec.rb b/spec/ruby/library/socket/tcpserver/accept_spec.rb
index f0ef9cc727..0da4e2218b 100644
--- a/spec/ruby/library/socket/tcpserver/accept_spec.rb
+++ b/spec/ruby/library/socket/tcpserver/accept_spec.rb
@@ -60,7 +60,7 @@ describe "TCPServer#accept" do
it "raises an IOError if the socket is closed" do
@server.close
- lambda { @server.accept }.should raise_error(IOError)
+ -> { @server.accept }.should raise_error(IOError)
end
end
@@ -76,7 +76,7 @@ describe 'TCPServer#accept' do
describe 'without a connected client' do
it 'blocks the caller' do
- lambda { @server.accept }.should block_caller
+ -> { @server.accept }.should block_caller
end
end
diff --git a/spec/ruby/library/socket/tcpserver/gets_spec.rb b/spec/ruby/library/socket/tcpserver/gets_spec.rb
index 936295dce2..417976d737 100644
--- a/spec/ruby/library/socket/tcpserver/gets_spec.rb
+++ b/spec/ruby/library/socket/tcpserver/gets_spec.rb
@@ -11,6 +11,6 @@ describe "TCPServer#gets" do
end
it "raises Errno::ENOTCONN on gets" do
- lambda { @server.gets }.should raise_error(Errno::ENOTCONN)
+ -> { @server.gets }.should raise_error(Errno::ENOTCONN)
end
end
diff --git a/spec/ruby/library/socket/tcpserver/initialize_spec.rb b/spec/ruby/library/socket/tcpserver/initialize_spec.rb
index 412bdbfb9d..4ddd1f465f 100644
--- a/spec/ruby/library/socket/tcpserver/initialize_spec.rb
+++ b/spec/ruby/library/socket/tcpserver/initialize_spec.rb
@@ -52,7 +52,7 @@ describe 'TCPServer#initialize' do
describe 'with a single String argument containing a non numeric value' do
it 'raises SocketError' do
- lambda { TCPServer.new('cats') }.should raise_error(SocketError)
+ -> { TCPServer.new('cats') }.should raise_error(SocketError)
end
end
diff --git a/spec/ruby/library/socket/tcpserver/listen_spec.rb b/spec/ruby/library/socket/tcpserver/listen_spec.rb
index e266decd61..c877fdced6 100644
--- a/spec/ruby/library/socket/tcpserver/listen_spec.rb
+++ b/spec/ruby/library/socket/tcpserver/listen_spec.rb
@@ -16,7 +16,7 @@ describe 'TCPServer#listen' do
end
it "raises when the given argument can't be coerced to an Integer" do
- lambda { @server.listen('cats') }.should raise_error(TypeError)
+ -> { @server.listen('cats') }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/library/socket/tcpserver/new_spec.rb b/spec/ruby/library/socket/tcpserver/new_spec.rb
index 4717b95a2c..94e5744995 100644
--- a/spec/ruby/library/socket/tcpserver/new_spec.rb
+++ b/spec/ruby/library/socket/tcpserver/new_spec.rb
@@ -49,7 +49,7 @@ describe "TCPServer.new" do
end
it "coerces port to string, then determines port from that number or service name" do
- lambda { TCPServer.new(SocketSpecs.hostname, Object.new) }.should raise_error(TypeError)
+ -> { TCPServer.new(SocketSpecs.hostname, Object.new) }.should raise_error(TypeError)
port = Object.new
port.should_receive(:to_str).and_return("0")
@@ -63,7 +63,7 @@ describe "TCPServer.new" do
end
it "raises Errno::EADDRNOTAVAIL when the address is unknown" do
- lambda { TCPServer.new("1.2.3.4", 0) }.should raise_error(Errno::EADDRNOTAVAIL)
+ -> { TCPServer.new("1.2.3.4", 0) }.should raise_error(Errno::EADDRNOTAVAIL)
end
# There is no way to make this fail-proof on all machines, because
@@ -71,7 +71,7 @@ describe "TCPServer.new" do
# traditionally invalidly named ones.
quarantine! do
it "raises a SocketError when the host is unknown" do
- lambda {
+ -> {
TCPServer.new("--notavalidname", 0)
}.should raise_error(SocketError)
end
@@ -79,7 +79,7 @@ describe "TCPServer.new" do
it "raises Errno::EADDRINUSE when address is already in use" do
@server = TCPServer.new('127.0.0.1', 0)
- lambda {
+ -> {
@server = TCPServer.new('127.0.0.1', @server.addr[1])
}.should raise_error(Errno::EADDRINUSE)
end
diff --git a/spec/ruby/library/socket/tcpserver/sysaccept_spec.rb b/spec/ruby/library/socket/tcpserver/sysaccept_spec.rb
index 5543b67755..bd7d33faf4 100644
--- a/spec/ruby/library/socket/tcpserver/sysaccept_spec.rb
+++ b/spec/ruby/library/socket/tcpserver/sysaccept_spec.rb
@@ -12,7 +12,7 @@ describe "TCPServer#sysaccept" do
end
it 'blocks if no connections' do
- lambda { @server.sysaccept }.should block_caller
+ -> { @server.sysaccept }.should block_caller
end
it 'returns file descriptor of an accepted connection' do
@@ -41,7 +41,7 @@ describe 'TCPServer#sysaccept' do
describe 'without a connected client' do
it 'blocks the caller' do
- lambda { @server.sysaccept }.should block_caller
+ -> { @server.sysaccept }.should block_caller
end
end
diff --git a/spec/ruby/library/socket/tcpsocket/initialize_spec.rb b/spec/ruby/library/socket/tcpsocket/initialize_spec.rb
index a3593f0d5f..a3cee05412 100644
--- a/spec/ruby/library/socket/tcpsocket/initialize_spec.rb
+++ b/spec/ruby/library/socket/tcpsocket/initialize_spec.rb
@@ -5,7 +5,7 @@ describe 'TCPSocket#initialize' do
SocketSpecs.each_ip_protocol do |family, ip_address|
describe 'when no server is listening on the given address' do
it 'raises Errno::ECONNREFUSED' do
- lambda { TCPSocket.new(ip_address, 666) }.should raise_error(Errno::ECONNREFUSED)
+ -> { TCPSocket.new(ip_address, 666) }.should raise_error(Errno::ECONNREFUSED)
end
end
@@ -31,7 +31,7 @@ describe 'TCPSocket#initialize' do
end
it 'raises SocketError when the port number is a non numeric String' do
- lambda { TCPSocket.new(ip_address, 'cats') }.should raise_error(SocketError)
+ -> { TCPSocket.new(ip_address, 'cats') }.should raise_error(SocketError)
end
it 'set the socket to binmode' do
diff --git a/spec/ruby/library/socket/tcpsocket/shared/new.rb b/spec/ruby/library/socket/tcpsocket/shared/new.rb
index d0358923c9..5ca3a0e6cc 100644
--- a/spec/ruby/library/socket/tcpsocket/shared/new.rb
+++ b/spec/ruby/library/socket/tcpsocket/shared/new.rb
@@ -3,11 +3,11 @@ require_relative '../../fixtures/classes'
describe :tcpsocket_new, shared: true do
it "requires a hostname and a port as arguments" do
- lambda { TCPSocket.send(@method) }.should raise_error(ArgumentError)
+ -> { TCPSocket.send(@method) }.should raise_error(ArgumentError)
end
it "refuses the connection when there is no server to connect to" do
- lambda do
+ -> do
TCPSocket.send(@method, SocketSpecs.hostname, SocketSpecs.reserved_unused_port)
end.should raise_error(SystemCallError) {|e|
[Errno::ECONNREFUSED, Errno::EADDRNOTAVAIL].should include(e.class)
diff --git a/spec/ruby/library/socket/udpsocket/bind_spec.rb b/spec/ruby/library/socket/udpsocket/bind_spec.rb
index 4dbdb285f6..08b386e941 100644
--- a/spec/ruby/library/socket/udpsocket/bind_spec.rb
+++ b/spec/ruby/library/socket/udpsocket/bind_spec.rb
@@ -18,7 +18,7 @@ describe "UDPSocket#bind" do
it "raises Errno::EINVAL when already bound" do
@socket.bind(SocketSpecs.hostname, 0)
- lambda {
+ -> {
@socket.bind(SocketSpecs.hostname, @socket.addr[1])
}.should raise_error(Errno::EINVAL)
end
diff --git a/spec/ruby/library/socket/udpsocket/new_spec.rb b/spec/ruby/library/socket/udpsocket/new_spec.rb
index 157ff138be..6cc0cadbcb 100644
--- a/spec/ruby/library/socket/udpsocket/new_spec.rb
+++ b/spec/ruby/library/socket/udpsocket/new_spec.rb
@@ -27,7 +27,7 @@ describe 'UDPSocket.new' do
end
it 'raises Errno::EAFNOSUPPORT or Errno::EPROTONOSUPPORT if unsupported family passed' do
- lambda { UDPSocket.new(-1) }.should raise_error(SystemCallError) { |e|
+ -> { UDPSocket.new(-1) }.should raise_error(SystemCallError) { |e|
[Errno::EAFNOSUPPORT, Errno::EPROTONOSUPPORT].should include(e.class)
}
end
diff --git a/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb b/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb
index fb88a2dc13..c66d1df84d 100644
--- a/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb
+++ b/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb
@@ -16,7 +16,7 @@ describe 'UDPSocket#recvfrom_nonblock' do
platform_is_not :windows do
describe 'using an unbound socket' do
it 'raises IO::WaitReadable' do
- lambda { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable)
+ -> { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable)
end
end
end
@@ -32,7 +32,7 @@ describe 'UDPSocket#recvfrom_nonblock' do
describe 'without any data available' do
it 'raises IO::WaitReadable' do
- lambda { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable)
+ -> { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable)
end
it 'returns :wait_readable with exception: false' do
diff --git a/spec/ruby/library/socket/udpsocket/send_spec.rb b/spec/ruby/library/socket/udpsocket/send_spec.rb
index 431129723e..5d5de684af 100644
--- a/spec/ruby/library/socket/udpsocket/send_spec.rb
+++ b/spec/ruby/library/socket/udpsocket/send_spec.rb
@@ -66,7 +66,7 @@ describe "UDPSocket#send" do
it "raises EMSGSIZE if data is too too big" do
@socket = UDPSocket.open
begin
- lambda do
+ -> do
@socket.send('1' * 100_000, 0, SocketSpecs.hostname, @port.to_s)
end.should raise_error(Errno::EMSGSIZE)
ensure
@@ -96,7 +96,7 @@ describe 'UDPSocket#send' do
describe 'using a disconnected socket' do
describe 'without a destination address' do
it "raises #{SocketSpecs.dest_addr_req_error}" do
- lambda { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error)
+ -> { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error)
end
end
@@ -108,7 +108,7 @@ describe 'UDPSocket#send' do
it 'does not persist the connection after sending data' do
@client.send('hello', 0, @addr.ip_address, @addr.ip_port)
- lambda { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error)
+ -> { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error)
end
end
@@ -144,7 +144,7 @@ describe 'UDPSocket#send' do
it 'sends the data to the given address instead' do
@client.send('hello', 0, @alt_server.getsockname).should == 5
- lambda { @server.recv(5) }.should block_caller
+ -> { @server.recv(5) }.should block_caller
@alt_server.recv(5).should == 'hello'
end
diff --git a/spec/ruby/library/socket/udpsocket/write_spec.rb b/spec/ruby/library/socket/udpsocket/write_spec.rb
index e960de1baf..c971f29b62 100644
--- a/spec/ruby/library/socket/udpsocket/write_spec.rb
+++ b/spec/ruby/library/socket/udpsocket/write_spec.rb
@@ -10,7 +10,7 @@ describe "UDPSocket#write" do
s2 = UDPSocket.new
s2.connect(host, s1.addr[1])
- lambda do
+ -> do
s2.write('1' * 100_000)
end.should raise_error(Errno::EMSGSIZE)
ensure
diff --git a/spec/ruby/library/socket/unixserver/accept_nonblock_spec.rb b/spec/ruby/library/socket/unixserver/accept_nonblock_spec.rb
index 3ebe38a090..30688b46b6 100644
--- a/spec/ruby/library/socket/unixserver/accept_nonblock_spec.rb
+++ b/spec/ruby/library/socket/unixserver/accept_nonblock_spec.rb
@@ -49,7 +49,7 @@ with_feature :unix_socket do
describe 'without a client' do
it 'raises IO::WaitReadable' do
- lambda { @server.accept_nonblock }.should raise_error(IO::WaitReadable)
+ -> { @server.accept_nonblock }.should raise_error(IO::WaitReadable)
end
end
diff --git a/spec/ruby/library/socket/unixserver/accept_spec.rb b/spec/ruby/library/socket/unixserver/accept_spec.rb
index a1570f7013..c05fbe7f22 100644
--- a/spec/ruby/library/socket/unixserver/accept_spec.rb
+++ b/spec/ruby/library/socket/unixserver/accept_spec.rb
@@ -74,7 +74,7 @@ with_feature :unix_socket do
describe 'without a client' do
it 'blocks the calling thread' do
- lambda { @server.accept }.should block_caller
+ -> { @server.accept }.should block_caller
end
end
diff --git a/spec/ruby/library/socket/unixserver/initialize_spec.rb b/spec/ruby/library/socket/unixserver/initialize_spec.rb
index cb186ceb76..0cc49ef1eb 100644
--- a/spec/ruby/library/socket/unixserver/initialize_spec.rb
+++ b/spec/ruby/library/socket/unixserver/initialize_spec.rb
@@ -22,7 +22,7 @@ with_feature :unix_socket do
end
it 'raises Errno::EADDRINUSE when the socket is already in use' do
- lambda { UNIXServer.new(@path) }.should raise_error(Errno::EADDRINUSE)
+ -> { UNIXServer.new(@path) }.should raise_error(Errno::EADDRINUSE)
end
end
end
diff --git a/spec/ruby/library/socket/unixserver/sysaccept_spec.rb b/spec/ruby/library/socket/unixserver/sysaccept_spec.rb
index 65a35c91a9..e59731878a 100644
--- a/spec/ruby/library/socket/unixserver/sysaccept_spec.rb
+++ b/spec/ruby/library/socket/unixserver/sysaccept_spec.rb
@@ -16,7 +16,7 @@ with_feature :unix_socket do
describe 'without a client' do
it 'blocks the calling thread' do
- lambda { @server.sysaccept }.should block_caller
+ -> { @server.sysaccept }.should block_caller
end
end
diff --git a/spec/ruby/library/socket/unixsocket/initialize_spec.rb b/spec/ruby/library/socket/unixsocket/initialize_spec.rb
index a6217d404f..13b6972f03 100644
--- a/spec/ruby/library/socket/unixsocket/initialize_spec.rb
+++ b/spec/ruby/library/socket/unixsocket/initialize_spec.rb
@@ -5,7 +5,7 @@ with_feature :unix_socket do
describe 'UNIXSocket#initialize' do
describe 'using a non existing path' do
it 'raises Errno::ENOENT' do
- lambda { UNIXSocket.new(SocketSpecs.socket_path) }.should raise_error(Errno::ENOENT)
+ -> { UNIXSocket.new(SocketSpecs.socket_path) }.should raise_error(Errno::ENOENT)
end
end
diff --git a/spec/ruby/library/socket/unixsocket/peeraddr_spec.rb b/spec/ruby/library/socket/unixsocket/peeraddr_spec.rb
index e39c8a0570..0b6b1ccf04 100644
--- a/spec/ruby/library/socket/unixsocket/peeraddr_spec.rb
+++ b/spec/ruby/library/socket/unixsocket/peeraddr_spec.rb
@@ -21,7 +21,7 @@ describe "UNIXSocket#peeraddr" do
end
it "raises an error in server sockets" do
- lambda {
+ -> {
@server.peeraddr
}.should raise_error(Errno::ENOTCONN)
end
diff --git a/spec/ruby/library/stringio/append_spec.rb b/spec/ruby/library/stringio/append_spec.rb
index 08500bc520..a8bc6aabdb 100644
--- a/spec/ruby/library/stringio/append_spec.rb
+++ b/spec/ruby/library/stringio/append_spec.rb
@@ -55,11 +55,11 @@ end
describe "StringIO#<< when self is not writable" do
it "raises an IOError" do
io = StringIO.new("test", "r")
- lambda { io << "test" }.should raise_error(IOError)
+ -> { io << "test" }.should raise_error(IOError)
io = StringIO.new("test")
io.close_write
- lambda { io << "test" }.should raise_error(IOError)
+ -> { io << "test" }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/close_read_spec.rb b/spec/ruby/library/stringio/close_read_spec.rb
index 05d6c9f7d2..80bd547e85 100644
--- a/spec/ruby/library/stringio/close_read_spec.rb
+++ b/spec/ruby/library/stringio/close_read_spec.rb
@@ -12,7 +12,7 @@ describe "StringIO#close_read" do
it "prevents further reading" do
@io.close_read
- lambda { @io.read(1) }.should raise_error(IOError)
+ -> { @io.read(1) }.should raise_error(IOError)
end
it "allows further writing" do
@@ -22,7 +22,7 @@ describe "StringIO#close_read" do
it "raises an IOError when in write-only mode" do
io = StringIO.new("example", "w")
- lambda { io.close_read }.should raise_error(IOError)
+ -> { io.close_read }.should raise_error(IOError)
io = StringIO.new("example")
io.close_read
diff --git a/spec/ruby/library/stringio/close_spec.rb b/spec/ruby/library/stringio/close_spec.rb
index a5a931aff1..520a8de782 100644
--- a/spec/ruby/library/stringio/close_spec.rb
+++ b/spec/ruby/library/stringio/close_spec.rb
@@ -12,12 +12,12 @@ describe "StringIO#close" do
it "prevents further reading and/or writing" do
@io.close
- lambda { @io.read(1) }.should raise_error(IOError)
- lambda { @io.write('x') }.should raise_error(IOError)
+ -> { @io.read(1) }.should raise_error(IOError)
+ -> { @io.write('x') }.should raise_error(IOError)
end
it "does not raise anything when self was already closed" do
@io.close
- lambda { @io.close }.should_not raise_error(IOError)
+ -> { @io.close }.should_not raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/close_write_spec.rb b/spec/ruby/library/stringio/close_write_spec.rb
index 8a7ac12581..1a4cfa113e 100644
--- a/spec/ruby/library/stringio/close_write_spec.rb
+++ b/spec/ruby/library/stringio/close_write_spec.rb
@@ -12,7 +12,7 @@ describe "StringIO#close_write" do
it "prevents further writing" do
@io.close_write
- lambda { @io.write('x') }.should raise_error(IOError)
+ -> { @io.write('x') }.should raise_error(IOError)
end
it "allows further reading" do
@@ -22,7 +22,7 @@ describe "StringIO#close_write" do
it "raises an IOError when in read-only mode" do
io = StringIO.new("example", "r")
- lambda { io.close_write }.should raise_error(IOError)
+ -> { io.close_write }.should raise_error(IOError)
io = StringIO.new("example")
io.close_write
diff --git a/spec/ruby/library/stringio/fcntl_spec.rb b/spec/ruby/library/stringio/fcntl_spec.rb
index e4133c0d06..a78004d868 100644
--- a/spec/ruby/library/stringio/fcntl_spec.rb
+++ b/spec/ruby/library/stringio/fcntl_spec.rb
@@ -3,6 +3,6 @@ require_relative 'fixtures/classes'
describe "StringIO#fcntl" do
it "raises a NotImplementedError" do
- lambda { StringIO.new("boom").fcntl }.should raise_error(NotImplementedError)
+ -> { StringIO.new("boom").fcntl }.should raise_error(NotImplementedError)
end
end
diff --git a/spec/ruby/library/stringio/gets_spec.rb b/spec/ruby/library/stringio/gets_spec.rb
index d682b2784f..69880672a3 100644
--- a/spec/ruby/library/stringio/gets_spec.rb
+++ b/spec/ruby/library/stringio/gets_spec.rb
@@ -229,11 +229,11 @@ end
describe "StringIO#gets when in write-only mode" do
it "raises an IOError" do
io = StringIO.new("xyz", "w")
- lambda { io.gets }.should raise_error(IOError)
+ -> { io.gets }.should raise_error(IOError)
io = StringIO.new("xyz")
io.close_read
- lambda { io.gets }.should raise_error(IOError)
+ -> { io.gets }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/initialize_spec.rb b/spec/ruby/library/stringio/initialize_spec.rb
index b503ed2206..cc4f4c9254 100644
--- a/spec/ruby/library/stringio/initialize_spec.rb
+++ b/spec/ruby/library/stringio/initialize_spec.rb
@@ -112,7 +112,7 @@ describe "StringIO#initialize when passed [Object, mode]" do
it "raises a #{frozen_error_class} when passed a frozen String in truncate mode as StringIO backend" do
io = StringIO.allocate
- lambda { io.send(:initialize, "example".freeze, IO::TRUNC) }.should raise_error(frozen_error_class)
+ -> { io.send(:initialize, "example".freeze, IO::TRUNC) }.should raise_error(frozen_error_class)
end
it "tries to convert the passed mode to a String using #to_str" do
@@ -126,9 +126,9 @@ describe "StringIO#initialize when passed [Object, mode]" do
it "raises an Errno::EACCES error when passed a frozen string with a write-mode" do
(str = "example").freeze
- lambda { @io.send(:initialize, str, "r+") }.should raise_error(Errno::EACCES)
- lambda { @io.send(:initialize, str, "w") }.should raise_error(Errno::EACCES)
- lambda { @io.send(:initialize, str, "a") }.should raise_error(Errno::EACCES)
+ -> { @io.send(:initialize, str, "r+") }.should raise_error(Errno::EACCES)
+ -> { @io.send(:initialize, str, "w") }.should raise_error(Errno::EACCES)
+ -> { @io.send(:initialize, str, "a") }.should raise_error(Errno::EACCES)
end
end
diff --git a/spec/ruby/library/stringio/open_spec.rb b/spec/ruby/library/stringio/open_spec.rb
index f8f3feabee..adb784c890 100644
--- a/spec/ruby/library/stringio/open_spec.rb
+++ b/spec/ruby/library/stringio/open_spec.rb
@@ -135,7 +135,7 @@ describe "StringIO.open when passed [Object, mode]" do
end
it "raises a #{frozen_error_class} when passed a frozen String in truncate mode as StringIO backend" do
- lambda { StringIO.open("example".freeze, IO::TRUNC) }.should raise_error(frozen_error_class)
+ -> { StringIO.open("example".freeze, IO::TRUNC) }.should raise_error(frozen_error_class)
end
it "tries to convert the passed mode to a String using #to_str" do
@@ -149,9 +149,9 @@ describe "StringIO.open when passed [Object, mode]" do
it "raises an Errno::EACCES error when passed a frozen string with a write-mode" do
(str = "example").freeze
- lambda { StringIO.open(str, "r+") }.should raise_error(Errno::EACCES)
- lambda { StringIO.open(str, "w") }.should raise_error(Errno::EACCES)
- lambda { StringIO.open(str, "a") }.should raise_error(Errno::EACCES)
+ -> { StringIO.open(str, "r+") }.should raise_error(Errno::EACCES)
+ -> { StringIO.open(str, "w") }.should raise_error(Errno::EACCES)
+ -> { StringIO.open(str, "a") }.should raise_error(Errno::EACCES)
end
end
diff --git a/spec/ruby/library/stringio/path_spec.rb b/spec/ruby/library/stringio/path_spec.rb
index 5439cf4b53..1184ca523f 100644
--- a/spec/ruby/library/stringio/path_spec.rb
+++ b/spec/ruby/library/stringio/path_spec.rb
@@ -3,6 +3,6 @@ require_relative 'fixtures/classes'
describe "StringIO#path" do
it "is not defined" do
- lambda { StringIO.new("path").path }.should raise_error(NoMethodError)
+ -> { StringIO.new("path").path }.should raise_error(NoMethodError)
end
end
diff --git a/spec/ruby/library/stringio/pos_spec.rb b/spec/ruby/library/stringio/pos_spec.rb
index 8d99294f31..81be5f01a5 100644
--- a/spec/ruby/library/stringio/pos_spec.rb
+++ b/spec/ruby/library/stringio/pos_spec.rb
@@ -17,7 +17,7 @@ describe "StringIO#pos=" do
end
it "raises an EINVAL if given a negative argument" do
- lambda { @io.pos = -10 }.should raise_error(Errno::EINVAL)
+ -> { @io.pos = -10 }.should raise_error(Errno::EINVAL)
end
it "updates the current byte offset after reaching EOF" do
diff --git a/spec/ruby/library/stringio/print_spec.rb b/spec/ruby/library/stringio/print_spec.rb
index 144a219509..d0f07d1e50 100644
--- a/spec/ruby/library/stringio/print_spec.rb
+++ b/spec/ruby/library/stringio/print_spec.rb
@@ -91,10 +91,10 @@ end
describe "StringIO#print when self is not writable" do
it "raises an IOError" do
io = StringIO.new("test", "r")
- lambda { io.print("test") }.should raise_error(IOError)
+ -> { io.print("test") }.should raise_error(IOError)
io = StringIO.new("test")
io.close_write
- lambda { io.print("test") }.should raise_error(IOError)
+ -> { io.print("test") }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/printf_spec.rb b/spec/ruby/library/stringio/printf_spec.rb
index 3978896621..f88ca1eb20 100644
--- a/spec/ruby/library/stringio/printf_spec.rb
+++ b/spec/ruby/library/stringio/printf_spec.rb
@@ -31,7 +31,7 @@ describe "StringIO#printf" do
end
describe "formatting" do
- it_behaves_like :kernel_sprintf, -> (format, *args) {
+ it_behaves_like :kernel_sprintf, -> format, *args {
io = StringIO.new
io.printf(format, *args)
io.string
@@ -61,10 +61,10 @@ end
describe "StringIO#printf when self is not writable" do
it "raises an IOError" do
io = StringIO.new("test", "r")
- lambda { io.printf("test") }.should raise_error(IOError)
+ -> { io.printf("test") }.should raise_error(IOError)
io = StringIO.new("test")
io.close_write
- lambda { io.printf("test") }.should raise_error(IOError)
+ -> { io.printf("test") }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/putc_spec.rb b/spec/ruby/library/stringio/putc_spec.rb
index eae5481d6e..223b3523e5 100644
--- a/spec/ruby/library/stringio/putc_spec.rb
+++ b/spec/ruby/library/stringio/putc_spec.rb
@@ -64,7 +64,7 @@ describe "StringIO#putc when passed [Object]" do
end
it "raises a TypeError when the passed argument can't be coerced to Integer" do
- lambda { @io.putc(Object.new) }.should raise_error(TypeError)
+ -> { @io.putc(Object.new) }.should raise_error(TypeError)
end
end
@@ -79,10 +79,10 @@ end
describe "StringIO#putc when self is not writable" do
it "raises an IOError" do
io = StringIO.new("test", "r")
- lambda { io.putc(?a) }.should raise_error(IOError)
+ -> { io.putc(?a) }.should raise_error(IOError)
io = StringIO.new("test")
io.close_write
- lambda { io.putc("t") }.should raise_error(IOError)
+ -> { io.putc("t") }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/puts_spec.rb b/spec/ruby/library/stringio/puts_spec.rb
index 152bfb13f8..2d3db25c5f 100644
--- a/spec/ruby/library/stringio/puts_spec.rb
+++ b/spec/ruby/library/stringio/puts_spec.rb
@@ -148,11 +148,11 @@ end
describe "StringIO#puts when self is not writable" do
it "raises an IOError" do
io = StringIO.new("test", "r")
- lambda { io.puts }.should raise_error(IOError)
+ -> { io.puts }.should raise_error(IOError)
io = StringIO.new("test")
io.close_write
- lambda { io.puts }.should raise_error(IOError)
+ -> { io.puts }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/readline_spec.rb b/spec/ruby/library/stringio/readline_spec.rb
index dc396f61a9..9af633472e 100644
--- a/spec/ruby/library/stringio/readline_spec.rb
+++ b/spec/ruby/library/stringio/readline_spec.rb
@@ -106,18 +106,18 @@ describe "StringIO#readline when passed no argument" do
it "raises an IOError if self is at the end" do
@io.pos = 40
- lambda { @io.readline }.should raise_error(IOError)
+ -> { @io.readline }.should raise_error(IOError)
end
end
describe "StringIO#readline when in write-only mode" do
it "raises an IOError" do
io = StringIO.new("xyz", "w")
- lambda { io.readline }.should raise_error(IOError)
+ -> { io.readline }.should raise_error(IOError)
io = StringIO.new("xyz")
io.close_read
- lambda { io.readline }.should raise_error(IOError)
+ -> { io.readline }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/readlines_spec.rb b/spec/ruby/library/stringio/readlines_spec.rb
index 840470c09c..7f9f9f5846 100644
--- a/spec/ruby/library/stringio/readlines_spec.rb
+++ b/spec/ruby/library/stringio/readlines_spec.rb
@@ -83,11 +83,11 @@ end
describe "StringIO#readlines when in write-only mode" do
it "raises an IOError" do
io = StringIO.new("xyz", "w")
- lambda { io.readlines }.should raise_error(IOError)
+ -> { io.readlines }.should raise_error(IOError)
io = StringIO.new("xyz")
io.close_read
- lambda { io.readlines }.should raise_error(IOError)
+ -> { io.readlines }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/readpartial_spec.rb b/spec/ruby/library/stringio/readpartial_spec.rb
index 54e2f47004..2601fe8c42 100644
--- a/spec/ruby/library/stringio/readpartial_spec.rb
+++ b/spec/ruby/library/stringio/readpartial_spec.rb
@@ -12,7 +12,7 @@ describe "StringIO#readpartial" do
it "raises IOError on closed stream" do
@string.close
- lambda { @string.readpartial(10) }.should raise_error(IOError)
+ -> { @string.readpartial(10) }.should raise_error(IOError)
end
it "reads at most the specified number of bytes" do
@@ -55,23 +55,23 @@ describe "StringIO#readpartial" do
it "raises EOFError on EOF" do
@string.readpartial(18).should == 'Stop, look, listen'
- lambda { @string.readpartial(10) }.should raise_error(EOFError)
+ -> { @string.readpartial(10) }.should raise_error(EOFError)
end
it "discards the existing buffer content upon error" do
buffer = 'hello'
@string.readpartial(100)
- lambda { @string.readpartial(1, buffer) }.should raise_error(EOFError)
+ -> { @string.readpartial(1, buffer) }.should raise_error(EOFError)
buffer.should be_empty
end
it "raises IOError if the stream is closed" do
@string.close
- lambda { @string.readpartial(1) }.should raise_error(IOError)
+ -> { @string.readpartial(1) }.should raise_error(IOError)
end
it "raises ArgumentError if the negative argument is provided" do
- lambda { @string.readpartial(-1) }.should raise_error(ArgumentError)
+ -> { @string.readpartial(-1) }.should raise_error(ArgumentError)
end
it "immediately returns an empty string if the length argument is 0" do
diff --git a/spec/ruby/library/stringio/reopen_spec.rb b/spec/ruby/library/stringio/reopen_spec.rb
index 51aff43ba2..6b5bdb57a1 100644
--- a/spec/ruby/library/stringio/reopen_spec.rb
+++ b/spec/ruby/library/stringio/reopen_spec.rb
@@ -40,16 +40,16 @@ describe "StringIO#reopen when passed [Object, Integer]" do
end
it "raises a TypeError when the passed Object can't be converted to a String" do
- lambda { @io.reopen(Object.new, IO::RDWR) }.should raise_error(TypeError)
+ -> { @io.reopen(Object.new, IO::RDWR) }.should raise_error(TypeError)
end
it "raises an Errno::EACCES when trying to reopen self with a frozen String in write-mode" do
- lambda { @io.reopen("burn".freeze, IO::WRONLY) }.should raise_error(Errno::EACCES)
- lambda { @io.reopen("burn".freeze, IO::WRONLY | IO::APPEND) }.should raise_error(Errno::EACCES)
+ -> { @io.reopen("burn".freeze, IO::WRONLY) }.should raise_error(Errno::EACCES)
+ -> { @io.reopen("burn".freeze, IO::WRONLY | IO::APPEND) }.should raise_error(Errno::EACCES)
end
it "raises a #{frozen_error_class} when trying to reopen self with a frozen String in truncate-mode" do
- lambda { @io.reopen("burn".freeze, IO::RDONLY | IO::TRUNC) }.should raise_error(frozen_error_class)
+ -> { @io.reopen("burn".freeze, IO::RDONLY | IO::TRUNC) }.should raise_error(frozen_error_class)
end
it "does not raise IOError when passed a frozen String in read-mode" do
@@ -107,7 +107,7 @@ describe "StringIO#reopen when passed [Object, Object]" do
end
it "raises a TypeError when the passed Object can't be converted to a String using #to_str" do
- lambda { @io.reopen(Object.new, "r") }.should raise_error(TypeError)
+ -> { @io.reopen(Object.new, "r") }.should raise_error(TypeError)
end
it "resets self's position to 0" do
@@ -132,10 +132,10 @@ describe "StringIO#reopen when passed [Object, Object]" do
end
it "raises an Errno::EACCES error when trying to reopen self with a frozen String in write-mode" do
- lambda { @io.reopen("burn".freeze, 'w') }.should raise_error(Errno::EACCES)
- lambda { @io.reopen("burn".freeze, 'w+') }.should raise_error(Errno::EACCES)
- lambda { @io.reopen("burn".freeze, 'a') }.should raise_error(Errno::EACCES)
- lambda { @io.reopen("burn".freeze, "r+") }.should raise_error(Errno::EACCES)
+ -> { @io.reopen("burn".freeze, 'w') }.should raise_error(Errno::EACCES)
+ -> { @io.reopen("burn".freeze, 'w+') }.should raise_error(Errno::EACCES)
+ -> { @io.reopen("burn".freeze, 'a') }.should raise_error(Errno::EACCES)
+ -> { @io.reopen("burn".freeze, "r+") }.should raise_error(Errno::EACCES)
end
it "does not raise IOError if a frozen string is passed in read mode" do
@@ -185,13 +185,13 @@ describe "StringIO#reopen when passed [Object]" do
end
it "raises a TypeError when passed an Object that can't be converted to a StringIO" do
- lambda { @io.reopen(Object.new) }.should raise_error(TypeError)
+ -> { @io.reopen(Object.new) }.should raise_error(TypeError)
end
it "does not try to convert the passed Object to a String using #to_str" do
obj = mock("not to_str")
obj.should_not_receive(:to_str)
- lambda { @io.reopen(obj) }.should raise_error(TypeError)
+ -> { @io.reopen(obj) }.should raise_error(TypeError)
end
it "tries to convert the passed Object to a StringIO using #to_strio" do
diff --git a/spec/ruby/library/stringio/seek_spec.rb b/spec/ruby/library/stringio/seek_spec.rb
index b963b77eef..253b5027a9 100644
--- a/spec/ruby/library/stringio/seek_spec.rb
+++ b/spec/ruby/library/stringio/seek_spec.rb
@@ -33,14 +33,14 @@ describe "StringIO#seek" do
end
it "raises an Errno::EINVAL error on negative amounts when whence is IO::SEEK_SET" do
- lambda { @io.seek(-5, IO::SEEK_SET) }.should raise_error(Errno::EINVAL)
+ -> { @io.seek(-5, IO::SEEK_SET) }.should raise_error(Errno::EINVAL)
end
it "raises an Errno::EINVAL error on incorrect whence argument" do
- lambda { @io.seek(0, 3) }.should raise_error(Errno::EINVAL)
- lambda { @io.seek(0, -1) }.should raise_error(Errno::EINVAL)
- lambda { @io.seek(0, 2**16) }.should raise_error(Errno::EINVAL)
- lambda { @io.seek(0, -2**16) }.should raise_error(Errno::EINVAL)
+ -> { @io.seek(0, 3) }.should raise_error(Errno::EINVAL)
+ -> { @io.seek(0, -1) }.should raise_error(Errno::EINVAL)
+ -> { @io.seek(0, 2**16) }.should raise_error(Errno::EINVAL)
+ -> { @io.seek(0, -2**16) }.should raise_error(Errno::EINVAL)
end
it "tries to convert the passed Object to a String using #to_int" do
@@ -51,7 +51,7 @@ describe "StringIO#seek" do
end
it "raises a TypeError when the passed Object can't be converted to an Integer" do
- lambda { @io.seek(Object.new) }.should raise_error(TypeError)
+ -> { @io.seek(Object.new) }.should raise_error(TypeError)
end
end
@@ -62,6 +62,6 @@ describe "StringIO#seek when self is closed" do
end
it "raises an IOError" do
- lambda { @io.seek(5) }.should raise_error(IOError)
+ -> { @io.seek(5) }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/shared/codepoints.rb b/spec/ruby/library/stringio/shared/codepoints.rb
index c8ca03329f..9d84aa4919 100644
--- a/spec/ruby/library/stringio/shared/codepoints.rb
+++ b/spec/ruby/library/stringio/shared/codepoints.rb
@@ -20,15 +20,15 @@ describe :stringio_codepoints, shared: true do
it "raises an error if reading invalid sequence" do
@io.pos = 1 # inside of a multibyte sequence
- lambda { @enum.first }.should raise_error(ArgumentError)
+ -> { @enum.first }.should raise_error(ArgumentError)
end
it "raises an IOError if not readable" do
@io.close_read
- lambda { @enum.to_a }.should raise_error(IOError)
+ -> { @enum.to_a }.should raise_error(IOError)
io = StringIO.new("xyz", "w")
- lambda { io.send(@method).to_a }.should raise_error(IOError)
+ -> { io.send(@method).to_a }.should raise_error(IOError)
end
diff --git a/spec/ruby/library/stringio/shared/each.rb b/spec/ruby/library/stringio/shared/each.rb
index 55ed27c1c7..c08d40344c 100644
--- a/spec/ruby/library/stringio/shared/each.rb
+++ b/spec/ruby/library/stringio/shared/each.rb
@@ -96,11 +96,11 @@ end
describe :stringio_each_not_readable, shared: true do
it "raises an IOError" do
io = StringIO.new("a b c d e", "w")
- lambda { io.send(@method) { |b| b } }.should raise_error(IOError)
+ -> { io.send(@method) { |b| b } }.should raise_error(IOError)
io = StringIO.new("a b c d e")
io.close_read
- lambda { io.send(@method) { |b| b } }.should raise_error(IOError)
+ -> { io.send(@method) { |b| b } }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/shared/each_byte.rb b/spec/ruby/library/stringio/shared/each_byte.rb
index 1dc48ee437..56734ff99d 100644
--- a/spec/ruby/library/stringio/shared/each_byte.rb
+++ b/spec/ruby/library/stringio/shared/each_byte.rb
@@ -39,10 +39,10 @@ end
describe :stringio_each_byte_not_readable, shared: true do
it "raises an IOError" do
io = StringIO.new("xyz", "w")
- lambda { io.send(@method) { |b| b } }.should raise_error(IOError)
+ -> { io.send(@method) { |b| b } }.should raise_error(IOError)
io = StringIO.new("xyz")
io.close_read
- lambda { io.send(@method) { |b| b } }.should raise_error(IOError)
+ -> { io.send(@method) { |b| b } }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/shared/each_char.rb b/spec/ruby/library/stringio/shared/each_char.rb
index 35efdcb749..bcdac53282 100644
--- a/spec/ruby/library/stringio/shared/each_char.rb
+++ b/spec/ruby/library/stringio/shared/each_char.rb
@@ -27,10 +27,10 @@ end
describe :stringio_each_char_not_readable, shared: true do
it "raises an IOError" do
io = StringIO.new("xyz", "w")
- lambda { io.send(@method) { |b| b } }.should raise_error(IOError)
+ -> { io.send(@method) { |b| b } }.should raise_error(IOError)
io = StringIO.new("xyz")
io.close_read
- lambda { io.send(@method) { |b| b } }.should raise_error(IOError)
+ -> { io.send(@method) { |b| b } }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/shared/getc.rb b/spec/ruby/library/stringio/shared/getc.rb
index 3e064f9c1e..6318bcc30f 100644
--- a/spec/ruby/library/stringio/shared/getc.rb
+++ b/spec/ruby/library/stringio/shared/getc.rb
@@ -34,10 +34,10 @@ end
describe :stringio_getc_not_readable, shared: true do
it "raises an IOError" do
io = StringIO.new("xyz", "w")
- lambda { io.send(@method) }.should raise_error(IOError)
+ -> { io.send(@method) }.should raise_error(IOError)
io = StringIO.new("xyz")
io.close_read
- lambda { io.send(@method) }.should raise_error(IOError)
+ -> { io.send(@method) }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/shared/read.rb b/spec/ruby/library/stringio/shared/read.rb
index 139c4fb02f..15ce58ae6a 100644
--- a/spec/ruby/library/stringio/shared/read.rb
+++ b/spec/ruby/library/stringio/shared/read.rb
@@ -24,11 +24,11 @@ describe :stringio_read, shared: true do
end
it "raises a TypeError when the passed buffer Object can't be converted to a String" do
- lambda { @io.send(@method, 7, Object.new) }.should raise_error(TypeError)
+ -> { @io.send(@method, 7, Object.new) }.should raise_error(TypeError)
end
it "raises a #{frozen_error_class} error when passed a frozen String as buffer" do
- lambda { @io.send(@method, 7, "".freeze) }.should raise_error(frozen_error_class)
+ -> { @io.send(@method, 7, "".freeze) }.should raise_error(frozen_error_class)
end
end
@@ -61,11 +61,11 @@ describe :stringio_read_length, shared: true do
end
it "raises a TypeError when the passed length can't be converted to an Integer" do
- lambda { @io.send(@method, Object.new) }.should raise_error(TypeError)
+ -> { @io.send(@method, Object.new) }.should raise_error(TypeError)
end
it "raises a TypeError when the passed length is negative" do
- lambda { @io.send(@method, -2) }.should raise_error(ArgumentError)
+ -> { @io.send(@method, -2) }.should raise_error(ArgumentError)
end
it "returns a binary String" do
@@ -112,10 +112,10 @@ end
describe :stringio_read_not_readable, shared: true do
it "raises an IOError" do
io = StringIO.new("test", "w")
- lambda { io.send(@method) }.should raise_error(IOError)
+ -> { io.send(@method) }.should raise_error(IOError)
io = StringIO.new("test")
io.close_read
- lambda { io.send(@method) }.should raise_error(IOError)
+ -> { io.send(@method) }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/shared/readchar.rb b/spec/ruby/library/stringio/shared/readchar.rb
index 19194f0680..4248e75420 100644
--- a/spec/ruby/library/stringio/shared/readchar.rb
+++ b/spec/ruby/library/stringio/shared/readchar.rb
@@ -13,17 +13,17 @@ describe :stringio_readchar, shared: true do
it "raises an EOFError when self is at the end" do
@io.pos = 7
- lambda { @io.send(@method) }.should raise_error(EOFError)
+ -> { @io.send(@method) }.should raise_error(EOFError)
end
end
describe :stringio_readchar_not_readable, shared: true do
it "raises an IOError" do
io = StringIO.new("a b c d e", "w")
- lambda { io.send(@method) }.should raise_error(IOError)
+ -> { io.send(@method) }.should raise_error(IOError)
io = StringIO.new("a b c d e")
io.close_read
- lambda { io.send(@method) }.should raise_error(IOError)
+ -> { io.send(@method) }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/shared/sysread.rb b/spec/ruby/library/stringio/shared/sysread.rb
index 9800b2339b..3376bd9907 100644
--- a/spec/ruby/library/stringio/shared/sysread.rb
+++ b/spec/ruby/library/stringio/shared/sysread.rb
@@ -10,6 +10,6 @@ describe :stringio_sysread_length, :shared => true do
it "raises an EOFError when passed length > 0 and no data remains" do
@io.read.should == "example"
- lambda { @io.sysread(1) }.should raise_error(EOFError)
+ -> { @io.sysread(1) }.should raise_error(EOFError)
end
end
diff --git a/spec/ruby/library/stringio/shared/write.rb b/spec/ruby/library/stringio/shared/write.rb
index bcb548bbd0..df4822cc16 100644
--- a/spec/ruby/library/stringio/shared/write.rb
+++ b/spec/ruby/library/stringio/shared/write.rb
@@ -59,11 +59,11 @@ end
describe :stringio_write_not_writable, shared: true do
it "raises an IOError" do
io = StringIO.new("test", "r")
- lambda { io.send(@method, "test") }.should raise_error(IOError)
+ -> { io.send(@method, "test") }.should raise_error(IOError)
io = StringIO.new("test")
io.close_write
- lambda { io.send(@method, "test") }.should raise_error(IOError)
+ -> { io.send(@method, "test") }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/string_spec.rb b/spec/ruby/library/stringio/string_spec.rb
index 384986c161..1ed5233ba6 100644
--- a/spec/ruby/library/stringio/string_spec.rb
+++ b/spec/ruby/library/stringio/string_spec.rb
@@ -45,6 +45,6 @@ describe "StringIO#string=" do
end
it "raises a TypeError when the passed Object can't be converted to an Integer" do
- lambda { @io.seek(Object.new) }.should raise_error(TypeError)
+ -> { @io.seek(Object.new) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/stringio/sysread_spec.rb b/spec/ruby/library/stringio/sysread_spec.rb
index ee69801444..8f78073f42 100644
--- a/spec/ruby/library/stringio/sysread_spec.rb
+++ b/spec/ruby/library/stringio/sysread_spec.rb
@@ -39,7 +39,7 @@ describe "StringIO#sysread when passed [length]" do
it "raises an EOFError when self's position is at the end" do
@io.pos = 7
- lambda { @io.sysread(10) }.should raise_error(EOFError)
+ -> { @io.sysread(10) }.should raise_error(EOFError)
end
it "returns an empty String when length is 0" do
diff --git a/spec/ruby/library/stringio/truncate_spec.rb b/spec/ruby/library/stringio/truncate_spec.rb
index d0d61af70a..ba910ee98c 100644
--- a/spec/ruby/library/stringio/truncate_spec.rb
+++ b/spec/ruby/library/stringio/truncate_spec.rb
@@ -35,8 +35,8 @@ describe "StringIO#truncate when passed [length]" do
end
it "raises an Errno::EINVAL when the passed length is negative" do
- lambda { @io.truncate(-1) }.should raise_error(Errno::EINVAL)
- lambda { @io.truncate(-10) }.should raise_error(Errno::EINVAL)
+ -> { @io.truncate(-1) }.should raise_error(Errno::EINVAL)
+ -> { @io.truncate(-10) }.should raise_error(Errno::EINVAL)
end
it "tries to convert the passed length to an Integer using #to_int" do
@@ -54,17 +54,17 @@ describe "StringIO#truncate when passed [length]" do
end
it "raises a TypeError when the passed length can't be converted to an Integer" do
- lambda { @io.truncate(Object.new) }.should raise_error(TypeError)
+ -> { @io.truncate(Object.new) }.should raise_error(TypeError)
end
end
describe "StringIO#truncate when self is not writable" do
it "raises an IOError" do
io = StringIO.new("test", "r")
- lambda { io.truncate(2) }.should raise_error(IOError)
+ -> { io.truncate(2) }.should raise_error(IOError)
io = StringIO.new("test")
io.close_write
- lambda { io.truncate(2) }.should raise_error(IOError)
+ -> { io.truncate(2) }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/ungetc_spec.rb b/spec/ruby/library/stringio/ungetc_spec.rb
index 8a9205f390..91ef2100a1 100644
--- a/spec/ruby/library/stringio/ungetc_spec.rb
+++ b/spec/ruby/library/stringio/ungetc_spec.rb
@@ -39,7 +39,7 @@ describe "StringIO#ungetc when passed [char]" do
end
it "raises a TypeError when the passed length can't be converted to an Integer or String" do
- lambda { @io.ungetc(Object.new) }.should raise_error(TypeError)
+ -> { @io.ungetc(Object.new) }.should raise_error(TypeError)
end
end
@@ -47,12 +47,12 @@ describe "StringIO#ungetc when self is not readable" do
it "raises an IOError" do
io = StringIO.new("test", "w")
io.pos = 1
- lambda { io.ungetc(?A) }.should raise_error(IOError)
+ -> { io.ungetc(?A) }.should raise_error(IOError)
io = StringIO.new("test")
io.pos = 1
io.close_read
- lambda { io.ungetc(?A) }.should raise_error(IOError)
+ -> { io.ungetc(?A) }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringscanner/clear_spec.rb b/spec/ruby/library/stringscanner/clear_spec.rb
index c8b19abe7d..7ae089704a 100644
--- a/spec/ruby/library/stringscanner/clear_spec.rb
+++ b/spec/ruby/library/stringscanner/clear_spec.rb
@@ -7,11 +7,11 @@ describe "StringScanner#clear" do
it "warns in verbose mode that the method is obsolete" do
s = StringScanner.new("abc")
- lambda {
+ -> {
s.clear
}.should complain(/clear.*obsolete.*terminate/, verbose: true)
- lambda {
+ -> {
s.clear
}.should_not complain(verbose: false)
end
diff --git a/spec/ruby/library/stringscanner/element_reference_spec.rb b/spec/ruby/library/stringscanner/element_reference_spec.rb
index c3fab16bbc..60fe15d807 100644
--- a/spec/ruby/library/stringscanner/element_reference_spec.rb
+++ b/spec/ruby/library/stringscanner/element_reference_spec.rb
@@ -34,18 +34,18 @@ describe "StringScanner#[]" do
it "raises a TypeError if the given index is nil" do
@s.scan(/(\w+) (\w+) (\d+) /)
- lambda { @s[nil]}.should raise_error(TypeError)
+ -> { @s[nil]}.should raise_error(TypeError)
end
it "raises a TypeError when a Range is as argument" do
@s.scan(/(\w+) (\w+) (\d+) /)
- lambda { @s[0..2]}.should raise_error(TypeError)
+ -> { @s[0..2]}.should raise_error(TypeError)
end
it "raises a IndexError when there's no named capture" do
@s.scan(/(\w+) (\w+) (\d+) /)
- lambda { @s["wday"]}.should raise_error(IndexError)
- lambda { @s[:wday]}.should raise_error(IndexError)
+ -> { @s["wday"]}.should raise_error(IndexError)
+ -> { @s[:wday]}.should raise_error(IndexError)
end
it "returns named capture" do
diff --git a/spec/ruby/library/stringscanner/empty_spec.rb b/spec/ruby/library/stringscanner/empty_spec.rb
index 0b67d23246..d9449bea6e 100644
--- a/spec/ruby/library/stringscanner/empty_spec.rb
+++ b/spec/ruby/library/stringscanner/empty_spec.rb
@@ -7,11 +7,11 @@ describe "StringScanner#empty?" do
it "warns in verbose mode that the method is obsolete" do
s = StringScanner.new("abc")
- lambda {
+ -> {
s.empty?
}.should complain(/empty?.*obsolete.*eos?/, verbose: true)
- lambda {
+ -> {
s.empty?
}.should_not complain(verbose: false)
end
diff --git a/spec/ruby/library/stringscanner/getbyte_spec.rb b/spec/ruby/library/stringscanner/getbyte_spec.rb
index 102aa5325d..e0659a5829 100644
--- a/spec/ruby/library/stringscanner/getbyte_spec.rb
+++ b/spec/ruby/library/stringscanner/getbyte_spec.rb
@@ -8,11 +8,11 @@ describe "StringScanner#getbyte" do
it "warns in verbose mode that the method is obsolete" do
s = StringScanner.new("abc")
- lambda {
+ -> {
s.getbyte
}.should complain(/getbyte.*obsolete.*get_byte/, verbose: true)
- lambda {
+ -> {
s.getbyte
}.should_not complain(verbose: false)
end
diff --git a/spec/ruby/library/stringscanner/peep_spec.rb b/spec/ruby/library/stringscanner/peep_spec.rb
index a1c8565579..bf6d579325 100644
--- a/spec/ruby/library/stringscanner/peep_spec.rb
+++ b/spec/ruby/library/stringscanner/peep_spec.rb
@@ -7,11 +7,11 @@ describe "StringScanner#peep" do
it "warns in verbose mode that the method is obsolete" do
s = StringScanner.new("abc")
- lambda {
+ -> {
s.peep(1)
}.should complain(/peep.*obsolete.*peek/, verbose: true)
- lambda {
+ -> {
s.peep(1)
}.should_not complain(verbose: false)
end
diff --git a/spec/ruby/library/stringscanner/restsize_spec.rb b/spec/ruby/library/stringscanner/restsize_spec.rb
index cf3e22f34c..710520afae 100644
--- a/spec/ruby/library/stringscanner/restsize_spec.rb
+++ b/spec/ruby/library/stringscanner/restsize_spec.rb
@@ -7,11 +7,11 @@ describe "StringScanner#restsize" do
it "warns in verbose mode that the method is obsolete" do
s = StringScanner.new("abc")
- lambda {
+ -> {
s.restsize
}.should complain(/restsize.*obsolete.*rest_size/, verbose: true)
- lambda {
+ -> {
s.restsize
}.should_not complain(verbose: false)
end
diff --git a/spec/ruby/library/stringscanner/scan_spec.rb b/spec/ruby/library/stringscanner/scan_spec.rb
index 8e26b80591..8b9960e6e6 100644
--- a/spec/ruby/library/stringscanner/scan_spec.rb
+++ b/spec/ruby/library/stringscanner/scan_spec.rb
@@ -51,9 +51,9 @@ describe "StringScanner#scan" do
end
it "raises a TypeError if pattern isn't a Regexp" do
- lambda { @s.scan("aoeu") }.should raise_error(TypeError)
- lambda { @s.scan(5) }.should raise_error(TypeError)
- lambda { @s.scan(:test) }.should raise_error(TypeError)
- lambda { @s.scan(mock('x')) }.should raise_error(TypeError)
+ -> { @s.scan("aoeu") }.should raise_error(TypeError)
+ -> { @s.scan(5) }.should raise_error(TypeError)
+ -> { @s.scan(:test) }.should raise_error(TypeError)
+ -> { @s.scan(mock('x')) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/stringscanner/shared/concat.rb b/spec/ruby/library/stringscanner/shared/concat.rb
index 214455d1b9..cb884a5c01 100644
--- a/spec/ruby/library/stringscanner/shared/concat.rb
+++ b/spec/ruby/library/stringscanner/shared/concat.rb
@@ -7,24 +7,24 @@ describe :strscan_concat, shared: true do
end
it "raises a TypeError if the given argument can't be converted to a String" do
- lambda { StringScanner.new('hello').send(@method, :world) }.should raise_error(TypeError)
- lambda { StringScanner.new('hello').send(@method, mock('x')) }.should raise_error(TypeError)
+ -> { StringScanner.new('hello').send(@method, :world) }.should raise_error(TypeError)
+ -> { StringScanner.new('hello').send(@method, mock('x')) }.should raise_error(TypeError)
end
end
describe :strscan_concat_fixnum, shared: true do
it "raises a TypeError" do
a = StringScanner.new("hello world")
- lambda { a.send(@method, 333) }.should raise_error(TypeError)
+ -> { a.send(@method, 333) }.should raise_error(TypeError)
b = StringScanner.new("")
- lambda { b.send(@method, (256 * 3 + 64)) }.should raise_error(TypeError)
- lambda { b.send(@method, -200) }.should raise_error(TypeError)
+ -> { b.send(@method, (256 * 3 + 64)) }.should raise_error(TypeError)
+ -> { b.send(@method, -200) }.should raise_error(TypeError)
end
it "doesn't call to_int on the argument" do
x = mock('x')
x.should_not_receive(:to_int)
- lambda { StringScanner.new("").send(@method, x) }.should raise_error(TypeError)
+ -> { StringScanner.new("").send(@method, x) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/stringscanner/shared/peek.rb b/spec/ruby/library/stringscanner/shared/peek.rb
index 418ebb6536..a59afdc6c0 100644
--- a/spec/ruby/library/stringscanner/shared/peek.rb
+++ b/spec/ruby/library/stringscanner/shared/peek.rb
@@ -19,11 +19,11 @@ describe :strscan_peek, shared: true do
end
it "raises a ArgumentError when the passed argument is negative" do
- lambda { @s.send(@method, -2) }.should raise_error(ArgumentError)
+ -> { @s.send(@method, -2) }.should raise_error(ArgumentError)
end
it "raises a RangeError when the passed argument is a Bignum" do
- lambda { @s.send(@method, bignum_value) }.should raise_error(RangeError)
+ -> { @s.send(@method, bignum_value) }.should raise_error(RangeError)
end
it "returns an instance of String when passed a String subclass" do
diff --git a/spec/ruby/library/stringscanner/shared/pos.rb b/spec/ruby/library/stringscanner/shared/pos.rb
index 80ded17b0f..6d540881f2 100644
--- a/spec/ruby/library/stringscanner/shared/pos.rb
+++ b/spec/ruby/library/stringscanner/shared/pos.rb
@@ -41,12 +41,12 @@ describe :strscan_pos_set, shared: true do
end
it "raises a RangeError if position too far backward" do
- lambda {
+ -> {
@s.send(@method, -20)
}.should raise_error(RangeError)
end
it "raises a RangeError when the passed argument is out of range" do
- lambda { @s.send(@method, 20) }.should raise_error(RangeError)
+ -> { @s.send(@method, 20) }.should raise_error(RangeError)
end
end
diff --git a/spec/ruby/library/stringscanner/unscan_spec.rb b/spec/ruby/library/stringscanner/unscan_spec.rb
index ea5e6f4ef4..df0ea43367 100644
--- a/spec/ruby/library/stringscanner/unscan_spec.rb
+++ b/spec/ruby/library/stringscanner/unscan_spec.rb
@@ -22,7 +22,7 @@ describe "StringScanner#unscan" do
end
it "raises a ScanError when the previous match had failed" do
- lambda { @s.unscan }.should raise_error(ScanError)
- lambda { @s.scan(/\d/); @s.unscan }.should raise_error(ScanError)
+ -> { @s.unscan }.should raise_error(ScanError)
+ -> { @s.scan(/\d/); @s.unscan }.should raise_error(ScanError)
end
end
diff --git a/spec/ruby/library/syslog/close_spec.rb b/spec/ruby/library/syslog/close_spec.rb
index b1591045e3..8186ecf125 100644
--- a/spec/ruby/library/syslog/close_spec.rb
+++ b/spec/ruby/library/syslog/close_spec.rb
@@ -23,11 +23,11 @@ platform_is_not :windows do
end
it "raises a RuntimeError if the log's already closed" do
- lambda { Syslog.close }.should raise_error(RuntimeError)
+ -> { Syslog.close }.should raise_error(RuntimeError)
end
it "it does not work inside blocks" do
- lambda {
+ -> {
Syslog.open { |s| s.close }
}.should raise_error(RuntimeError)
Syslog.opened?.should == false
diff --git a/spec/ruby/library/syslog/log_spec.rb b/spec/ruby/library/syslog/log_spec.rb
index 727fffbadf..ee62d484ac 100644
--- a/spec/ruby/library/syslog/log_spec.rb
+++ b/spec/ruby/library/syslog/log_spec.rb
@@ -15,7 +15,7 @@ platform_is_not :windows do
end
it "receives a priority as first argument" do
- lambda {
+ -> {
Syslog.open("rubyspec", Syslog::LOG_PERROR) do |s|
s.log(Syslog::LOG_ALERT, "Hello")
s.log(Syslog::LOG_CRIT, "World")
@@ -24,7 +24,7 @@ platform_is_not :windows do
end
it "accepts undefined priorities" do
- lambda {
+ -> {
Syslog.open("rubyspec", Syslog::LOG_PERROR) do |s|
s.log(1337, "Hello")
end
@@ -34,18 +34,18 @@ platform_is_not :windows do
it "fails with TypeError on nil log messages" do
Syslog.open do |s|
- lambda { s.log(1, nil) }.should raise_error(TypeError)
+ -> { s.log(1, nil) }.should raise_error(TypeError)
end
end
it "fails if the log is closed" do
- lambda {
+ -> {
Syslog.log(Syslog::LOG_ALERT, "test")
}.should raise_error(RuntimeError)
end
it "accepts printf parameters" do
- lambda {
+ -> {
Syslog.open("rubyspec", Syslog::LOG_PERROR) do |s|
s.log(Syslog::LOG_ALERT, "%s x %d", "chunky bacon", 2)
end
diff --git a/spec/ruby/library/syslog/mask_spec.rb b/spec/ruby/library/syslog/mask_spec.rb
index 8caa5e69b8..6581f6a756 100644
--- a/spec/ruby/library/syslog/mask_spec.rb
+++ b/spec/ruby/library/syslog/mask_spec.rb
@@ -91,7 +91,7 @@ platform_is_not :windows do
end
it "raises an error if the log is closed" do
- lambda { Syslog.mask = 1337 }.should raise_error(RuntimeError)
+ -> { Syslog.mask = 1337 }.should raise_error(RuntimeError)
end
it "only accepts numbers" do
@@ -103,8 +103,8 @@ platform_is_not :windows do
Syslog.mask = 3.1416
Syslog.mask.should == 3
- lambda { Syslog.mask = "oh hai" }.should raise_error(TypeError)
- lambda { Syslog.mask = "43" }.should raise_error(TypeError)
+ -> { Syslog.mask = "oh hai" }.should raise_error(TypeError)
+ -> { Syslog.mask = "43" }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/syslog/open_spec.rb b/spec/ruby/library/syslog/open_spec.rb
index 641d0979cd..543f5d418b 100644
--- a/spec/ruby/library/syslog/open_spec.rb
+++ b/spec/ruby/library/syslog/open_spec.rb
@@ -74,10 +74,10 @@ platform_is_not :windows do
it "raises an error if the log is opened" do
Syslog.open
- lambda {
+ -> {
Syslog.open
}.should raise_error(RuntimeError, /syslog already open/)
- lambda {
+ -> {
Syslog.close
Syslog.open
}.should_not raise_error
diff --git a/spec/ruby/library/syslog/shared/log.rb b/spec/ruby/library/syslog/shared/log.rb
index 6d0d3a3c23..b19c2eae0d 100644
--- a/spec/ruby/library/syslog/shared/log.rb
+++ b/spec/ruby/library/syslog/shared/log.rb
@@ -9,7 +9,7 @@ describe :syslog_log, shared: true do
end
it "logs a message" do
- lambda {
+ -> {
Syslog.open("rubyspec", Syslog::LOG_PERROR) do
Syslog.send(@method, "Hello")
end
@@ -17,7 +17,7 @@ describe :syslog_log, shared: true do
end
it "accepts sprintf arguments" do
- lambda {
+ -> {
Syslog.open("rubyspec", Syslog::LOG_PERROR) do
Syslog.send(@method, "Hello %s", "world")
Syslog.send(@method, "%d dogs", 2)
@@ -28,7 +28,7 @@ describe :syslog_log, shared: true do
it "works as an alias for Syslog.log" do
level = Syslog.const_get "LOG_#{@method.to_s.upcase}"
response = "rubyspec: Hello\n"
- lambda {
+ -> {
Syslog.open("rubyspec", Syslog::LOG_PERROR) do
Syslog.send(@method, "Hello")
Syslog.log(level, "Hello")
diff --git a/spec/ruby/library/syslog/shared/reopen.rb b/spec/ruby/library/syslog/shared/reopen.rb
index fd30ab824a..621437a01d 100644
--- a/spec/ruby/library/syslog/shared/reopen.rb
+++ b/spec/ruby/library/syslog/shared/reopen.rb
@@ -10,13 +10,13 @@ describe :syslog_reopen, shared: true do
it "reopens the log" do
Syslog.open
- lambda { Syslog.send(@method)}.should_not raise_error
+ -> { Syslog.send(@method)}.should_not raise_error
Syslog.opened?.should be_true
Syslog.close
end
it "fails with RuntimeError if the log is closed" do
- lambda { Syslog.send(@method)}.should raise_error(RuntimeError)
+ -> { Syslog.send(@method)}.should raise_error(RuntimeError)
end
it "receives the same parameters as Syslog.open" do
diff --git a/spec/ruby/library/tempfile/initialize_spec.rb b/spec/ruby/library/tempfile/initialize_spec.rb
index ad3c2f6437..3b20e8ad4b 100644
--- a/spec/ruby/library/tempfile/initialize_spec.rb
+++ b/spec/ruby/library/tempfile/initialize_spec.rb
@@ -38,4 +38,9 @@ describe "Tempfile#initialize" do
@tempfile.send(:initialize, ['shiftjis', 'yml'], encoding: 'SHIFT_JIS')
@tempfile.external_encoding.should == Encoding::Shift_JIS
end
+
+ it "does not try to modify the arguments" do
+ @tempfile.send(:initialize, ['frozen'.freeze, 'txt'.freeze], encoding: Encoding::IBM437)
+ @tempfile.external_encoding.should == Encoding::IBM437
+ end
end
diff --git a/spec/ruby/library/time/shared/rfc2822.rb b/spec/ruby/library/time/shared/rfc2822.rb
index b7bf0fb5f5..d99f1f76de 100644
--- a/spec/ruby/library/time/shared/rfc2822.rb
+++ b/spec/ruby/library/time/shared/rfc2822.rb
@@ -57,7 +57,7 @@ describe :time_rfc2822, shared: true do
t18 = Time.rfc2822("Fri, 21 Nov 1997 09 : 55 : 06 -0600")
t17.should == t18
- lambda {
+ -> {
# inner comment is not supported.
Time.rfc2822("Fri, 21 Nov 1997 09(comment): 55 : 06 -0600")
}.should raise_error(ArgumentError)
diff --git a/spec/ruby/library/timeout/timeout_spec.rb b/spec/ruby/library/timeout/timeout_spec.rb
index fc957dc36f..a9a60fdeb9 100644
--- a/spec/ruby/library/timeout/timeout_spec.rb
+++ b/spec/ruby/library/timeout/timeout_spec.rb
@@ -3,7 +3,7 @@ require 'timeout'
describe "Timeout.timeout" do
it "raises Timeout::Error when it times out with no specified error type" do
- lambda {
+ -> {
Timeout.timeout(1) do
sleep
end
@@ -11,7 +11,7 @@ describe "Timeout.timeout" do
end
it "raises specified error type when it times out" do
- lambda do
+ -> do
Timeout.timeout(1, StandardError) do
sleep
end
diff --git a/spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb b/spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb
index a619f386a6..eab86818bd 100644
--- a/spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb
+++ b/spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb
@@ -110,8 +110,8 @@ end
describe "Dir.mktmpdir when passed [Object]" do
it "raises an ArgumentError" do
- lambda { Dir.mktmpdir(Object.new) }.should raise_error(ArgumentError)
- lambda { Dir.mktmpdir(:symbol) }.should raise_error(ArgumentError)
- lambda { Dir.mktmpdir(10) }.should raise_error(ArgumentError)
+ -> { Dir.mktmpdir(Object.new) }.should raise_error(ArgumentError)
+ -> { Dir.mktmpdir(:symbol) }.should raise_error(ArgumentError)
+ -> { Dir.mktmpdir(10) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/uri/join_spec.rb b/spec/ruby/library/uri/join_spec.rb
index 6033ecf44c..796f74134f 100644
--- a/spec/ruby/library/uri/join_spec.rb
+++ b/spec/ruby/library/uri/join_spec.rb
@@ -21,7 +21,7 @@ describe "URI.join" do
end
it "raises an error if given no argument" do
- lambda {
+ -> {
URI.join
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/uri/mailto/build_spec.rb b/spec/ruby/library/uri/mailto/build_spec.rb
index ca3b270c2c..2c011626ab 100644
--- a/spec/ruby/library/uri/mailto/build_spec.rb
+++ b/spec/ruby/library/uri/mailto/build_spec.rb
@@ -84,7 +84,7 @@ describe "URI::Mailto.build" do
end
bad.each do |x|
- lambda { URI::MailTo.build(x) }.should raise_error(URI::InvalidComponentError)
+ -> { URI::MailTo.build(x) }.should raise_error(URI::InvalidComponentError)
end
ok.flatten.join("\0").should == ok_all
diff --git a/spec/ruby/library/uri/plus_spec.rb b/spec/ruby/library/uri/plus_spec.rb
index 4aede12216..b84b0767c1 100644
--- a/spec/ruby/library/uri/plus_spec.rb
+++ b/spec/ruby/library/uri/plus_spec.rb
@@ -36,7 +36,7 @@ describe "URI#+" do
end
it "raises a URI::BadURIError when adding two relative URIs" do
- lambda {URI.parse('a/b/c') + "d"}.should raise_error(URI::BadURIError)
+ -> {URI.parse('a/b/c') + "d"}.should raise_error(URI::BadURIError)
end
#Todo: make more BDD?
diff --git a/spec/ruby/library/uri/select_spec.rb b/spec/ruby/library/uri/select_spec.rb
index 6e8c68cf40..c2eb6f8733 100644
--- a/spec/ruby/library/uri/select_spec.rb
+++ b/spec/ruby/library/uri/select_spec.rb
@@ -16,15 +16,15 @@ describe "URI#select" do
it "raises an ArgumentError if a component is requested that isn't valid under the given scheme" do
[
- lambda {URI("mailto:spam@mailinator.com").select(:path)},
- lambda {URI("http://blog.blag.web").select(:typecode)},
+ -> {URI("mailto:spam@mailinator.com").select(:path)},
+ -> {URI("http://blog.blag.web").select(:typecode)},
].each do |select_lambda|
select_lambda.should raise_error(ArgumentError)
end
end
it "raises an ArgumentError if given strings rather than symbols" do
- lambda {
+ -> {
URI("http://host:8080/path/").select("scheme","host","port",'path')
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/uri/set_component_spec.rb b/spec/ruby/library/uri/set_component_spec.rb
index 71ed6af278..642a5d6fcf 100644
--- a/spec/ruby/library/uri/set_component_spec.rb
+++ b/spec/ruby/library/uri/set_component_spec.rb
@@ -27,19 +27,19 @@ describe "URI#select" do
uri.to_s.should == 'http://foo:bar@zab:8080/?a=1#b123'
uri = URI.parse('http://example.com')
- lambda { uri.password = 'bar' }.should raise_error(URI::InvalidURIError)
+ -> { uri.password = 'bar' }.should raise_error(URI::InvalidURIError)
uri.userinfo = 'foo:bar'
uri.to_s.should == 'http://foo:bar@example.com'
- lambda { uri.registry = 'bar' }.should raise_error(URI::InvalidURIError)
- lambda { uri.opaque = 'bar' }.should raise_error(URI::InvalidURIError)
+ -> { uri.registry = 'bar' }.should raise_error(URI::InvalidURIError)
+ -> { uri.opaque = 'bar' }.should raise_error(URI::InvalidURIError)
uri = URI.parse('mailto:foo@example.com')
- lambda { uri.user = 'bar' }.should raise_error(URI::InvalidURIError)
- lambda { uri.password = 'bar' }.should raise_error(URI::InvalidURIError)
- lambda { uri.userinfo = ['bar', 'baz'] }.should raise_error(URI::InvalidURIError)
- lambda { uri.host = 'bar' }.should raise_error(URI::InvalidURIError)
- lambda { uri.port = 'bar' }.should raise_error(URI::InvalidURIError)
- lambda { uri.path = 'bar' }.should raise_error(URI::InvalidURIError)
- lambda { uri.query = 'bar' }.should raise_error(URI::InvalidURIError)
+ -> { uri.user = 'bar' }.should raise_error(URI::InvalidURIError)
+ -> { uri.password = 'bar' }.should raise_error(URI::InvalidURIError)
+ -> { uri.userinfo = ['bar', 'baz'] }.should raise_error(URI::InvalidURIError)
+ -> { uri.host = 'bar' }.should raise_error(URI::InvalidURIError)
+ -> { uri.port = 'bar' }.should raise_error(URI::InvalidURIError)
+ -> { uri.path = 'bar' }.should raise_error(URI::InvalidURIError)
+ -> { uri.query = 'bar' }.should raise_error(URI::InvalidURIError)
end
end
diff --git a/spec/ruby/library/uri/shared/join.rb b/spec/ruby/library/uri/shared/join.rb
index ff85b57a80..4df0782b37 100644
--- a/spec/ruby/library/uri/shared/join.rb
+++ b/spec/ruby/library/uri/shared/join.rb
@@ -18,7 +18,7 @@ describe :uri_join, shared: true do
end
it "raises an error if given no argument" do
- lambda {
+ -> {
@object.join
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/uri/shared/parse.rb b/spec/ruby/library/uri/shared/parse.rb
index 5ecbffcaf2..87e1ee933e 100644
--- a/spec/ruby/library/uri/shared/parse.rb
+++ b/spec/ruby/library/uri/shared/parse.rb
@@ -193,7 +193,7 @@ describe :uri_parse, shared: true do
end
it "raises errors on malformed URIs" do
- lambda { @object.parse('http://a_b:80/') }.should raise_error(URI::InvalidURIError)
- lambda { @object.parse('http://a_b/') }.should raise_error(URI::InvalidURIError)
+ -> { @object.parse('http://a_b:80/') }.should raise_error(URI::InvalidURIError)
+ -> { @object.parse('http://a_b/') }.should raise_error(URI::InvalidURIError)
end
end
diff --git a/spec/ruby/library/uri/uri_spec.rb b/spec/ruby/library/uri/uri_spec.rb
index 93ba07a207..45a7502052 100644
--- a/spec/ruby/library/uri/uri_spec.rb
+++ b/spec/ruby/library/uri/uri_spec.rb
@@ -24,6 +24,6 @@ describe "the URI method" do
#apparently this was a concern? imported from MRI tests
it "does not add a URI method to Object instances" do
- lambda {Object.new.URI("http://ruby-lang.org/")}.should raise_error(NoMethodError)
+ -> {Object.new.URI("http://ruby-lang.org/")}.should raise_error(NoMethodError)
end
end
diff --git a/spec/ruby/library/weakref/__getobj___spec.rb b/spec/ruby/library/weakref/__getobj___spec.rb
index 4ed0bc6afb..79b06f5c96 100644
--- a/spec/ruby/library/weakref/__getobj___spec.rb
+++ b/spec/ruby/library/weakref/__getobj___spec.rb
@@ -10,7 +10,7 @@ describe "WeakRef#__getobj__" do
it "raises WeakRef::RefError if the object is no longer reachable" do
ref = WeakRefSpec.make_dead_weakref
- lambda {
+ -> {
ref.__getobj__
}.should raise_error(WeakRef::RefError)
end
diff --git a/spec/ruby/library/weakref/allocate_spec.rb b/spec/ruby/library/weakref/allocate_spec.rb
index 76e81c4e5e..e734cfd23d 100644
--- a/spec/ruby/library/weakref/allocate_spec.rb
+++ b/spec/ruby/library/weakref/allocate_spec.rb
@@ -3,6 +3,6 @@ require 'weakref'
describe "WeakRef#allocate" do
it "assigns nil as the reference" do
- lambda { WeakRef.allocate.__getobj__ }.should raise_error(WeakRef::RefError)
+ -> { WeakRef.allocate.__getobj__ }.should raise_error(WeakRef::RefError)
end
end
diff --git a/spec/ruby/library/weakref/send_spec.rb b/spec/ruby/library/weakref/send_spec.rb
index 079958ac88..9591657e01 100644
--- a/spec/ruby/library/weakref/send_spec.rb
+++ b/spec/ruby/library/weakref/send_spec.rb
@@ -27,11 +27,11 @@ describe "WeakRef#__send__" do
it "delegates to protected methods of the weakly-referenced object" do
wr = WeakRef.new(WeakRefSpecs)
- lambda { wr.protected_method }.should raise_error(NameError)
+ -> { wr.protected_method }.should raise_error(NameError)
end
it "does not delegate to private methods of the weakly-referenced object" do
wr = WeakRef.new(WeakRefSpecs)
- lambda { wr.private_method }.should raise_error(NameError)
+ -> { wr.private_method }.should raise_error(NameError)
end
end
diff --git a/spec/ruby/library/win32ole/win32ole/_invoke_spec.rb b/spec/ruby/library/win32ole/win32ole/_invoke_spec.rb
index 9809f89e7c..91f5091d24 100644
--- a/spec/ruby/library/win32ole/win32ole/_invoke_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole/_invoke_spec.rb
@@ -7,9 +7,9 @@ platform_is :windows do
end
it "raises ArgumentError if insufficient number of arguments are given" do
- lambda { @shell._invoke() }.should raise_error ArgumentError
- lambda { @shell._invoke(0) }.should raise_error ArgumentError
- lambda { @shell._invoke(0, []) }.should raise_error ArgumentError
+ -> { @shell._invoke() }.should raise_error ArgumentError
+ -> { @shell._invoke(0) }.should raise_error ArgumentError
+ -> { @shell._invoke(0, []) }.should raise_error ArgumentError
end
it "dispatches the method bound to a specific ID" do
diff --git a/spec/ruby/library/win32ole/win32ole/connect_spec.rb b/spec/ruby/library/win32ole/win32ole/connect_spec.rb
index 590ef7688c..72dceb1572 100644
--- a/spec/ruby/library/win32ole/win32ole/connect_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole/connect_spec.rb
@@ -8,7 +8,7 @@ platform_is :windows do
end
it "raises TypeError when given invalid argument" do
- lambda { WIN32OLE.connect 1 }.should raise_error TypeError
+ -> { WIN32OLE.connect 1 }.should raise_error TypeError
end
end
diff --git a/spec/ruby/library/win32ole/win32ole/locale_spec.rb b/spec/ruby/library/win32ole/win32ole/locale_spec.rb
index a0376ce123..75a82ddd7f 100644
--- a/spec/ruby/library/win32ole/win32ole/locale_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole/locale_spec.rb
@@ -19,7 +19,7 @@ platform_is :windows do
WIN32OLE.locale.should == 1041
WIN32OLE.locale = WIN32OLE::LOCALE_SYSTEM_DEFAULT
- lambda { WIN32OLE.locale = 111 }.should raise_error WIN32OLERuntimeError
+ -> { WIN32OLE.locale = 111 }.should raise_error WIN32OLERuntimeError
WIN32OLE.locale.should == WIN32OLE::LOCALE_SYSTEM_DEFAULT
ensure
WIN32OLE.locale.should == WIN32OLE::LOCALE_SYSTEM_DEFAULT
diff --git a/spec/ruby/library/win32ole/win32ole/new_spec.rb b/spec/ruby/library/win32ole/win32ole/new_spec.rb
index d1c3e02593..6b717195f1 100644
--- a/spec/ruby/library/win32ole/win32ole/new_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole/new_spec.rb
@@ -13,11 +13,11 @@ platform_is :windows do
end
it "raises TypeError if argument cannot be converted to String" do
- lambda { WIN32OLESpecs.new_ole(42) }.should raise_error( TypeError )
+ -> { WIN32OLESpecs.new_ole(42) }.should raise_error( TypeError )
end
it "raises WIN32OLERuntimeError if invalid string is given" do
- lambda { WIN32OLE.new('foo') }.should raise_error( WIN32OLERuntimeError )
+ -> { WIN32OLE.new('foo') }.should raise_error( WIN32OLERuntimeError )
end
end
diff --git a/spec/ruby/library/win32ole/win32ole/ole_func_methods_spec.rb b/spec/ruby/library/win32ole/win32ole/ole_func_methods_spec.rb
index 5488c4fd29..75748182fe 100644
--- a/spec/ruby/library/win32ole/win32ole/ole_func_methods_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole/ole_func_methods_spec.rb
@@ -7,7 +7,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @dict.ole_func_methods(1) }.should raise_error ArgumentError
+ -> { @dict.ole_func_methods(1) }.should raise_error ArgumentError
end
it "returns an array of WIN32OLE_METHODs" do
diff --git a/spec/ruby/library/win32ole/win32ole/ole_methods_spec.rb b/spec/ruby/library/win32ole/win32ole/ole_methods_spec.rb
index b2baac265e..5ac9ae9cfa 100644
--- a/spec/ruby/library/win32ole/win32ole/ole_methods_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole/ole_methods_spec.rb
@@ -7,7 +7,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @dict.ole_methods(1) }.should raise_error ArgumentError
+ -> { @dict.ole_methods(1) }.should raise_error ArgumentError
end
it "returns an array of WIN32OLE_METHODs" do
diff --git a/spec/ruby/library/win32ole/win32ole/ole_obj_help_spec.rb b/spec/ruby/library/win32ole/win32ole/ole_obj_help_spec.rb
index 2d31aac9eb..ef8944ee39 100644
--- a/spec/ruby/library/win32ole/win32ole/ole_obj_help_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole/ole_obj_help_spec.rb
@@ -8,7 +8,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @dict.ole_obj_help(1) }.should raise_error ArgumentError
+ -> { @dict.ole_obj_help(1) }.should raise_error ArgumentError
end
it "returns an instance of WIN32OLE_TYPE" do
diff --git a/spec/ruby/library/win32ole/win32ole/ole_put_methods_spec.rb b/spec/ruby/library/win32ole/win32ole/ole_put_methods_spec.rb
index 45af41c6c2..727291e9f0 100644
--- a/spec/ruby/library/win32ole/win32ole/ole_put_methods_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole/ole_put_methods_spec.rb
@@ -7,7 +7,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @dict.ole_put_methods(1) }.should raise_error ArgumentError
+ -> { @dict.ole_put_methods(1) }.should raise_error ArgumentError
end
it "returns an array of WIN32OLE_METHODs" do
diff --git a/spec/ruby/library/win32ole/win32ole/shared/ole_method.rb b/spec/ruby/library/win32ole/win32ole/shared/ole_method.rb
index 26566a0b14..f1fd8713a4 100644
--- a/spec/ruby/library/win32ole/win32ole/shared/ole_method.rb
+++ b/spec/ruby/library/win32ole/win32ole/shared/ole_method.rb
@@ -7,7 +7,7 @@ platform_is :windows do
end
it "raises ArgumentError if no argument is given" do
- lambda { @dict.send(@method) }.should raise_error ArgumentError
+ -> { @dict.send(@method) }.should raise_error ArgumentError
end
it "returns the WIN32OLE_METHOD 'Add' if given 'Add'" do
diff --git a/spec/ruby/library/win32ole/win32ole/shared/setproperty.rb b/spec/ruby/library/win32ole/win32ole/shared/setproperty.rb
index b850d21933..b9267aef71 100644
--- a/spec/ruby/library/win32ole/win32ole/shared/setproperty.rb
+++ b/spec/ruby/library/win32ole/win32ole/shared/setproperty.rb
@@ -7,7 +7,7 @@ platform_is :windows do
end
it "raises ArgumentError if no argument is given" do
- lambda { @dict.send(@method) }.should raise_error ArgumentError
+ -> { @dict.send(@method) }.should raise_error ArgumentError
end
it "sets key to newkey and returns nil" do
diff --git a/spec/ruby/library/win32ole/win32ole_event/new_spec.rb b/spec/ruby/library/win32ole/win32ole_event/new_spec.rb
index 4ce11a716b..a1a1612393 100644
--- a/spec/ruby/library/win32ole/win32ole_event/new_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_event/new_spec.rb
@@ -12,16 +12,16 @@ platform_is :windows do
end
it "raises TypeError given invalid argument" do
- lambda { WIN32OLE_EVENT.new "A" }.should raise_error TypeError
+ -> { WIN32OLE_EVENT.new "A" }.should raise_error TypeError
end
it "raises RuntimeError if event does not exist" do
- lambda { WIN32OLE_EVENT.new(@xml_dom, 'A') }.should raise_error RuntimeError
+ -> { WIN32OLE_EVENT.new(@xml_dom, 'A') }.should raise_error RuntimeError
end
it "raises RuntimeError if OLE object has no events" do
dict = WIN32OLESpecs.new_ole('Scripting.Dictionary')
- lambda { WIN32OLE_EVENT.new(dict) }.should raise_error RuntimeError
+ -> { WIN32OLE_EVENT.new(dict) }.should raise_error RuntimeError
end
it "creates WIN32OLE_EVENT object" do
diff --git a/spec/ruby/library/win32ole/win32ole_method/dispid_spec.rb b/spec/ruby/library/win32ole/win32ole_method/dispid_spec.rb
index 840cdf72b8..69068683b7 100644
--- a/spec/ruby/library/win32ole/win32ole_method/dispid_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_method/dispid_spec.rb
@@ -8,7 +8,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @m.dispid(0) }.should raise_error ArgumentError
+ -> { @m.dispid(0) }.should raise_error ArgumentError
end
it "returns expected dispatch ID for Shell's 'namespace' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_method/event_interface_spec.rb b/spec/ruby/library/win32ole/win32ole_method/event_interface_spec.rb
index 1b88d80ff9..70c8b30cca 100644
--- a/spec/ruby/library/win32ole/win32ole_method/event_interface_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_method/event_interface_spec.rb
@@ -11,7 +11,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @on_dbl_click_method.event_interface(1) }.should raise_error ArgumentError
+ -> { @on_dbl_click_method.event_interface(1) }.should raise_error ArgumentError
end
it "returns expected string for System Monitor Control's 'OnDblClick' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_method/event_spec.rb b/spec/ruby/library/win32ole/win32ole_method/event_spec.rb
index 81628805d0..c41f8fe99d 100644
--- a/spec/ruby/library/win32ole/win32ole_method/event_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_method/event_spec.rb
@@ -9,7 +9,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @on_dbl_click_method.event?(1) }.should raise_error ArgumentError
+ -> { @on_dbl_click_method.event?(1) }.should raise_error ArgumentError
end
it "returns true for System Monitor Control's 'OnDblClick' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_method/helpcontext_spec.rb b/spec/ruby/library/win32ole/win32ole_method/helpcontext_spec.rb
index a0008fa7d5..21b3ae8bde 100644
--- a/spec/ruby/library/win32ole/win32ole_method/helpcontext_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_method/helpcontext_spec.rb
@@ -10,7 +10,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @get_file_version.helpcontext(1) }.should raise_error ArgumentError
+ -> { @get_file_version.helpcontext(1) }.should raise_error ArgumentError
end
it "returns expected value for FileSystemObject's 'GetFileVersion' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_method/helpfile_spec.rb b/spec/ruby/library/win32ole/win32ole_method/helpfile_spec.rb
index 72cc4da16b..b6d0a19a37 100644
--- a/spec/ruby/library/win32ole/win32ole_method/helpfile_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_method/helpfile_spec.rb
@@ -8,7 +8,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @m_file_name.helpfile(1) }.should raise_error ArgumentError
+ -> { @m_file_name.helpfile(1) }.should raise_error ArgumentError
end
it "returns expected value for Scripting Runtime's 'File' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_method/helpstring_spec.rb b/spec/ruby/library/win32ole/win32ole_method/helpstring_spec.rb
index 60105d0aa2..9f940fd4a0 100644
--- a/spec/ruby/library/win32ole/win32ole_method/helpstring_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_method/helpstring_spec.rb
@@ -8,7 +8,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @m_file_name.helpstring(1) }.should raise_error ArgumentError
+ -> { @m_file_name.helpstring(1) }.should raise_error ArgumentError
end
it "returns expected value for Scripting Runtime's 'File' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_method/invkind_spec.rb b/spec/ruby/library/win32ole/win32ole_method/invkind_spec.rb
index cf0a74bbce..7fff479daf 100644
--- a/spec/ruby/library/win32ole/win32ole_method/invkind_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_method/invkind_spec.rb
@@ -8,7 +8,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @m_file_name.invkind(1) }.should raise_error ArgumentError
+ -> { @m_file_name.invkind(1) }.should raise_error ArgumentError
end
it "returns expected value for Scripting Runtime's 'name' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_method/invoke_kind_spec.rb b/spec/ruby/library/win32ole/win32ole_method/invoke_kind_spec.rb
index 4d2af8fb0c..e8638abd91 100644
--- a/spec/ruby/library/win32ole/win32ole_method/invoke_kind_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_method/invoke_kind_spec.rb
@@ -8,7 +8,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @m_file_name.invoke_kind(1) }.should raise_error ArgumentError
+ -> { @m_file_name.invoke_kind(1) }.should raise_error ArgumentError
end
it "returns expected value for Scripting Runtime's 'name' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_method/new_spec.rb b/spec/ruby/library/win32ole/win32ole_method/new_spec.rb
index f904107c6c..8ebf93b992 100644
--- a/spec/ruby/library/win32ole/win32ole_method/new_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_method/new_spec.rb
@@ -7,12 +7,12 @@ platform_is :windows do
end
it "raises TypeError when given non-strings" do
- lambda { WIN32OLE_METHOD.new(1, 2) }.should raise_error TypeError
+ -> { WIN32OLE_METHOD.new(1, 2) }.should raise_error TypeError
end
it "raises ArgumentError if only 1 argument is given" do
- lambda { WIN32OLE_METHOD.new("hello") }.should raise_error ArgumentError
- lambda { WIN32OLE_METHOD.new(@ole_type) }.should raise_error ArgumentError
+ -> { WIN32OLE_METHOD.new("hello") }.should raise_error ArgumentError
+ -> { WIN32OLE_METHOD.new(@ole_type) }.should raise_error ArgumentError
end
it "returns a valid WIN32OLE_METHOD object" do
@@ -21,11 +21,11 @@ platform_is :windows do
end
it "raises WIN32OLERuntimeError if the method does not exist" do
- lambda { WIN32OLE_METHOD.new(@ole_type, "NonexistentMethod") }.should raise_error WIN32OLERuntimeError
+ -> { WIN32OLE_METHOD.new(@ole_type, "NonexistentMethod") }.should raise_error WIN32OLERuntimeError
end
it "raises TypeError if second argument is not a String" do
- lambda { WIN32OLE_METHOD.new(@ole_type, 5) }.should raise_error TypeError
+ -> { WIN32OLE_METHOD.new(@ole_type, 5) }.should raise_error TypeError
end
end
diff --git a/spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb b/spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb
index f94e48c051..8e50c39787 100644
--- a/spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb
@@ -8,7 +8,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @m_file_name.offset_vtbl(1) }.should raise_error ArgumentError
+ -> { @m_file_name.offset_vtbl(1) }.should raise_error ArgumentError
end
it "returns expected value for Scripting Runtime's 'name' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_method/params_spec.rb b/spec/ruby/library/win32ole/win32ole_method/params_spec.rb
index 08c7f04bdd..2f8da3d45b 100644
--- a/spec/ruby/library/win32ole/win32ole_method/params_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_method/params_spec.rb
@@ -10,7 +10,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @m_file_name.params(1) }.should raise_error ArgumentError
+ -> { @m_file_name.params(1) }.should raise_error ArgumentError
end
it "returns empty array for Scripting Runtime's 'name' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_method/return_type_detail_spec.rb b/spec/ruby/library/win32ole/win32ole_method/return_type_detail_spec.rb
index b8f2bbe084..f8ce3e1b3a 100644
--- a/spec/ruby/library/win32ole/win32ole_method/return_type_detail_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_method/return_type_detail_spec.rb
@@ -8,7 +8,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @m_browse_for_folder.return_type_detail(1) }.should raise_error ArgumentError
+ -> { @m_browse_for_folder.return_type_detail(1) }.should raise_error ArgumentError
end
it "returns expected value for Shell Control's 'BrowseForFolder' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_method/return_type_spec.rb b/spec/ruby/library/win32ole/win32ole_method/return_type_spec.rb
index b68481fe59..58e26df77b 100644
--- a/spec/ruby/library/win32ole/win32ole_method/return_type_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_method/return_type_spec.rb
@@ -8,7 +8,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @m_file_name.return_type(1) }.should raise_error ArgumentError
+ -> { @m_file_name.return_type(1) }.should raise_error ArgumentError
end
it "returns expected value for Scripting Runtime's 'name' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_method/return_vtype_spec.rb b/spec/ruby/library/win32ole/win32ole_method/return_vtype_spec.rb
index f236de01f9..dc159dd09e 100644
--- a/spec/ruby/library/win32ole/win32ole_method/return_vtype_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_method/return_vtype_spec.rb
@@ -8,7 +8,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @m_browse_for_folder.return_vtype(1) }.should raise_error ArgumentError
+ -> { @m_browse_for_folder.return_vtype(1) }.should raise_error ArgumentError
end
it "returns expected value for Shell Control's 'BrowseForFolder' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_method/shared/name.rb b/spec/ruby/library/win32ole/win32ole_method/shared/name.rb
index 2be6478a6e..ddaff4011b 100644
--- a/spec/ruby/library/win32ole/win32ole_method/shared/name.rb
+++ b/spec/ruby/library/win32ole/win32ole_method/shared/name.rb
@@ -8,7 +8,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @m_file_name.send(@method, 1) }.should raise_error ArgumentError
+ -> { @m_file_name.send(@method, 1) }.should raise_error ArgumentError
end
it "returns expected value for Scripting Runtime's 'name' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_method/size_opt_params_spec.rb b/spec/ruby/library/win32ole/win32ole_method/size_opt_params_spec.rb
index a63c50474c..a38fe5c681 100644
--- a/spec/ruby/library/win32ole/win32ole_method/size_opt_params_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_method/size_opt_params_spec.rb
@@ -8,7 +8,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @m_browse_for_folder.size_opt_params(1) }.should raise_error ArgumentError
+ -> { @m_browse_for_folder.size_opt_params(1) }.should raise_error ArgumentError
end
it "returns expected value for Shell Control's 'BrowseForFolder' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_method/size_params_spec.rb b/spec/ruby/library/win32ole/win32ole_method/size_params_spec.rb
index fe93d5bc66..0c5a94c338 100644
--- a/spec/ruby/library/win32ole/win32ole_method/size_params_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_method/size_params_spec.rb
@@ -8,7 +8,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @m_browse_for_folder.size_params(1) }.should raise_error ArgumentError
+ -> { @m_browse_for_folder.size_params(1) }.should raise_error ArgumentError
end
it "returns expected value for Shell Control's 'BrowseForFolder' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_method/visible_spec.rb b/spec/ruby/library/win32ole/win32ole_method/visible_spec.rb
index b49fac6066..918b6ef782 100644
--- a/spec/ruby/library/win32ole/win32ole_method/visible_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_method/visible_spec.rb
@@ -8,7 +8,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @m_browse_for_folder.visible?(1) }.should raise_error ArgumentError
+ -> { @m_browse_for_folder.visible?(1) }.should raise_error ArgumentError
end
it "returns true for Shell Control's 'BrowseForFolder' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_param/default_spec.rb b/spec/ruby/library/win32ole/win32ole_param/default_spec.rb
index 7a1337ec7c..af08c84782 100644
--- a/spec/ruby/library/win32ole/win32ole_param/default_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_param/default_spec.rb
@@ -13,7 +13,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @params[0].default(1) }.should raise_error ArgumentError
+ -> { @params[0].default(1) }.should raise_error ArgumentError
end
it "returns nil for each of WIN32OLE_PARAM for Shell's 'BrowseForFolder' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_param/input_spec.rb b/spec/ruby/library/win32ole/win32ole_param/input_spec.rb
index bdf4bccc79..a0022fef13 100644
--- a/spec/ruby/library/win32ole/win32ole_param/input_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_param/input_spec.rb
@@ -9,7 +9,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @param_overwritefiles.input?(1) }.should raise_error ArgumentError
+ -> { @param_overwritefiles.input?(1) }.should raise_error ArgumentError
end
it "returns true for 3rd parameter of FileSystemObject's 'CopyFile' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_param/ole_type_detail_spec.rb b/spec/ruby/library/win32ole/win32ole_param/ole_type_detail_spec.rb
index 3ba51c02f1..e683d1c16e 100644
--- a/spec/ruby/library/win32ole/win32ole_param/ole_type_detail_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_param/ole_type_detail_spec.rb
@@ -9,7 +9,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @param_overwritefiles.ole_type_detail(1) }.should raise_error ArgumentError
+ -> { @param_overwritefiles.ole_type_detail(1) }.should raise_error ArgumentError
end
it "returns ['BOOL'] for 3rd parameter of FileSystemObject's 'CopyFile' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb b/spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb
index 52bee2c9b8..b9a3639c3e 100644
--- a/spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb
@@ -9,7 +9,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @param_overwritefiles.ole_type(1) }.should raise_error ArgumentError
+ -> { @param_overwritefiles.ole_type(1) }.should raise_error ArgumentError
end
it "returns 'BOOL' for 3rd parameter of FileSystemObject's 'CopyFile' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_param/optional_spec.rb b/spec/ruby/library/win32ole/win32ole_param/optional_spec.rb
index 2476df8641..3fb9dc1867 100644
--- a/spec/ruby/library/win32ole/win32ole_param/optional_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_param/optional_spec.rb
@@ -9,7 +9,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @param_overwritefiles.optional?(1) }.should raise_error ArgumentError
+ -> { @param_overwritefiles.optional?(1) }.should raise_error ArgumentError
end
it "returns true for 3rd parameter of FileSystemObject's 'CopyFile' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_param/retval_spec.rb b/spec/ruby/library/win32ole/win32ole_param/retval_spec.rb
index 90946c0774..f5546e79e5 100644
--- a/spec/ruby/library/win32ole/win32ole_param/retval_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_param/retval_spec.rb
@@ -9,7 +9,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @param_overwritefiles.retval?(1) }.should raise_error ArgumentError
+ -> { @param_overwritefiles.retval?(1) }.should raise_error ArgumentError
end
it "returns false for 3rd parameter of FileSystemObject's 'CopyFile' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_param/shared/name.rb b/spec/ruby/library/win32ole/win32ole_param/shared/name.rb
index b7892d92fb..043bc32856 100644
--- a/spec/ruby/library/win32ole/win32ole_param/shared/name.rb
+++ b/spec/ruby/library/win32ole/win32ole_param/shared/name.rb
@@ -9,7 +9,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @param_overwritefiles.send(@method, 1) }.should raise_error ArgumentError
+ -> { @param_overwritefiles.send(@method, 1) }.should raise_error ArgumentError
end
it "returns expected value for Scripting Runtime's 'name' method" do
diff --git a/spec/ruby/library/win32ole/win32ole_type/new_spec.rb b/spec/ruby/library/win32ole/win32ole_type/new_spec.rb
index 9443a64c75..fab690c2dd 100644
--- a/spec/ruby/library/win32ole/win32ole_type/new_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_type/new_spec.rb
@@ -3,23 +3,23 @@ platform_is :windows do
describe "WIN32OLE_TYPE.new" do
it "raises ArgumentError with no argument" do
- lambda { WIN32OLE_TYPE.new }.should raise_error ArgumentError
+ -> { WIN32OLE_TYPE.new }.should raise_error ArgumentError
end
it "raises ArgumentError with invalid string" do
- lambda { WIN32OLE_TYPE.new("foo") }.should raise_error ArgumentError
+ -> { WIN32OLE_TYPE.new("foo") }.should raise_error ArgumentError
end
it "raises TypeError if second argument is not a String" do
- lambda { WIN32OLE_TYPE.new(1,2) }.should raise_error TypeError
- lambda { WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation',2) }.
+ -> { WIN32OLE_TYPE.new(1,2) }.should raise_error TypeError
+ -> { WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation',2) }.
should raise_error TypeError
end
it "raise WIN32OLERuntimeError if OLE object specified is not found" do
- lambda { WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation','foo') }.
+ -> { WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation','foo') }.
should raise_error WIN32OLERuntimeError
- lambda { WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation','Application') }.
+ -> { WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation','Application') }.
should raise_error WIN32OLERuntimeError
end
diff --git a/spec/ruby/library/win32ole/win32ole_type/progids_spec.rb b/spec/ruby/library/win32ole/win32ole_type/progids_spec.rb
index 0cdd3514e3..19d8bf56e0 100644
--- a/spec/ruby/library/win32ole/win32ole_type/progids_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_type/progids_spec.rb
@@ -3,7 +3,7 @@ platform_is :windows do
describe "WIN32OLE_TYPE.progids" do
it "raises ArgumentError if an argument is given" do
- lambda { WIN32OLE_TYPE.progids(1) }.should raise_error ArgumentError
+ -> { WIN32OLE_TYPE.progids(1) }.should raise_error ArgumentError
end
it "returns an array containing 'Shell.Explorer'" do
diff --git a/spec/ruby/library/win32ole/win32ole_type/shared/name.rb b/spec/ruby/library/win32ole/win32ole_type/shared/name.rb
index 6484ef0ef8..6f37446b23 100644
--- a/spec/ruby/library/win32ole/win32ole_type/shared/name.rb
+++ b/spec/ruby/library/win32ole/win32ole_type/shared/name.rb
@@ -7,7 +7,7 @@ platform_is :windows do
end
it "raises ArgumentError if argument is given" do
- lambda { @ole_type.send(@method, 1) }.should raise_error ArgumentError
+ -> { @ole_type.send(@method, 1) }.should raise_error ArgumentError
end
it "returns a String" do
diff --git a/spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb b/spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb
index 3a28c0496c..369e0274f3 100644
--- a/spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb
@@ -11,7 +11,7 @@ platform_is :windows do
end
it "raises ArgumentError if any argument is give" do
- lambda { WIN32OLE_TYPE.typelibs(1) }.should raise_error ArgumentError
+ -> { WIN32OLE_TYPE.typelibs(1) }.should raise_error ArgumentError
end
it "returns array of type libraries" do
diff --git a/spec/ruby/library/yaml/load_spec.rb b/spec/ruby/library/yaml/load_spec.rb
index 1e16bed4e6..0b6bef2dac 100644
--- a/spec/ruby/library/yaml/load_spec.rb
+++ b/spec/ruby/library/yaml/load_spec.rb
@@ -61,7 +61,7 @@ describe "YAML.load" do
else
error = ArgumentError
end
- lambda { YAML.load("key1: value\ninvalid_key") }.should raise_error(error)
+ -> { YAML.load("key1: value\ninvalid_key") }.should raise_error(error)
end
it "accepts symbols" do
@@ -130,7 +130,7 @@ describe "YAML.load" do
it "loads a File but raise an error when used as it is uninitialized" do
loaded = YAML.load("--- !ruby/object:File {}\n")
- lambda {
+ -> {
loaded.read(1)
}.should raise_error(IOError)
end
diff --git a/spec/ruby/library/zlib/adler32_spec.rb b/spec/ruby/library/zlib/adler32_spec.rb
index 1da12aece0..62240e2de7 100644
--- a/spec/ruby/library/zlib/adler32_spec.rb
+++ b/spec/ruby/library/zlib/adler32_spec.rb
@@ -19,7 +19,7 @@ describe "Zlib.adler32" do
Zlib.adler32(test_string, 1).should == 66391324
Zlib.adler32(test_string, 2**8).should == 701435419
Zlib.adler32(test_string, 2**16).should == 63966491
- lambda { Zlib.adler32(test_string, 2**128) }.should raise_error(RangeError)
+ -> { Zlib.adler32(test_string, 2**128) }.should raise_error(RangeError)
end
it "calculates the Adler checksum for string and initial Adler value for Bignums" do
diff --git a/spec/ruby/library/zlib/crc32_spec.rb b/spec/ruby/library/zlib/crc32_spec.rb
index 02f95fd92c..4c1d6ce2e9 100644
--- a/spec/ruby/library/zlib/crc32_spec.rb
+++ b/spec/ruby/library/zlib/crc32_spec.rb
@@ -26,7 +26,7 @@ describe "Zlib.crc32" do
Zlib.crc32(test_string, 2**16).should == 1932511220
Zlib.crc32("p", ~305419896).should == 4046865307
Zlib.crc32("p", -305419897).should == 4046865307
- lambda { Zlib.crc32(test_string, 2**128) }.should raise_error(RangeError)
+ -> { Zlib.crc32(test_string, 2**128) }.should raise_error(RangeError)
end
it "calculates the CRC checksum for string and initial CRC value for Bignums" do
diff --git a/spec/ruby/library/zlib/gzipfile/close_spec.rb b/spec/ruby/library/zlib/gzipfile/close_spec.rb
index 27eb34cdd9..870870f2fa 100644
--- a/spec/ruby/library/zlib/gzipfile/close_spec.rb
+++ b/spec/ruby/library/zlib/gzipfile/close_spec.rb
@@ -10,9 +10,9 @@ describe "Zlib::GzipFile#close" do
gzio.closed?.should == true
- lambda { gzio.orig_name }.should \
+ -> { gzio.orig_name }.should \
raise_error(Zlib::GzipFile::Error, 'closed gzip stream')
- lambda { gzio.comment }.should \
+ -> { gzio.comment }.should \
raise_error(Zlib::GzipFile::Error, 'closed gzip stream')
end
diff --git a/spec/ruby/library/zlib/gzipfile/comment_spec.rb b/spec/ruby/library/zlib/gzipfile/comment_spec.rb
index 7493f74f1c..70d97ecaf6 100644
--- a/spec/ruby/library/zlib/gzipfile/comment_spec.rb
+++ b/spec/ruby/library/zlib/gzipfile/comment_spec.rb
@@ -19,7 +19,7 @@ describe "Zlib::GzipFile#comment" do
Zlib::GzipWriter.wrap @io do |gzio|
gzio.close
- lambda { gzio.comment }.should \
+ -> { gzio.comment }.should \
raise_error(Zlib::GzipFile::Error, 'closed gzip stream')
end
end
diff --git a/spec/ruby/library/zlib/gzipfile/orig_name_spec.rb b/spec/ruby/library/zlib/gzipfile/orig_name_spec.rb
index cae5305355..ebfd3692af 100644
--- a/spec/ruby/library/zlib/gzipfile/orig_name_spec.rb
+++ b/spec/ruby/library/zlib/gzipfile/orig_name_spec.rb
@@ -19,7 +19,7 @@ describe "Zlib::GzipFile#orig_name" do
Zlib::GzipWriter.wrap @io do |gzio|
gzio.close
- lambda { gzio.orig_name }.should \
+ -> { gzio.orig_name }.should \
raise_error(Zlib::GzipFile::Error, 'closed gzip stream')
end
end
diff --git a/spec/ruby/library/zlib/gzipreader/read_spec.rb b/spec/ruby/library/zlib/gzipreader/read_spec.rb
index 67672eb0b8..a13f087fe9 100644
--- a/spec/ruby/library/zlib/gzipreader/read_spec.rb
+++ b/spec/ruby/library/zlib/gzipreader/read_spec.rb
@@ -29,7 +29,7 @@ describe "GzipReader#read" do
it "does not accept a negative length to read" do
gz = Zlib::GzipReader.new @io
- lambda {
+ -> {
gz.read(-1)
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/zlib/gzipwriter/mtime_spec.rb b/spec/ruby/library/zlib/gzipwriter/mtime_spec.rb
index 96e2b18368..621b602dc7 100644
--- a/spec/ruby/library/zlib/gzipwriter/mtime_spec.rb
+++ b/spec/ruby/library/zlib/gzipwriter/mtime_spec.rb
@@ -31,7 +31,7 @@ describe "Zlib::GzipWriter#mtime=" do
Zlib::GzipWriter.wrap @io do |gzio|
gzio.write ''
- lambda { gzio.mtime = nil }.should \
+ -> { gzio.mtime = nil }.should \
raise_error(Zlib::GzipFile::Error, 'header is already written')
end
end
diff --git a/spec/ruby/library/zlib/inflate/append_spec.rb b/spec/ruby/library/zlib/inflate/append_spec.rb
index e1c357f82e..f121e66566 100644
--- a/spec/ruby/library/zlib/inflate/append_spec.rb
+++ b/spec/ruby/library/zlib/inflate/append_spec.rb
@@ -41,7 +41,7 @@ describe "Zlib::Inflate#<<" do
it "properly handles incomplete data" do
# add bytes, one by one
@foo_deflated[0, 5].each_byte { |d| @z << d.chr}
- lambda { @z.finish }.should raise_error(Zlib::BufError)
+ -> { @z.finish }.should raise_error(Zlib::BufError)
end
it "properly handles excessive data, byte-by-byte" do
diff --git a/spec/ruby/library/zlib/inflate/inflate_spec.rb b/spec/ruby/library/zlib/inflate/inflate_spec.rb
index 7d66fb039a..cc33bd4c32 100644
--- a/spec/ruby/library/zlib/inflate/inflate_spec.rb
+++ b/spec/ruby/library/zlib/inflate/inflate_spec.rb
@@ -77,7 +77,7 @@ describe "Zlib::Inflate.inflate" do
# add bytes, one by one, but not all
result = ""
data.each_byte { |d| result << z.inflate(d.chr)}
- lambda { result << z.finish }.should raise_error(Zlib::BufError)
+ -> { result << z.finish }.should raise_error(Zlib::BufError)
end
it "properly handles excessive data, byte-by-byte" do
diff --git a/spec/ruby/optional/capi/array_spec.rb b/spec/ruby/optional/capi/array_spec.rb
index 56373efe34..acd225e0e0 100644
--- a/spec/ruby/optional/capi/array_spec.rb
+++ b/spec/ruby/optional/capi/array_spec.rb
@@ -8,7 +8,7 @@ describe :rb_ary_new2, shared: true do
end
it "raises an ArgumentError when the given argument is negative" do
- lambda { @s.send(@method, -1) }.should raise_error(ArgumentError)
+ -> { @s.send(@method, -1) }.should raise_error(ArgumentError)
end
end
@@ -84,7 +84,7 @@ describe "C-API Array function" do
end
it "raises a #{frozen_error_class} if the array is frozen" do
- lambda { @s.rb_ary_cat([].freeze, 1) }.should raise_error(frozen_error_class)
+ -> { @s.rb_ary_cat([].freeze, 1) }.should raise_error(frozen_error_class)
end
end
@@ -131,7 +131,7 @@ describe "C-API Array function" do
end
it "raises a #{frozen_error_class} if the array is frozen" do
- lambda { @s.rb_ary_rotate([].freeze, 1) }.should raise_error(frozen_error_class)
+ -> { @s.rb_ary_rotate([].freeze, 1) }.should raise_error(frozen_error_class)
end
end
@@ -205,7 +205,7 @@ describe "C-API Array function" do
it "raises an IndexError if the negative index is greater than the length" do
a = [1, 2, 3]
- lambda { @s.rb_ary_store(a, -10, 5) }.should raise_error(IndexError)
+ -> { @s.rb_ary_store(a, -10, 5) }.should raise_error(IndexError)
end
it "enlarges the array as needed" do
@@ -216,7 +216,7 @@ describe "C-API Array function" do
it "raises a #{frozen_error_class} if the array is frozen" do
a = [1, 2, 3].freeze
- lambda { @s.rb_ary_store(a, 1, 5) }.should raise_error(frozen_error_class)
+ -> { @s.rb_ary_store(a, 1, 5) }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/optional/capi/bignum_spec.rb b/spec/ruby/optional/capi/bignum_spec.rb
index a5863519b6..b20275b8f7 100644
--- a/spec/ruby/optional/capi/bignum_spec.rb
+++ b/spec/ruby/optional/capi/bignum_spec.rb
@@ -33,8 +33,8 @@ describe "CApiBignumSpecs" do
end
it "raises RangeError if passed Bignum overflow long" do
- lambda { @s.rb_big2long(ensure_bignum(@max_long + 1)) }.should raise_error(RangeError)
- lambda { @s.rb_big2long(ensure_bignum(@min_long - 1)) }.should raise_error(RangeError)
+ -> { @s.rb_big2long(ensure_bignum(@max_long + 1)) }.should raise_error(RangeError)
+ -> { @s.rb_big2long(ensure_bignum(@min_long - 1)) }.should raise_error(RangeError)
end
end
@@ -47,8 +47,8 @@ describe "CApiBignumSpecs" do
end
it "raises RangeError if passed Bignum overflow long" do
- lambda { @s.rb_big2ll(ensure_bignum(@max_long << 40)) }.should raise_error(RangeError)
- lambda { @s.rb_big2ll(ensure_bignum(@min_long << 40)) }.should raise_error(RangeError)
+ -> { @s.rb_big2ll(ensure_bignum(@max_long << 40)) }.should raise_error(RangeError)
+ -> { @s.rb_big2ll(ensure_bignum(@min_long << 40)) }.should raise_error(RangeError)
end
end
@@ -65,8 +65,8 @@ describe "CApiBignumSpecs" do
end
it "raises RangeError if passed Bignum overflow long" do
- lambda { @s.rb_big2ulong(ensure_bignum(@max_ulong + 1)) }.should raise_error(RangeError)
- lambda { @s.rb_big2ulong(ensure_bignum(@min_long - 1)) }.should raise_error(RangeError)
+ -> { @s.rb_big2ulong(ensure_bignum(@max_ulong + 1)) }.should raise_error(RangeError)
+ -> { @s.rb_big2ulong(ensure_bignum(@min_long - 1)) }.should raise_error(RangeError)
end
end
@@ -212,13 +212,13 @@ describe "CApiBignumSpecs" do
it "raises FloatDomainError for Infinity values" do
inf = 1.0 / 0
- lambda { @s.rb_dbl2big(inf) }.should raise_error(FloatDomainError)
+ -> { @s.rb_dbl2big(inf) }.should raise_error(FloatDomainError)
end
it "raises FloatDomainError for NaN values" do
nan = 0.0 / 0
- lambda { @s.rb_dbl2big(nan) }.should raise_error(FloatDomainError)
+ -> { @s.rb_dbl2big(nan) }.should raise_error(FloatDomainError)
end
end
end
diff --git a/spec/ruby/optional/capi/class_spec.rb b/spec/ruby/optional/capi/class_spec.rb
index 57636f3819..0b03fb9e6c 100644
--- a/spec/ruby/optional/capi/class_spec.rb
+++ b/spec/ruby/optional/capi/class_spec.rb
@@ -18,19 +18,19 @@ describe :rb_path_to_class, shared: true do
end
it "raises an ArgumentError if a constant in the path does not exist" do
- lambda { @s.send(@method, "CApiClassSpecs::NotDefined::B") }.should raise_error(ArgumentError)
+ -> { @s.send(@method, "CApiClassSpecs::NotDefined::B") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if the final constant does not exist" do
- lambda { @s.send(@method, "CApiClassSpecs::NotDefined") }.should raise_error(ArgumentError)
+ -> { @s.send(@method, "CApiClassSpecs::NotDefined") }.should raise_error(ArgumentError)
end
it "raises a TypeError if the constant is not a class or module" do
- lambda { @s.send(@method, "CApiClassSpecs::A::C") }.should raise_error(TypeError)
+ -> { @s.send(@method, "CApiClassSpecs::A::C") }.should raise_error(TypeError)
end
it "raises an ArgumentError even if a constant in the path exists on toplevel" do
- lambda { @s.send(@method, "CApiClassSpecs::Object") }.should raise_error(ArgumentError)
+ -> { @s.send(@method, "CApiClassSpecs::Object") }.should raise_error(ArgumentError)
end
end
@@ -56,7 +56,7 @@ describe "C-API Class function" do
it "includes a module into a class" do
c = Class.new
o = c.new
- lambda { o.included? }.should raise_error(NameError)
+ -> { o.included? }.should raise_error(NameError)
@s.rb_include_module(c, CApiClassSpecs::M)
o.included?.should be_true
end
@@ -70,12 +70,12 @@ describe "C-API Class function" do
it "defines an attr_reader when passed true, false" do
@s.rb_define_attr(CApiClassSpecs::Attr, :foo, true, false)
@a.foo.should == 1
- lambda { @a.foo = 5 }.should raise_error(NameError)
+ -> { @a.foo = 5 }.should raise_error(NameError)
end
it "defines an attr_writer when passed false, true" do
@s.rb_define_attr(CApiClassSpecs::Attr, :bar, false, true)
- lambda { @a.bar }.should raise_error(NameError)
+ -> { @a.bar }.should raise_error(NameError)
@a.bar = 5
@a.instance_variable_get(:@bar).should == 5
end
@@ -187,7 +187,7 @@ describe "C-API Class function" do
end
it "raises a NameError if the class variable is not defined" do
- lambda {
+ -> {
@s.rb_cv_get(CApiClassSpecs::CVars, "@@no_cvar")
}.should raise_error(NameError, /class variable @@no_cvar/)
end
@@ -226,19 +226,19 @@ describe "C-API Class function" do
end
it "raises a TypeError when given a non class object to superclass" do
- lambda {
+ -> {
@s.rb_define_class("ClassSpecDefineClass3", Module.new)
}.should raise_error(TypeError)
end
it "raises a TypeError when given a mismatched class to superclass" do
- lambda {
+ -> {
@s.rb_define_class("ClassSpecDefineClass", Object)
}.should raise_error(TypeError)
end
it "raises a ArgumentError when given NULL as superclass" do
- lambda {
+ -> {
@s.rb_define_class("ClassSpecDefineClass4", nil)
}.should raise_error(ArgumentError)
end
@@ -265,7 +265,7 @@ describe "C-API Class function" do
end
it "raises a TypeError when given a non class object to superclass" do
- lambda { @s.rb_define_class_under(CApiClassSpecs,
+ -> { @s.rb_define_class_under(CApiClassSpecs,
"ClassUnder5",
Module.new)
}.should raise_error(TypeError)
@@ -273,7 +273,7 @@ describe "C-API Class function" do
it "raises a TypeError when given a mismatched class to superclass" do
CApiClassSpecs::ClassUnder6 = Class.new(CApiClassSpecs::Super)
- lambda { @s.rb_define_class_under(CApiClassSpecs,
+ -> { @s.rb_define_class_under(CApiClassSpecs,
"ClassUnder6",
Class.new)
}.should raise_error(TypeError)
@@ -284,7 +284,7 @@ describe "C-API Class function" do
end
it "raises a TypeError if class is defined and its superclass mismatches the given one" do
- lambda { @s.rb_define_class_under(CApiClassSpecs, "Sub", Object) }.should raise_error(TypeError)
+ -> { @s.rb_define_class_under(CApiClassSpecs, "Sub", Object) }.should raise_error(TypeError)
end
end
@@ -311,7 +311,7 @@ describe "C-API Class function" do
end
it "raises a TypeError if class is defined and its superclass mismatches the given one" do
- lambda { @s.rb_define_class_id_under(CApiClassSpecs, :Sub, Object) }.should raise_error(TypeError)
+ -> { @s.rb_define_class_id_under(CApiClassSpecs, :Sub, Object) }.should raise_error(TypeError)
end
end
@@ -331,7 +331,7 @@ describe "C-API Class function" do
end
it "raises a NameError if the class variable is not defined" do
- lambda {
+ -> {
@s.rb_cvar_get(CApiClassSpecs::CVars, "@@no_cvar")
}.should raise_error(NameError, /class variable @@no_cvar/)
end
@@ -344,12 +344,12 @@ describe "C-API Class function" do
end
it "raises a TypeError if passed Class as the superclass" do
- lambda { @s.rb_class_new(Class) }.should raise_error(TypeError)
+ -> { @s.rb_class_new(Class) }.should raise_error(TypeError)
end
it "raises a TypeError if passed a singleton class as the superclass" do
metaclass = Object.new.singleton_class
- lambda { @s.rb_class_new(metaclass) }.should raise_error(TypeError)
+ -> { @s.rb_class_new(metaclass) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/optional/capi/data_spec.rb b/spec/ruby/optional/capi/data_spec.rb
index dd99581824..c03b863678 100644
--- a/spec/ruby/optional/capi/data_spec.rb
+++ b/spec/ruby/optional/capi/data_spec.rb
@@ -32,7 +32,7 @@ describe "CApiWrappedStruct" do
end
it "raises a TypeError if the object does not wrap a struct" do
- lambda { @s.get_struct(Object.new) }.should raise_error(TypeError)
+ -> { @s.get_struct(Object.new) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/optional/capi/encoding_spec.rb b/spec/ruby/optional/capi/encoding_spec.rb
index 42e7899c9f..003edc9669 100644
--- a/spec/ruby/optional/capi/encoding_spec.rb
+++ b/spec/ruby/optional/capi/encoding_spec.rb
@@ -21,7 +21,7 @@ describe :rb_enc_set_index, shared: true do
# This is used because indexes should be considered implementation
# dependent. So a pair is returned:
- # [rb_enc_find_index()->name, rb_enc_get(obj)->name]
+ # [rb_enc_find_index() -> name, rb_enc_get(obj) -> name]
result.first.should == result.last
end
@@ -308,7 +308,7 @@ describe "C-API Encoding function" do
end
it "raises a RuntimeError if the second argument is a Symbol" do
- lambda { @s.rb_enc_copy(:symbol, @obj) }.should raise_error(RuntimeError)
+ -> { @s.rb_enc_copy(:symbol, @obj) }.should raise_error(RuntimeError)
end
it "sets the encoding of a Regexp to that of the second argument" do
@@ -359,7 +359,7 @@ describe "C-API Encoding function" do
end
it "raises a RuntimeError if the argument is Symbol" do
- lambda { @s.rb_enc_associate(:symbol, "US-ASCII") }.should raise_error(RuntimeError)
+ -> { @s.rb_enc_associate(:symbol, "US-ASCII") }.should raise_error(RuntimeError)
end
it "sets the encoding of a Regexp to the encoding" do
@@ -386,7 +386,7 @@ describe "C-API Encoding function" do
it "sets the encoding of a Symbol to the encoding" do
index = @s.rb_enc_find_index("UTF-8")
- lambda { @s.rb_enc_associate_index(:symbol, index) }.should raise_error(RuntimeError)
+ -> { @s.rb_enc_associate_index(:symbol, index) }.should raise_error(RuntimeError)
end
end
@@ -440,13 +440,13 @@ describe "C-API Encoding function" do
describe "rb_enc_codepoint_len" do
it "raises ArgumentError if an empty string is given" do
- lambda do
+ -> do
@s.rb_enc_codepoint_len("")
end.should raise_error(ArgumentError)
end
it "raises ArgumentError if an invalid byte sequence is given" do
- lambda do
+ -> do
@s.rb_enc_codepoint_len([0xa0, 0xa1].pack('CC').force_encoding('utf-8')) # Invalid sequence identifier
end.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/optional/capi/exception_spec.rb b/spec/ruby/optional/capi/exception_spec.rb
index fb0d4fb54d..62d7d3706e 100644
--- a/spec/ruby/optional/capi/exception_spec.rb
+++ b/spec/ruby/optional/capi/exception_spec.rb
@@ -28,13 +28,13 @@ describe "C-API Exception function" do
describe "rb_exc_raise" do
it "raises passed exception" do
runtime_error = RuntimeError.new '42'
- lambda { @s.rb_exc_raise(runtime_error) }.should raise_error(RuntimeError, '42')
+ -> { @s.rb_exc_raise(runtime_error) }.should raise_error(RuntimeError, '42')
end
it "raises an exception with an empty backtrace" do
runtime_error = RuntimeError.new '42'
runtime_error.set_backtrace []
- lambda { @s.rb_exc_raise(runtime_error) }.should raise_error(RuntimeError, '42')
+ -> { @s.rb_exc_raise(runtime_error) }.should raise_error(RuntimeError, '42')
end
end
@@ -52,7 +52,7 @@ describe "C-API Exception function" do
end
it "raises a TypeError if the object is not nil or an Exception instance" do
- lambda { @s.rb_set_errinfo("error") }.should raise_error(TypeError)
+ -> { @s.rb_set_errinfo("error") }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/optional/capi/file_spec.rb b/spec/ruby/optional/capi/file_spec.rb
index 534a03b484..96d731e4fa 100644
--- a/spec/ruby/optional/capi/file_spec.rb
+++ b/spec/ruby/optional/capi/file_spec.rb
@@ -5,7 +5,7 @@ load_extension('file')
describe :rb_file_open, shared: true do
it "raises an ArgumentError if passed an empty mode string" do
touch @name
- lambda { @s.rb_file_open(@name, "") }.should raise_error(ArgumentError)
+ -> { @s.rb_file_open(@name, "") }.should raise_error(ArgumentError)
end
it "opens a file in read-only mode with 'r'" do
diff --git a/spec/ruby/optional/capi/fixnum_spec.rb b/spec/ruby/optional/capi/fixnum_spec.rb
index dffe3da0bb..aa02a0543b 100644
--- a/spec/ruby/optional/capi/fixnum_spec.rb
+++ b/spec/ruby/optional/capi/fixnum_spec.rb
@@ -27,7 +27,7 @@ describe "CApiFixnumSpecs" do
platform_is wordsize: 64 do # sizeof(long) > sizeof(int)
it "raises a TypeError if passed nil" do
- lambda { @s.FIX2INT(nil) }.should raise_error(TypeError)
+ -> { @s.FIX2INT(nil) }.should raise_error(TypeError)
end
it "converts a Float" do
@@ -39,16 +39,16 @@ describe "CApiFixnumSpecs" do
end
it "raises a RangeError if the value does not fit a native int" do
- lambda { @s.FIX2INT(0x7fff_ffff+1) }.should raise_error(RangeError)
- lambda { @s.FIX2INT(-(1 << 31) - 1) }.should raise_error(RangeError)
+ -> { @s.FIX2INT(0x7fff_ffff+1) }.should raise_error(RangeError)
+ -> { @s.FIX2INT(-(1 << 31) - 1) }.should raise_error(RangeError)
end
it "raises a RangeError if the value is more than 32bits" do
- lambda { @s.FIX2INT(0xffff_ffff+1) }.should raise_error(RangeError)
+ -> { @s.FIX2INT(0xffff_ffff+1) }.should raise_error(RangeError)
end
it "raises a RangeError if the value is more than 64bits" do
- lambda { @s.FIX2INT(0xffff_ffff_ffff_ffff+1) }.should raise_error(RangeError)
+ -> { @s.FIX2INT(0xffff_ffff_ffff_ffff+1) }.should raise_error(RangeError)
end
it "calls #to_int to coerce the value" do
@@ -76,7 +76,7 @@ describe "CApiFixnumSpecs" do
platform_is wordsize: 64 do # sizeof(long) > sizeof(int)
it "raises a TypeError if passed nil" do
- lambda { @s.FIX2UINT(nil) }.should raise_error(TypeError)
+ -> { @s.FIX2UINT(nil) }.should raise_error(TypeError)
end
it "converts a Float" do
@@ -85,16 +85,16 @@ describe "CApiFixnumSpecs" do
it "raises a RangeError if the value does not fit a native uint" do
# Interestingly, on MRI FIX2UINT(-1) is allowed
- lambda { @s.FIX2UINT(0xffff_ffff+1) }.should raise_error(RangeError)
- lambda { @s.FIX2UINT(-(1 << 31) - 1) }.should raise_error(RangeError)
+ -> { @s.FIX2UINT(0xffff_ffff+1) }.should raise_error(RangeError)
+ -> { @s.FIX2UINT(-(1 << 31) - 1) }.should raise_error(RangeError)
end
it "raises a RangeError if the value is more than 32bits" do
- lambda { @s.FIX2UINT(0xffff_ffff+1) }.should raise_error(RangeError)
+ -> { @s.FIX2UINT(0xffff_ffff+1) }.should raise_error(RangeError)
end
it "raises a RangeError if the value is more than 64bits" do
- lambda { @s.FIX2UINT(0xffff_ffff_ffff_ffff+1) }.should raise_error(RangeError)
+ -> { @s.FIX2UINT(0xffff_ffff_ffff_ffff+1) }.should raise_error(RangeError)
end
end
end
diff --git a/spec/ruby/optional/capi/globals_spec.rb b/spec/ruby/optional/capi/globals_spec.rb
index 0bded557ba..84694b1375 100644
--- a/spec/ruby/optional/capi/globals_spec.rb
+++ b/spec/ruby/optional/capi/globals_spec.rb
@@ -44,7 +44,7 @@ describe "CApiGlobalSpecs" do
it "rb_define_readonly_variable should define a new readonly global variable" do
@f.rb_define_readonly_variable("ro_gvar", 15)
$ro_gvar.should == 15
- lambda { $ro_gvar = 10 }.should raise_error(NameError)
+ -> { $ro_gvar = 10 }.should raise_error(NameError)
end
it "rb_define_hooked_variable should define a C hooked global variable" do
diff --git a/spec/ruby/optional/capi/hash_spec.rb b/spec/ruby/optional/capi/hash_spec.rb
index 92dc62d55b..2923faf7de 100644
--- a/spec/ruby/optional/capi/hash_spec.rb
+++ b/spec/ruby/optional/capi/hash_spec.rb
@@ -36,7 +36,7 @@ describe "C-API Hash function" do
obj = mock("rb_hash no to_int")
obj.should_receive(:hash).and_return(nil)
- lambda { @s.rb_hash(obj) }.should raise_error(TypeError)
+ -> { @s.rb_hash(obj) }.should raise_error(TypeError)
end
end
@@ -131,15 +131,15 @@ describe "C-API Hash function" do
it "raises a KeyError if the key is not found and default is set" do
@hsh.default = :d
- lambda { @s.rb_hash_fetch(@hsh, :c) }.should raise_error(KeyError)
+ -> { @s.rb_hash_fetch(@hsh, :c) }.should raise_error(KeyError)
end
it "raises a KeyError if the key is not found and no default is set" do
- lambda { @s.rb_hash_fetch(@hsh, :c) }.should raise_error(KeyError)
+ -> { @s.rb_hash_fetch(@hsh, :c) }.should raise_error(KeyError)
end
context "when key is not found" do
- it_behaves_like :key_error, -> (obj, key) {
+ it_behaves_like :key_error, -> obj, key {
@s.rb_hash_fetch(obj, key)
}, { a: 1 }
end
@@ -245,13 +245,13 @@ describe "C-API Hash function" do
end
it "raises a TypeError if the argument does not respond to #to_hash" do
- lambda { @s.rb_Hash(42) }.should raise_error(TypeError)
+ -> { @s.rb_Hash(42) }.should raise_error(TypeError)
end
it "raises a TypeError if #to_hash does not return a hash" do
h = BasicObject.new
def h.to_hash; 42; end
- lambda { @s.rb_Hash(h) }.should raise_error(TypeError)
+ -> { @s.rb_Hash(h) }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/optional/capi/io_spec.rb b/spec/ruby/optional/capi/io_spec.rb
index 622c770eef..7947a48eac 100644
--- a/spec/ruby/optional/capi/io_spec.rb
+++ b/spec/ruby/optional/capi/io_spec.rb
@@ -142,12 +142,12 @@ describe "C-API IO function" do
describe "rb_io_check_closed" do
it "does not raise an exception if the IO is not closed" do
# The MRI function is void, so we use should_not raise_error
- lambda { @o.rb_io_check_closed(@io) }.should_not raise_error
+ -> { @o.rb_io_check_closed(@io) }.should_not raise_error
end
it "raises an error if the IO is closed" do
@io.close
- lambda { @o.rb_io_check_closed(@io) }.should raise_error(IOError)
+ -> { @o.rb_io_check_closed(@io) }.should raise_error(IOError)
end
end
@@ -155,13 +155,13 @@ describe "C-API IO function" do
# object is frozen, *not* if it's tainted.
describe "rb_io_taint_check" do
it "does not raise an exception if the IO is not frozen" do
- lambda { @o.rb_io_taint_check(@io) }.should_not raise_error
+ -> { @o.rb_io_taint_check(@io) }.should_not raise_error
end
it "raises an exception if the IO is frozen" do
@io.freeze
- lambda { @o.rb_io_taint_check(@io) }.should raise_error(RuntimeError)
+ -> { @o.rb_io_taint_check(@io) }.should raise_error(RuntimeError)
end
end
@@ -206,15 +206,15 @@ describe "C-API IO function" do
describe "rb_io_check_readable" do
it "does not raise an exception if the IO is opened for reading" do
# The MRI function is void, so we use should_not raise_error
- lambda { @o.rb_io_check_readable(@r_io) }.should_not raise_error
+ -> { @o.rb_io_check_readable(@r_io) }.should_not raise_error
end
it "does not raise an exception if the IO is opened for read and write" do
- lambda { @o.rb_io_check_readable(@rw_io) }.should_not raise_error
+ -> { @o.rb_io_check_readable(@rw_io) }.should_not raise_error
end
it "raises an IOError if the IO is not opened for reading" do
- lambda { @o.rb_io_check_readable(@w_io) }.should raise_error(IOError)
+ -> { @o.rb_io_check_readable(@w_io) }.should raise_error(IOError)
end
end
@@ -222,15 +222,15 @@ describe "C-API IO function" do
describe "rb_io_check_writable" do
it "does not raise an exeption if the IO is opened for writing" do
# The MRI function is void, so we use should_not raise_error
- lambda { @o.rb_io_check_writable(@w_io) }.should_not raise_error
+ -> { @o.rb_io_check_writable(@w_io) }.should_not raise_error
end
it "does not raise an exception if the IO is opened for read and write" do
- lambda { @o.rb_io_check_writable(@rw_io) }.should_not raise_error
+ -> { @o.rb_io_check_writable(@rw_io) }.should_not raise_error
end
it "raises an IOError if the IO is not opened for reading" do
- lambda { @o.rb_io_check_writable(@r_io) }.should raise_error(IOError)
+ -> { @o.rb_io_check_writable(@r_io) }.should raise_error(IOError)
end
end
@@ -242,7 +242,7 @@ describe "C-API IO function" do
it "raises an IOError if the IO is closed" do
@w_io.close
- lambda { @o.rb_io_wait_writable(@w_io) }.should raise_error(IOError)
+ -> { @o.rb_io_wait_writable(@w_io) }.should raise_error(IOError)
end
end
@@ -261,7 +261,7 @@ describe "C-API IO function" do
it "raises and IOError if passed a closed stream" do
@r_io.close
- lambda {
+ -> {
@o.rb_io_wait_readable(@r_io, false)
}.should raise_error(IOError)
end
diff --git a/spec/ruby/optional/capi/kernel_spec.rb b/spec/ruby/optional/capi/kernel_spec.rb
index 3fb2c8ed2d..d123eb13ea 100644
--- a/spec/ruby/optional/capi/kernel_spec.rb
+++ b/spec/ruby/optional/capi/kernel_spec.rb
@@ -19,7 +19,7 @@ describe "C-API Kernel function" do
describe "rb_need_block" do
it "raises a LocalJumpError if no block is given" do
- lambda { @s.rb_need_block }.should raise_error(LocalJumpError)
+ -> { @s.rb_need_block }.should raise_error(LocalJumpError)
end
it "does not raise a LocalJumpError if a block is given" do
@@ -64,12 +64,12 @@ describe "C-API Kernel function" do
describe "rb_raise" do
it "raises an exception" do
- lambda { @s.rb_raise({}) }.should raise_error(TypeError)
+ -> { @s.rb_raise({}) }.should raise_error(TypeError)
end
it "terminates the function at the point it was called" do
h = {}
- lambda { @s.rb_raise(h) }.should raise_error(TypeError)
+ -> { @s.rb_raise(h) }.should raise_error(TypeError)
h[:stage].should == :before
end
end
@@ -95,7 +95,7 @@ describe "C-API Kernel function" do
end
it "raises an ArgumentError if there is no catch block for the symbol" do
- lambda { @s.rb_throw(nil) }.should raise_error(ArgumentError)
+ -> { @s.rb_throw(nil) }.should raise_error(ArgumentError)
end
end
@@ -121,7 +121,7 @@ describe "C-API Kernel function" do
end
it "raises an ArgumentError if there is no catch block for the symbol" do
- lambda { @s.rb_throw(nil) }.should raise_error(ArgumentError)
+ -> { @s.rb_throw(nil) }.should raise_error(ArgumentError)
end
end
@@ -151,13 +151,13 @@ describe "C-API Kernel function" do
describe "rb_sys_fail" do
it "raises an exception from the value of errno" do
- lambda do
+ -> do
@s.rb_sys_fail("additional info")
end.should raise_error(SystemCallError, /additional info/)
end
it "can take a NULL message" do
- lambda do
+ -> do
@s.rb_sys_fail(nil)
end.should raise_error(Errno::EPERM)
end
@@ -165,13 +165,13 @@ describe "C-API Kernel function" do
describe "rb_syserr_fail" do
it "raises an exception from the given error" do
- lambda do
+ -> do
@s.rb_syserr_fail(Errno::EINVAL::Errno, "additional info")
end.should raise_error(Errno::EINVAL, /additional info/)
end
it "can take a NULL message" do
- lambda do
+ -> do
@s.rb_syserr_fail(Errno::EINVAL::Errno, nil)
end.should raise_error(Errno::EINVAL)
end
@@ -189,7 +189,7 @@ describe "C-API Kernel function" do
end
it "raises LocalJumpError when no block is given" do
- lambda { @s.rb_yield(1) }.should raise_error(LocalJumpError)
+ -> { @s.rb_yield(1) }.should raise_error(LocalJumpError)
end
it "rb_yield to a block that breaks does not raise an error" do
@@ -229,7 +229,7 @@ describe "C-API Kernel function" do
end
it "raises LocalJumpError when no block is given" do
- lambda { @s.rb_yield_splat([1, 2]) }.should raise_error(LocalJumpError)
+ -> { @s.rb_yield_splat([1, 2]) }.should raise_error(LocalJumpError)
end
end
@@ -249,7 +249,7 @@ describe "C-API Kernel function" do
end
it "raises LocalJumpError when no block is given" do
- lambda { @s.rb_yield_splat([1, 2]) }.should raise_error(LocalJumpError)
+ -> { @s.rb_yield_splat([1, 2]) }.should raise_error(LocalJumpError)
end
end
@@ -276,7 +276,7 @@ describe "C-API Kernel function" do
it "will allow cleanup code to run after a raise" do
proof = [] # Hold proof of work performed after the yield.
- lambda do
+ -> do
@s.rb_protect_yield(7, proof) { |x| raise NameError}
end.should raise_error(NameError)
proof[0].should == 23
@@ -284,7 +284,7 @@ describe "C-API Kernel function" do
it "will return nil if an error was raised" do
proof = [] # Hold proof of work performed after the yield.
- lambda do
+ -> do
@s.rb_protect_yield(7, proof) { |x| raise NameError}
end.should raise_error(NameError)
proof[0].should == 23
@@ -301,7 +301,7 @@ describe "C-API Kernel function" do
it "will allow cleanup code to be run when an exception is raised" do
proof = []
- lambda do
+ -> do
@s.rb_eval_string_protect('raise RuntimeError', proof)
end.should raise_error(RuntimeError)
proof.should == [23, nil]
@@ -310,12 +310,12 @@ describe "C-API Kernel function" do
describe "rb_rescue" do
before :each do
- @proc = lambda { |x| x }
- @raise_proc_returns_sentinel = lambda {|*_| :raise_proc_executed }
- @raise_proc_returns_arg = lambda {|*a| a }
- @arg_error_proc = lambda { |*_| raise ArgumentError, '' }
- @std_error_proc = lambda { |*_| raise StandardError, '' }
- @exc_error_proc = lambda { |*_| raise Exception, '' }
+ @proc = -> x { x }
+ @raise_proc_returns_sentinel = -> *_ { :raise_proc_executed }
+ @raise_proc_returns_arg = -> *a { a }
+ @arg_error_proc = -> *_ { raise ArgumentError, '' }
+ @std_error_proc = -> *_ { raise StandardError, '' }
+ @exc_error_proc = -> *_ { raise Exception, '' }
end
it "executes passed function" do
@@ -344,21 +344,21 @@ describe "C-API Kernel function" do
end
it "raises an exception if passed function raises an exception other than StandardError" do
- lambda { @s.rb_rescue(@exc_error_proc, nil, @raise_proc_returns_arg, nil) }.should raise_error(Exception)
+ -> { @s.rb_rescue(@exc_error_proc, nil, @raise_proc_returns_arg, nil) }.should raise_error(Exception)
end
it "raises an exception if any exception is raised inside 'raise function'" do
- lambda { @s.rb_rescue(@std_error_proc, nil, @std_error_proc, nil) }.should raise_error(StandardError)
+ -> { @s.rb_rescue(@std_error_proc, nil, @std_error_proc, nil) }.should raise_error(StandardError)
end
it "makes $! available only during 'raise function' execution" do
- @s.rb_rescue(@std_error_proc, nil, lambda { |*_| $! }, nil).class.should == StandardError
+ @s.rb_rescue(@std_error_proc, nil, -> *_ { $! }, nil).class.should == StandardError
$!.should == nil
end
it "returns the break value if the passed function yields to a block with a break" do
def proc_caller
- @s.rb_rescue(lambda { |*_| yield }, nil, @proc, nil)
+ @s.rb_rescue(-> *_ { yield }, nil, @proc, nil)
end
proc_caller { break :value }.should == :value
@@ -367,13 +367,13 @@ describe "C-API Kernel function" do
describe "rb_rescue2" do
it "only rescues if one of the passed exceptions is raised" do
- proc = lambda { |x| x }
- arg_error_proc = lambda { |*_| raise ArgumentError, '' }
- run_error_proc = lambda { |*_| raise RuntimeError, '' }
- type_error_proc = lambda { |*_| raise TypeError, '' }
+ proc = -> x { x }
+ arg_error_proc = -> *_ { raise ArgumentError, '' }
+ run_error_proc = -> *_ { raise RuntimeError, '' }
+ type_error_proc = -> *_ { raise TypeError, '' }
@s.rb_rescue2(arg_error_proc, :no_exc, proc, :exc, ArgumentError, RuntimeError).should == :exc
@s.rb_rescue2(run_error_proc, :no_exc, proc, :exc, ArgumentError, RuntimeError).should == :exc
- lambda {
+ -> {
@s.rb_rescue2(type_error_proc, :no_exc, proc, :exc, ArgumentError, RuntimeError)
}.should raise_error(TypeError)
end
@@ -385,11 +385,11 @@ describe "C-API Kernel function" do
end
it "executes passed function" do
- @s.rb_catch("foo", lambda { 1 }).should == 1
+ @s.rb_catch("foo", -> { 1 }).should == 1
end
it "terminates the function at the point it was called" do
- proc = lambda do
+ proc = -> do
ScratchPad << :before_throw
throw :thrown_value
ScratchPad << :after_throw
@@ -399,7 +399,7 @@ describe "C-API Kernel function" do
end
it "raises an ArgumentError if the throw symbol isn't caught" do
- lambda { @s.rb_catch("foo", lambda { throw :bar }) }.should raise_error(ArgumentError)
+ -> { @s.rb_catch("foo", -> { throw :bar }) }.should raise_error(ArgumentError)
end
end
@@ -411,11 +411,11 @@ describe "C-API Kernel function" do
end
it "executes passed function" do
- @s.rb_catch_obj(@tag, lambda { 1 }).should == 1
+ @s.rb_catch_obj(@tag, -> { 1 }).should == 1
end
it "terminates the function at the point it was called" do
- proc = lambda do
+ proc = -> do
ScratchPad << :before_throw
throw @tag
ScratchPad << :after_throw
@@ -425,36 +425,36 @@ describe "C-API Kernel function" do
end
it "raises an ArgumentError if the throw symbol isn't caught" do
- lambda { @s.rb_catch("foo", lambda { throw :bar }) }.should raise_error(ArgumentError)
+ -> { @s.rb_catch("foo", -> { throw :bar }) }.should raise_error(ArgumentError)
end
end
describe "rb_ensure" do
it "executes passed function and returns its value" do
- proc = lambda { |x| x }
+ proc = -> x { x }
@s.rb_ensure(proc, :proc, proc, :ensure_proc).should == :proc
end
it "executes passed 'ensure function' when no exception is raised" do
foo = nil
- proc = lambda { |*_| }
- ensure_proc = lambda { |x| foo = x }
+ proc = -> *_ { }
+ ensure_proc = -> x { foo = x }
@s.rb_ensure(proc, nil, ensure_proc, :foo)
foo.should == :foo
end
it "executes passed 'ensure function' when an exception is raised" do
foo = nil
- raise_proc = lambda { raise '' }
- ensure_proc = lambda { |x| foo = x }
+ raise_proc = -> { raise '' }
+ ensure_proc = -> x { foo = x }
@s.rb_ensure(raise_proc, nil, ensure_proc, :foo) rescue nil
foo.should == :foo
end
it "raises the same exception raised inside passed function" do
- raise_proc = lambda { |*_| raise RuntimeError, 'foo' }
- proc = lambda { |*_| }
- lambda { @s.rb_ensure(raise_proc, nil, proc, nil) }.should raise_error(RuntimeError, 'foo')
+ raise_proc = -> *_ { raise RuntimeError, 'foo' }
+ proc = -> *_ { }
+ -> { @s.rb_ensure(raise_proc, nil, proc, nil) }.should raise_error(RuntimeError, 'foo')
end
end
@@ -466,7 +466,7 @@ describe "C-API Kernel function" do
describe "rb_block_proc" do
it "converts the implicit block into a proc" do
- proc = @s.rb_block_proc() { 1+1 }
+ proc = @s.rb_block_proc { 1+1 }
proc.should be_kind_of(Proc)
proc.call.should == 2
proc.lambda?.should == false
@@ -482,16 +482,16 @@ describe "C-API Kernel function" do
end
describe "rb_block_lambda" do
- it "converts the implicit block into a Proc but does not convert it to a lambda" do
- proc = @s.rb_block_proc { 1+1 }
+ it "converts the implicit block into a lambda" do
+ proc = @s.rb_block_lambda { 1+1 }
proc.should be_kind_of(Proc)
proc.call.should == 2
- proc.lambda?.should == false
+ proc.lambda?.should == true
end
it "passes through an existing Proc and does not convert to a lambda" do
b = proc { 1+1 }
- proc = @s.rb_block_proc(&b)
+ proc = @s.rb_block_lambda(&b)
proc.should equal(b)
proc.call.should == 2
proc.lambda?.should == false
@@ -569,7 +569,7 @@ describe "C-API Kernel function" do
@s.rb_funcall3(@obj, :method_public).should == :method_public
end
it "does not call a private method" do
- lambda { @s.rb_funcall3(@obj, :method_private) }.should raise_error(NoMethodError, /private/)
+ -> { @s.rb_funcall3(@obj, :method_private) }.should raise_error(NoMethodError, /private/)
end
end
@@ -588,7 +588,7 @@ describe "C-API Kernel function" do
end
it "does not call a private method" do
- lambda { @s.rb_funcall_with_block(@obj, :method_private, proc { :result }) }.should raise_error(NoMethodError, /private/)
+ -> { @s.rb_funcall_with_block(@obj, :method_private, proc { :result }) }.should raise_error(NoMethodError, /private/)
end
end
end
diff --git a/spec/ruby/optional/capi/module_spec.rb b/spec/ruby/optional/capi/module_spec.rb
index b94e96e846..34e6db82d8 100644
--- a/spec/ruby/optional/capi/module_spec.rb
+++ b/spec/ruby/optional/capi/module_spec.rb
@@ -54,7 +54,7 @@ describe "CApiModule" do
it "raises a TypeError if the constant is not a module" do
::CApiModuleSpecsGlobalConst = 7
- lambda { @m.rb_define_module("CApiModuleSpecsGlobalConst") }.should raise_error(TypeError)
+ -> { @m.rb_define_module("CApiModuleSpecsGlobalConst") }.should raise_error(TypeError)
Object.send :remove_const, :CApiModuleSpecsGlobalConst
end
@@ -303,7 +303,7 @@ describe "CApiModule" do
a = cls.new
@m.rb_define_singleton_method a, "module_specs_singleton_method"
a.module_specs_singleton_method.should == :test_method
- lambda { cls.new.module_specs_singleton_method }.should raise_error(NoMethodError)
+ -> { cls.new.module_specs_singleton_method }.should raise_error(NoMethodError)
end
end
@@ -323,7 +323,7 @@ describe "CApiModule" do
end
it "does not raise exceptions when passed a missing name" do
- lambda { @m.rb_undef_method @class, "not_exist" }.should_not raise_error
+ -> { @m.rb_undef_method @class, "not_exist" }.should_not raise_error
end
describe "when given a frozen Class" do
@@ -332,11 +332,11 @@ describe "CApiModule" do
end
it "raises a #{frozen_error_class} when passed a name" do
- lambda { @m.rb_undef_method @frozen, "ruby_test_method" }.should raise_error(frozen_error_class)
+ -> { @m.rb_undef_method @frozen, "ruby_test_method" }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} when passed a missing name" do
- lambda { @m.rb_undef_method @frozen, "not_exist" }.should raise_error(frozen_error_class)
+ -> { @m.rb_undef_method @frozen, "not_exist" }.should raise_error(frozen_error_class)
end
end
end
diff --git a/spec/ruby/optional/capi/mutex_spec.rb b/spec/ruby/optional/capi/mutex_spec.rb
index 1b76c5c250..34659974f5 100644
--- a/spec/ruby/optional/capi/mutex_spec.rb
+++ b/spec/ruby/optional/capi/mutex_spec.rb
@@ -46,14 +46,14 @@ describe "C-API Mutex functions" do
it "throws an exception when already locked in the same thread" do
@m.lock
- lambda { @s.rb_mutex_lock(@m) }.should raise_error(ThreadError)
+ -> { @s.rb_mutex_lock(@m) }.should raise_error(ThreadError)
@m.locked?.should be_true
end
end
describe "rb_mutex_unlock" do
it "raises an exception when not locked" do
- lambda { @s.rb_mutex_unlock(@m) }.should raise_error(ThreadError)
+ -> { @s.rb_mutex_unlock(@m) }.should raise_error(ThreadError)
@m.locked?.should be_false
end
@@ -66,7 +66,7 @@ describe "C-API Mutex functions" do
describe "rb_mutex_sleep" do
it "throws an exception when the mutex is not locked" do
- lambda { @s.rb_mutex_sleep(@m, 0.1) }.should raise_error(ThreadError)
+ -> { @s.rb_mutex_sleep(@m, 0.1) }.should raise_error(ThreadError)
@m.locked?.should be_false
end
@@ -82,7 +82,7 @@ describe "C-API Mutex functions" do
describe "rb_mutex_synchronize" do
it "calls the function while the mutex is locked" do
- callback = lambda { @m.locked?.should be_true }
+ callback = -> { @m.locked?.should be_true }
@s.rb_mutex_synchronize(@m, callback)
end
end
diff --git a/spec/ruby/optional/capi/numeric_spec.rb b/spec/ruby/optional/capi/numeric_spec.rb
index 62921f2467..d76f353850 100644
--- a/spec/ruby/optional/capi/numeric_spec.rb
+++ b/spec/ruby/optional/capi/numeric_spec.rb
@@ -9,7 +9,7 @@ describe "CApiNumericSpecs" do
describe "NUM2INT" do
it "raises a TypeError if passed nil" do
- lambda { @s.NUM2INT(nil) }.should raise_error(TypeError)
+ -> { @s.NUM2INT(nil) }.should raise_error(TypeError)
end
it "converts a Float" do
@@ -33,7 +33,7 @@ describe "CApiNumericSpecs" do
end
it "raises a RangeError if the value is more than 32bits" do
- lambda { @s.NUM2INT(0xffff_ffff+1) }.should raise_error(RangeError)
+ -> { @s.NUM2INT(0xffff_ffff+1) }.should raise_error(RangeError)
end
it "calls #to_int to coerce the value" do
@@ -45,7 +45,7 @@ describe "CApiNumericSpecs" do
describe "NUM2UINT" do
it "raises a TypeError if passed nil" do
- lambda { @s.NUM2UINT(nil) }.should raise_error(TypeError)
+ -> { @s.NUM2UINT(nil) }.should raise_error(TypeError)
end
it "converts a Float" do
@@ -69,15 +69,15 @@ describe "CApiNumericSpecs" do
end
it "raises a RangeError if the value is more than 32bits" do
- lambda { @s.NUM2UINT(0xffff_ffff+1) }.should raise_error(RangeError)
+ -> { @s.NUM2UINT(0xffff_ffff+1) }.should raise_error(RangeError)
end
it "raises a RangeError if the value is less than 32bits negative" do
- lambda { @s.NUM2UINT(-0x8000_0000-1) }.should raise_error(RangeError)
+ -> { @s.NUM2UINT(-0x8000_0000-1) }.should raise_error(RangeError)
end
it "raises a RangeError if the value is more than 64bits" do
- lambda do
+ -> do
@s.NUM2UINT(0xffff_ffff_ffff_ffff+1)
end.should raise_error(RangeError)
end
@@ -91,7 +91,7 @@ describe "CApiNumericSpecs" do
describe "NUM2LONG" do
it "raises a TypeError if passed nil" do
- lambda { @s.NUM2LONG(nil) }.should raise_error(TypeError)
+ -> { @s.NUM2LONG(nil) }.should raise_error(TypeError)
end
it "converts a Float" do
@@ -116,7 +116,7 @@ describe "CApiNumericSpecs" do
end
it "raises a RangeError if the value is more than 32bits" do
- lambda { @s.NUM2LONG(0xffff_ffff+1) }.should raise_error(RangeError)
+ -> { @s.NUM2LONG(0xffff_ffff+1) }.should raise_error(RangeError)
end
end
@@ -130,7 +130,7 @@ describe "CApiNumericSpecs" do
end
it "raises a RangeError if the value is more than 64bits" do
- lambda do
+ -> do
@s.NUM2LONG(0xffff_ffff_ffff_ffff+1)
end.should raise_error(RangeError)
end
@@ -145,7 +145,7 @@ describe "CApiNumericSpecs" do
describe "INT2NUM" do
it "raises a TypeError if passed nil" do
- lambda { @s.INT2NUM(nil) }.should raise_error(TypeError)
+ -> { @s.INT2NUM(nil) }.should raise_error(TypeError)
end
it "converts a Float" do
@@ -153,7 +153,7 @@ describe "CApiNumericSpecs" do
end
it "raises a RangeError when passed a Bignum" do
- lambda { @s.INT2NUM(bignum_value) }.should raise_error(RangeError)
+ -> { @s.INT2NUM(bignum_value) }.should raise_error(RangeError)
end
it "converts a Fixnum" do
@@ -167,7 +167,7 @@ describe "CApiNumericSpecs" do
describe "NUM2ULONG" do
it "raises a TypeError if passed nil" do
- lambda { @s.NUM2ULONG(nil) }.should raise_error(TypeError)
+ -> { @s.NUM2ULONG(nil) }.should raise_error(TypeError)
end
it "converts a Float" do
@@ -199,7 +199,7 @@ describe "CApiNumericSpecs" do
end
it "raises a RangeError if the value is more than 32bits" do
- lambda { @s.NUM2ULONG(0xffff_ffff+1) }.should raise_error(RangeError)
+ -> { @s.NUM2ULONG(0xffff_ffff+1) }.should raise_error(RangeError)
end
end
@@ -220,7 +220,7 @@ describe "CApiNumericSpecs" do
end
it "raises a RangeError if the value is more than 64bits" do
- lambda do
+ -> do
@s.NUM2ULONG(0xffff_ffff_ffff_ffff+1)
end.should raise_error(RangeError)
end
@@ -287,11 +287,11 @@ describe "CApiNumericSpecs" do
describe "NUM2DBL" do
it "raises a TypeError if passed nil" do
- lambda { @s.NUM2DBL(nil) }.should raise_error(TypeError)
+ -> { @s.NUM2DBL(nil) }.should raise_error(TypeError)
end
it "raises a TypeError if passed a String" do
- lambda { @s.NUM2DBL("1.2") }.should raise_error(TypeError)
+ -> { @s.NUM2DBL("1.2") }.should raise_error(TypeError)
end
it "converts a Float" do
@@ -327,13 +327,13 @@ describe "CApiNumericSpecs" do
end
it "raises a TypeError when passed an empty String" do
- lambda { @s.NUM2CHR("") }.should raise_error(TypeError)
+ -> { @s.NUM2CHR("") }.should raise_error(TypeError)
end
end
describe "rb_num_zerodiv" do
it "raises a RuntimeError" do
- lambda { @s.rb_num_zerodiv() }.should raise_error(ZeroDivisionError, 'divided by 0')
+ -> { @s.rb_num_zerodiv() }.should raise_error(ZeroDivisionError, 'divided by 0')
end
end
@@ -363,7 +363,7 @@ describe "CApiNumericSpecs" do
end
it "raises an ArgumentError when passed nil" do
- lambda {
+ -> {
@s.rb_cmpint(nil, 4)
}.should raise_error(ArgumentError)
end
@@ -389,7 +389,7 @@ describe "CApiNumericSpecs" do
obj = mock("rb_num_coerce_bin")
obj.should_receive(:coerce).with(2).and_return(nil)
- lambda { @s.rb_num_coerce_bin(2, obj, :+) }.should raise_error(TypeError)
+ -> { @s.rb_num_coerce_bin(2, obj, :+) }.should raise_error(TypeError)
end
end
@@ -457,14 +457,14 @@ describe "CApiNumericSpecs" do
obj.should_receive(:coerce).with(2).and_return([obj, 2])
obj.should_receive(:<).with(2).and_return(nil)
- lambda { @s.rb_num_coerce_relop(2, obj, :<) }.should raise_error(ArgumentError)
+ -> { @s.rb_num_coerce_relop(2, obj, :<) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if #coerce does not return an Array" do
obj = mock("rb_num_coerce_relop")
obj.should_receive(:coerce).with(2).and_return(nil)
- lambda { @s.rb_num_coerce_relop(2, obj, :<) }.should raise_error(ArgumentError)
+ -> { @s.rb_num_coerce_relop(2, obj, :<) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/optional/capi/object_spec.rb b/spec/ruby/optional/capi/object_spec.rb
index 34aae636c7..43b74b9151 100644
--- a/spec/ruby/optional/capi/object_spec.rb
+++ b/spec/ruby/optional/capi/object_spec.rb
@@ -230,7 +230,7 @@ describe "CApiObject" do
obj = mock("rb_check_convert_type")
obj.should_receive(:to_array).and_return("string")
- lambda do
+ -> do
@o.rb_check_convert_type(obj, "Array", "to_array")
end.should raise_error(TypeError)
end
@@ -255,7 +255,7 @@ describe "CApiObject" do
obj = mock("rb_convert_type")
obj.should_receive(:to_array).and_return(nil)
- lambda do
+ -> do
@o.rb_convert_type(obj, "Array", "to_array")
end.should raise_error(TypeError)
end
@@ -264,7 +264,7 @@ describe "CApiObject" do
obj = mock("rb_convert_type")
obj.should_receive(:to_array).and_return("string")
- lambda do
+ -> do
@o.rb_convert_type(obj, "Array", "to_array")
end.should raise_error(TypeError)
end
@@ -308,13 +308,13 @@ describe "CApiObject" do
it "sends #to_ary to the argument and raises TypeError if it's not a kind of Array" do
obj = mock("to_ary")
obj.should_receive(:to_ary).and_return(Object.new)
- lambda { @o.rb_check_array_type obj }.should raise_error(TypeError)
+ -> { @o.rb_check_array_type obj }.should raise_error(TypeError)
end
it "does not rescue exceptions raised by #to_ary" do
obj = mock("to_ary")
obj.should_receive(:to_ary).and_raise(frozen_error_class)
- lambda { @o.rb_check_array_type obj }.should raise_error(frozen_error_class)
+ -> { @o.rb_check_array_type obj }.should raise_error(frozen_error_class)
end
end
@@ -356,13 +356,13 @@ describe "CApiObject" do
it "sends #to_str to the argument and raises TypeError if it's not a kind of String" do
obj = mock("to_str")
obj.should_receive(:to_str).and_return(Object.new)
- lambda { @o.rb_check_string_type obj }.should raise_error(TypeError)
+ -> { @o.rb_check_string_type obj }.should raise_error(TypeError)
end
it "does not rescue exceptions raised by #to_str" do
obj = mock("to_str")
obj.should_receive(:to_str).and_raise(RuntimeError)
- lambda { @o.rb_check_string_type obj }.should raise_error(RuntimeError)
+ -> { @o.rb_check_string_type obj }.should raise_error(RuntimeError)
end
end
@@ -639,7 +639,7 @@ describe "CApiObject" do
describe "rb_obj_instance_eval" do
it "evaluates the block in the object context, that includes private methods" do
obj = ObjectTest
- lambda do
+ -> do
@o.rb_obj_instance_eval(obj) { include Kernel }
end.should_not raise_error(NoMethodError)
end
@@ -667,18 +667,18 @@ describe "CApiObject" do
end
it "raises a #{frozen_error_class} if the object passed is frozen" do
- lambda { @o.rb_obj_taint("".freeze) }.should raise_error(frozen_error_class)
+ -> { @o.rb_obj_taint("".freeze) }.should raise_error(frozen_error_class)
end
end
describe "rb_check_frozen" do
it "raises a #{frozen_error_class} if the obj is frozen" do
- lambda { @o.rb_check_frozen("".freeze) }.should raise_error(frozen_error_class)
+ -> { @o.rb_check_frozen("".freeze) }.should raise_error(frozen_error_class)
end
it "does nothing when object isn't frozen" do
obj = ""
- lambda { @o.rb_check_frozen(obj) }.should_not raise_error(TypeError)
+ -> { @o.rb_check_frozen(obj) }.should_not raise_error(TypeError)
end
end
@@ -718,23 +718,23 @@ describe "CApiObject" do
it "raises a TypeError if #to_int does not return an Integer" do
x = mock("to_int")
x.should_receive(:to_int).and_return("5")
- lambda { @o.rb_to_int(x) }.should raise_error(TypeError)
+ -> { @o.rb_to_int(x) }.should raise_error(TypeError)
end
it "raises a TypeError if called with nil" do
- lambda { @o.rb_to_int(nil) }.should raise_error(TypeError)
+ -> { @o.rb_to_int(nil) }.should raise_error(TypeError)
end
it "raises a TypeError if called with true" do
- lambda { @o.rb_to_int(true) }.should raise_error(TypeError)
+ -> { @o.rb_to_int(true) }.should raise_error(TypeError)
end
it "raises a TypeError if called with false" do
- lambda { @o.rb_to_int(false) }.should raise_error(TypeError)
+ -> { @o.rb_to_int(false) }.should raise_error(TypeError)
end
it "raises a TypeError if called with a String" do
- lambda { @o.rb_to_int("1") }.should raise_error(TypeError)
+ -> { @o.rb_to_int("1") }.should raise_error(TypeError)
end
end
@@ -770,7 +770,7 @@ describe "CApiObject" do
end
it "raises a TypeError if arg is no class or module" do
- lambda{
+ ->{
@o.rb_class_inherited_p(1, 2)
}.should raise_error(TypeError)
end
diff --git a/spec/ruby/optional/capi/proc_spec.rb b/spec/ruby/optional/capi/proc_spec.rb
index bffb32484c..9f9a37cc98 100644
--- a/spec/ruby/optional/capi/proc_spec.rb
+++ b/spec/ruby/optional/capi/proc_spec.rb
@@ -86,13 +86,13 @@ describe "C-API when calling Proc.new from a C function" do
# Ruby -> C -> Ruby -> Proc.new
it "raises an ArgumentError when the C function calls a Ruby method that calls Proc.new" do
def @p.Proc_new() Proc.new end
- lambda { @p.rb_Proc_new(2) { :called } }.should raise_error(ArgumentError)
+ -> { @p.rb_Proc_new(2) { :called } }.should raise_error(ArgumentError)
end
# Ruby -> C -> Ruby -> C -> rb_funcall(Proc.new)
it "raises an ArgumentError when the C function calls a Ruby method and that method calls a C function that calls Proc.new" do
def @p.redispatch() rb_Proc_new(0) end
- lambda { @p.rb_Proc_new(3) { :called } }.should raise_error(ArgumentError)
+ -> { @p.rb_Proc_new(3) { :called } }.should raise_error(ArgumentError)
end
ruby_version_is ""..."2.7" do
diff --git a/spec/ruby/optional/capi/range_spec.rb b/spec/ruby/optional/capi/range_spec.rb
index 46df4eec99..7a52dc7ff8 100644
--- a/spec/ruby/optional/capi/range_spec.rb
+++ b/spec/ruby/optional/capi/range_spec.rb
@@ -31,8 +31,8 @@ describe "C-API Range function" do
end
it "raises an ArgumentError when the given start and end can't be compared by using #<=>" do
- lambda { @s.rb_range_new(1, mock('x')) }.should raise_error(ArgumentError)
- lambda { @s.rb_range_new(mock('x'), mock('y')) }.should raise_error(ArgumentError)
+ -> { @s.rb_range_new(1, mock('x')) }.should raise_error(ArgumentError)
+ -> { @s.rb_range_new(mock('x'), mock('y')) }.should raise_error(ArgumentError)
end
end
@@ -83,7 +83,7 @@ describe "C-API Range function" do
it "raises a RangeError when not in range and err is 1" do
r = -5..-1
- lambda { @s.rb_range_beg_len(r, 0, 0, 1, 1) }.should raise_error(RangeError)
+ -> { @s.rb_range_beg_len(r, 0, 0, 1, 1) }.should raise_error(RangeError)
end
it "returns nil when not in range and err is 0" do
diff --git a/spec/ruby/optional/capi/string_spec.rb b/spec/ruby/optional/capi/string_spec.rb
index 432008e825..469a190abd 100644
--- a/spec/ruby/optional/capi/string_spec.rb
+++ b/spec/ruby/optional/capi/string_spec.rb
@@ -327,7 +327,7 @@ describe "C-API String function" do
end
it "raises a TypeError trying to append non-String-like object" do
- lambda { @s.rb_str_append("Hello", 32323)}.should raise_error(TypeError)
+ -> { @s.rb_str_append("Hello", 32323)}.should raise_error(TypeError)
end
it "changes Encoding if a string is appended to an empty string" do
@@ -343,7 +343,7 @@ describe "C-API String function" do
end
describe "rb_str_times" do
- it_behaves_like :string_times, :rb_str_times, ->(str, times) { @s.rb_str_times(str, times) }
+ it_behaves_like :string_times, :rb_str_times, -> str, times { @s.rb_str_times(str, times) }
end
describe "rb_str_buf_cat" do
@@ -414,7 +414,7 @@ describe "C-API String function" do
end
it "converts a C string to a Fixnum strictly if base is 0" do
- lambda { @s.rb_cstr2inum("1234a", 0) }.should raise_error(ArgumentError)
+ -> { @s.rb_cstr2inum("1234a", 0) }.should raise_error(ArgumentError)
end
end
@@ -432,7 +432,7 @@ describe "C-API String function" do
end
it "converts a C string to a Fixnum strictly" do
- lambda { @s.rb_cstr_to_inum("1234a", 10, true) }.should raise_error(ArgumentError)
+ -> { @s.rb_cstr_to_inum("1234a", 10, true) }.should raise_error(ArgumentError)
end
end
@@ -458,8 +458,8 @@ describe "C-API String function" do
end
it "raises a TypeError if coercion fails" do
- lambda { @s.rb_str_to_str(0) }.should raise_error(TypeError)
- lambda { @s.rb_str_to_str(CApiStringSpecs::InvalidTostrTest.new) }.should raise_error(TypeError)
+ -> { @s.rb_str_to_str(0) }.should raise_error(TypeError)
+ -> { @s.rb_str_to_str(CApiStringSpecs::InvalidTostrTest.new) }.should raise_error(TypeError)
end
end
@@ -549,7 +549,7 @@ describe "C-API String function" do
it "does not call #to_s on non-String objects" do
str = mock("fake")
str.should_not_receive(:to_s)
- lambda { @s.send(@method, str) }.should raise_error(TypeError)
+ -> { @s.send(@method, str) }.should raise_error(TypeError)
end
end
@@ -562,7 +562,7 @@ describe "C-API String function" do
begin
Thread.new {
$SAFE = 1
- lambda {
+ -> {
@s.SafeStringValue("str".taint)
}.should raise_error(SecurityError)
}.join
@@ -951,7 +951,7 @@ end
end
it "raises a TypeError if #to_str does not return a string" do
- lambda { @s.rb_String(CApiStringSpecs::InvalidTostrTest.new) }.should raise_error(TypeError)
+ -> { @s.rb_String(CApiStringSpecs::InvalidTostrTest.new) }.should raise_error(TypeError)
end
it "tries to convert the passed argument to a string by calling #to_s" do
@@ -969,11 +969,11 @@ end
end
it "raises an error if a string contains a null" do
- lambda { @s.rb_string_value_cstr("Hello\0 with a null.") }.should raise_error(ArgumentError)
+ -> { @s.rb_string_value_cstr("Hello\0 with a null.") }.should raise_error(ArgumentError)
end
it "raises an error if a UTF-16 string contains a null" do
- lambda { @s.rb_string_value_cstr("Hello\0 with a null.".encode('UTF-16BE')) }.should raise_error(ArgumentError)
+ -> { @s.rb_string_value_cstr("Hello\0 with a null.".encode('UTF-16BE')) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/optional/capi/struct_spec.rb b/spec/ruby/optional/capi/struct_spec.rb
index 3b0972926c..6254b098a9 100644
--- a/spec/ruby/optional/capi/struct_spec.rb
+++ b/spec/ruby/optional/capi/struct_spec.rb
@@ -106,11 +106,11 @@ describe "C-API Struct function" do
describe "rb_struct_define" do
it "raises an ArgumentError if arguments contain duplicate member name" do
- lambda { @s.rb_struct_define(nil, "a", "b", "a") }.should raise_error(ArgumentError)
+ -> { @s.rb_struct_define(nil, "a", "b", "a") }.should raise_error(ArgumentError)
end
it "raises a NameError if an invalid constant name is given" do
- lambda { @s.rb_struct_define("foo", "a", "b", "c") }.should raise_error(NameError)
+ -> { @s.rb_struct_define("foo", "a", "b", "c") }.should raise_error(NameError)
end
end
@@ -131,12 +131,12 @@ describe "C-API Struct function" do
end
it "raises a NameError if the struct member does not exist" do
- lambda { @s.rb_struct_aref(@struct, :d) }.should raise_error(NameError)
+ -> { @s.rb_struct_aref(@struct, :d) }.should raise_error(NameError)
end
it "raises an IndexError if the given index is out of range" do
- lambda { @s.rb_struct_aref(@struct, -4) }.should raise_error(IndexError)
- lambda { @s.rb_struct_aref(@struct, 3) }.should raise_error(IndexError)
+ -> { @s.rb_struct_aref(@struct, -4) }.should raise_error(IndexError)
+ -> { @s.rb_struct_aref(@struct, 3) }.should raise_error(IndexError)
end
end
@@ -147,7 +147,7 @@ describe "C-API Struct function" do
end
it "raises a NameError if the struct member does not exist" do
- lambda { @s.rb_struct_getmember(@struct, :d) }.should raise_error(NameError)
+ -> { @s.rb_struct_getmember(@struct, :d) }.should raise_error(NameError)
end
end
@@ -180,17 +180,17 @@ describe "C-API Struct function" do
end
it "raises a NameError if the struct member does not exist" do
- lambda { @s.rb_struct_aset(@struct, :d, 1) }.should raise_error(NameError)
+ -> { @s.rb_struct_aset(@struct, :d, 1) }.should raise_error(NameError)
end
it "raises an IndexError if the given index is out of range" do
- lambda { @s.rb_struct_aset(@struct, -4, 1) }.should raise_error(IndexError)
- lambda { @s.rb_struct_aset(@struct, 3, 1) }.should raise_error(IndexError)
+ -> { @s.rb_struct_aset(@struct, -4, 1) }.should raise_error(IndexError)
+ -> { @s.rb_struct_aset(@struct, 3, 1) }.should raise_error(IndexError)
end
it "raises a #{frozen_error_class} if the struct is frozen" do
@struct.freeze
- lambda { @s.rb_struct_aset(@struct, :a, 1) }.should raise_error(frozen_error_class)
+ -> { @s.rb_struct_aset(@struct, :a, 1) }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/optional/capi/thread_spec.rb b/spec/ruby/optional/capi/thread_spec.rb
index a46290203a..8ff5b48536 100644
--- a/spec/ruby/optional/capi/thread_spec.rb
+++ b/spec/ruby/optional/capi/thread_spec.rb
@@ -70,7 +70,7 @@ describe "C-API Thread function" do
describe "rb_thread_create" do
it "creates a new thread" do
obj = Object.new
- proc = lambda { |x| ScratchPad.record x }
+ proc = -> x { ScratchPad.record x }
thr = @t.rb_thread_create(proc, obj)
thr.should be_kind_of(Thread)
thr.join
@@ -78,20 +78,20 @@ describe "C-API Thread function" do
end
it "handles throwing an exception in the thread" do
- prc = lambda { |x|
+ prc = -> x {
Thread.current.report_on_exception = false
raise "my error"
}
thr = @t.rb_thread_create(prc, nil)
thr.should be_kind_of(Thread)
- lambda {
+ -> {
thr.join
}.should raise_error(RuntimeError, "my error")
end
it "sets the thread's group" do
- thr = @t.rb_thread_create(lambda { |x| }, nil)
+ thr = @t.rb_thread_create(-> x { }, nil)
begin
thread_group = thr.group
thread_group.should be_an_instance_of(ThreadGroup)
@@ -117,10 +117,7 @@ describe "C-API Thread function" do
# Wake it up, causing the unblock function to be run.
thr.wakeup
- # Make sure it stopped
- thr.join(1).should_not be_nil
-
- # And we got a proper value
+ # Make sure it stopped and we got a proper value
thr.value.should be_true
end
@@ -139,10 +136,7 @@ describe "C-API Thread function" do
# Wake it up, causing the unblock function to be run.
thr.wakeup
- # Make sure it stopped
- thr.join(1).should_not be_nil
-
- # And we got a proper value
+ # Make sure it stopped and we got a proper value
thr.value.should be_true
end
end
diff --git a/spec/ruby/optional/capi/time_spec.rb b/spec/ruby/optional/capi/time_spec.rb
index 427507a3bb..2c824bb566 100644
--- a/spec/ruby/optional/capi/time_spec.rb
+++ b/spec/ruby/optional/capi/time_spec.rb
@@ -96,9 +96,9 @@ describe "CApiTimeSpecs" do
end
it "throws an argument error for a negative value" do
- lambda { @s.rb_time_interval(-1232141421) }.should raise_error(ArgumentError)
- lambda { @s.rb_time_interval(Rational(-3, 2)) }.should raise_error(ArgumentError)
- lambda { @s.rb_time_interval(-1.5) }.should raise_error(ArgumentError)
+ -> { @s.rb_time_interval(-1232141421) }.should raise_error(ArgumentError)
+ -> { @s.rb_time_interval(Rational(-3, 2)) }.should raise_error(ArgumentError)
+ -> { @s.rb_time_interval(-1.5) }.should raise_error(ArgumentError)
end
end
@@ -129,13 +129,13 @@ describe "CApiTimeSpecs" do
end
it "throws an argument error for a negative value" do
- lambda { @s.rb_time_interval(-1232141421) }.should raise_error(ArgumentError)
- lambda { @s.rb_time_interval(Rational(-3, 2)) }.should raise_error(ArgumentError)
- lambda { @s.rb_time_interval(-1.5) }.should raise_error(ArgumentError)
+ -> { @s.rb_time_interval(-1232141421) }.should raise_error(ArgumentError)
+ -> { @s.rb_time_interval(Rational(-3, 2)) }.should raise_error(ArgumentError)
+ -> { @s.rb_time_interval(-1.5) }.should raise_error(ArgumentError)
end
it "throws an argument error when given a Time instance" do
- lambda { @s.rb_time_interval(Time.now) }.should raise_error(TypeError)
+ -> { @s.rb_time_interval(Time.now) }.should raise_error(TypeError)
end
end
@@ -284,8 +284,8 @@ describe "CApiTimeSpecs" do
end
it "raises an ArgumentError if offset passed is not within range of -86400 and 86400 (exclusive)" do
- lambda { @s.rb_time_timespec_new(1447087832, 476451125, 86400) }.should raise_error(ArgumentError)
- lambda { @s.rb_time_timespec_new(1447087832, 476451125, -86400) }.should raise_error(ArgumentError)
+ -> { @s.rb_time_timespec_new(1447087832, 476451125, 86400) }.should raise_error(ArgumentError)
+ -> { @s.rb_time_timespec_new(1447087832, 476451125, -86400) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/optional/capi/typed_data_spec.rb b/spec/ruby/optional/capi/typed_data_spec.rb
index 8d2910457c..da56a050fd 100644
--- a/spec/ruby/optional/capi/typed_data_spec.rb
+++ b/spec/ruby/optional/capi/typed_data_spec.rb
@@ -30,7 +30,7 @@ describe "CApiWrappedTypedStruct" do
it "throws an exception for a wrong type" do
a = @s.typed_wrap_struct(1024)
- lambda { @s.typed_get_struct_other(a) }.should raise_error(TypeError)
+ -> { @s.typed_get_struct_other(a) }.should raise_error(TypeError)
end
it "unwraps data for a parent type" do
diff --git a/spec/ruby/optional/capi/util_spec.rb b/spec/ruby/optional/capi/util_spec.rb
index 5f8f9c6e3b..cd6c1105e2 100644
--- a/spec/ruby/optional/capi/util_spec.rb
+++ b/spec/ruby/optional/capi/util_spec.rb
@@ -9,7 +9,7 @@ describe "C-API Util function" do
describe "rb_scan_args" do
before :each do
- @prc = lambda { 1 }
+ @prc = -> { 1 }
@acc = []
ScratchPad.record @acc
end
@@ -20,11 +20,11 @@ describe "C-API Util function" do
end
it "raises an ArgumentError if there are insufficient arguments" do
- lambda { @o.rb_scan_args([1, 2], "3", 0, @acc) }.should raise_error(ArgumentError)
+ -> { @o.rb_scan_args([1, 2], "3", 0, @acc) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if there are too many arguments" do
- lambda { @o.rb_scan_args([1, 2, 3, 4], "3", 0, @acc) }.should raise_error(ArgumentError)
+ -> { @o.rb_scan_args([1, 2, 3, 4], "3", 0, @acc) }.should raise_error(ArgumentError)
end
it "assigns the required and optional arguments scanned" do
@@ -133,7 +133,7 @@ describe "C-API Util function" do
# r43934
it "rejects non-keyword arguments" do
h = {1 => 2, 3 => 4}
- lambda {
+ -> {
@o.rb_scan_args([h], "0:", 1, @acc)
}.should raise_error(ArgumentError)
ScratchPad.recorded.should == []
@@ -141,7 +141,7 @@ describe "C-API Util function" do
it "rejects required and non-keyword arguments" do
h = {1 => 2, 3 => 4}
- lambda {
+ -> {
@o.rb_scan_args([1, h], "1:", 2, @acc)
}.should raise_error(ArgumentError)
ScratchPad.recorded.should == []
@@ -175,7 +175,7 @@ describe "C-API Util function" do
it "raises an error if a required argument is not in the hash" do
h = { :a => 7, :c => 12, :b => 5 }
- lambda { @o.rb_get_kwargs(h, [:b, :d], 2, 0) }.should raise_error(ArgumentError, /missing keyword: d/)
+ -> { @o.rb_get_kwargs(h, [:b, :d], 2, 0) }.should raise_error(ArgumentError, /missing keyword: d/)
h.should == {:a => 7, :c => 12}
end
@@ -187,7 +187,7 @@ describe "C-API Util function" do
it "raises an error if there are additional arguments and optional is positive" do
h = { :a => 7, :c => 12, :b => 5 }
- lambda { @o.rb_get_kwargs(h, [:b, :a], 2, 0) }.should raise_error(ArgumentError, /unknown keyword: c/)
+ -> { @o.rb_get_kwargs(h, [:b, :a], 2, 0) }.should raise_error(ArgumentError, /unknown keyword: c/)
h.should == {:c => 12}
end
@@ -201,7 +201,7 @@ describe "C-API Util function" do
platform_is wordsize: 64 do
describe "rb_long2int" do
it "raises a RangeError if the value is outside the range of a C int" do
- lambda { @o.rb_long2int(0xffff_ffff_ffff) }.should raise_error(RangeError)
+ -> { @o.rb_long2int(0xffff_ffff_ffff) }.should raise_error(RangeError)
end
end
diff --git a/spec/ruby/security/cve_2010_1330_spec.rb b/spec/ruby/security/cve_2010_1330_spec.rb
index 5593bc0845..fa4c756c6d 100644
--- a/spec/ruby/security/cve_2010_1330_spec.rb
+++ b/spec/ruby/security/cve_2010_1330_spec.rb
@@ -13,7 +13,7 @@ describe "String#gsub" do
str.force_encoding Encoding::BINARY
str.gsub(/</, "&lt;").should == "\xF6&lt;script>".b
str.force_encoding Encoding::UTF_8
- lambda {
+ -> {
str.gsub(/</, "&lt;")
}.should raise_error(ArgumentError, /invalid byte sequence in UTF-8/)
end
diff --git a/spec/ruby/security/cve_2014_8080_spec.rb b/spec/ruby/security/cve_2014_8080_spec.rb
index e9d7fd320c..64e22cf3a7 100644
--- a/spec/ruby/security/cve_2014_8080_spec.rb
+++ b/spec/ruby/security/cve_2014_8080_spec.rb
@@ -24,7 +24,7 @@ describe "REXML::Document.new" do
</x>
XML
- lambda {
+ -> {
REXML::Document.new(xml).doctype.entities['x9'].value
}.should raise_error(REXML::ParseException, /entity expansion has grown too large/)
end
diff --git a/spec/ruby/security/cve_2018_8778_spec.rb b/spec/ruby/security/cve_2018_8778_spec.rb
index a264a8581e..628159a4db 100644
--- a/spec/ruby/security/cve_2018_8778_spec.rb
+++ b/spec/ruby/security/cve_2018_8778_spec.rb
@@ -4,7 +4,7 @@ describe "String#unpack" do
it "resists CVE-2018-8778 by raising an exception when a position indicator is larger than a native integer" do
pos = (1 << PlatformGuard::POINTER_SIZE) - 99
- lambda {
+ -> {
"0123456789".unpack("@#{pos}C10")
}.should raise_error(RangeError, /pack length too big/)
end
diff --git a/spec/ruby/security/cve_2018_8779_spec.rb b/spec/ruby/security/cve_2018_8779_spec.rb
index 9659b321ee..603dcf497b 100644
--- a/spec/ruby/security/cve_2018_8779_spec.rb
+++ b/spec/ruby/security/cve_2018_8779_spec.rb
@@ -16,13 +16,13 @@ platform_is_not :windows do
end
it "UNIXServer.open by raising an exception when there is a NUL byte" do
- lambda {
+ -> {
UNIXServer.open(@path+"\0")
}.should raise_error(ArgumentError, /(path name|string) contains null byte/)
end
it "UNIXSocket.open by raising an exception when there is a NUL byte" do
- lambda {
+ -> {
UNIXSocket.open(@path+"\0")
}.should raise_error(ArgumentError, /(path name|string) contains null byte/)
end
diff --git a/spec/ruby/security/cve_2018_8780_spec.rb b/spec/ruby/security/cve_2018_8780_spec.rb
index d9c02fbbd1..555ce9365c 100644
--- a/spec/ruby/security/cve_2018_8780_spec.rb
+++ b/spec/ruby/security/cve_2018_8780_spec.rb
@@ -6,38 +6,38 @@ describe "CVE-2018-8780 is resisted by" do
end
it "Dir.glob by raising an exception when there is a NUL byte" do
- lambda {
+ -> {
Dir.glob([[@root, File.join(@root, "*")].join("\0")])
}.should raise_error(ArgumentError, /(path name|string) contains null byte/)
end
it "Dir.entries by raising an exception when there is a NUL byte" do
- lambda {
+ -> {
Dir.entries(@root+"\0")
}.should raise_error(ArgumentError, /(path name|string) contains null byte/)
end
it "Dir.foreach by raising an exception when there is a NUL byte" do
- lambda {
+ -> {
Dir.foreach(@root+"\0").to_a
}.should raise_error(ArgumentError, /(path name|string) contains null byte/)
end
it "Dir.empty? by raising an exception when there is a NUL byte" do
- lambda {
+ -> {
Dir.empty?(@root+"\0")
}.should raise_error(ArgumentError, /(path name|string) contains null byte/)
end
ruby_version_is "2.5" do
it "Dir.children by raising an exception when there is a NUL byte" do
- lambda {
+ -> {
Dir.children(@root+"\0")
}.should raise_error(ArgumentError, /(path name|string) contains null byte/)
end
it "Dir.each_child by raising an exception when there is a NUL byte" do
- lambda {
+ -> {
Dir.each_child(@root+"\0").to_a
}.should raise_error(ArgumentError, /(path name|string) contains null byte/)
end
diff --git a/spec/ruby/shared/basicobject/method_missing.rb b/spec/ruby/shared/basicobject/method_missing.rb
index 0759dd9606..4871603dce 100644
--- a/spec/ruby/shared/basicobject/method_missing.rb
+++ b/spec/ruby/shared/basicobject/method_missing.rb
@@ -24,15 +24,15 @@ end
describe :method_missing_module, shared: true do
describe "for a Module" do
it "raises a NoMethodError when an undefined method is called" do
- lambda { @object.no_such_method }.should raise_error(NoMethodError)
+ -> { @object.no_such_method }.should raise_error(NoMethodError)
end
it "raises a NoMethodError when a protected method is called" do
- lambda { @object.method_protected }.should raise_error(NoMethodError)
+ -> { @object.method_protected }.should raise_error(NoMethodError)
end
it "raises a NoMethodError when a private method is called" do
- lambda { @object.method_private }.should raise_error(NoMethodError)
+ -> { @object.method_private }.should raise_error(NoMethodError)
end
end
end
@@ -60,15 +60,15 @@ end
describe :method_missing_class, shared: true do
describe "for a Class" do
it "raises a NoMethodError when an undefined method is called" do
- lambda { @object.no_such_method }.should raise_error(NoMethodError)
+ -> { @object.no_such_method }.should raise_error(NoMethodError)
end
it "raises a NoMethodError when a protected method is called" do
- lambda { @object.method_protected }.should raise_error(NoMethodError)
+ -> { @object.method_protected }.should raise_error(NoMethodError)
end
it "raises a NoMethodError when a private method is called" do
- lambda { @object.method_private }.should raise_error(NoMethodError)
+ -> { @object.method_private }.should raise_error(NoMethodError)
end
end
end
@@ -100,15 +100,15 @@ end
describe :method_missing_instance, shared: true do
describe "for an instance" do
it "raises a NoMethodError when an undefined method is called" do
- lambda { @object.new.no_such_method }.should raise_error(NoMethodError)
+ -> { @object.new.no_such_method }.should raise_error(NoMethodError)
end
it "raises a NoMethodError when a protected method is called" do
- lambda { @object.new.method_protected }.should raise_error(NoMethodError)
+ -> { @object.new.method_protected }.should raise_error(NoMethodError)
end
it "raises a NoMethodError when a private method is called" do
- lambda { @object.new.method_private }.should raise_error(NoMethodError)
+ -> { @object.new.method_private }.should raise_error(NoMethodError)
end
it 'sets the receiver of the raised NoMethodError' do
diff --git a/spec/ruby/shared/basicobject/send.rb b/spec/ruby/shared/basicobject/send.rb
index f96a3593bd..625aaa2917 100644
--- a/spec/ruby/shared/basicobject/send.rb
+++ b/spec/ruby/shared/basicobject/send.rb
@@ -42,7 +42,7 @@ describe :basicobject_send, shared: true do
'done'
end
end
- lambda { SendSpecs::Foo.new.send(@method, :syegsywhwua) }.should raise_error(NameError)
+ -> { SendSpecs::Foo.new.send(@method, :syegsywhwua) }.should raise_error(NameError)
end
it "raises a NameError if the corresponding singleton method can't be found" do
@@ -51,12 +51,12 @@ describe :basicobject_send, shared: true do
'done'
end
end
- lambda { SendSpecs::Foo.send(@method, :baz) }.should raise_error(NameError)
+ -> { SendSpecs::Foo.send(@method, :baz) }.should raise_error(NameError)
end
it "raises an ArgumentError if no arguments are given" do
class SendSpecs::Foo; end
- lambda { SendSpecs::Foo.new.send @method }.should raise_error(ArgumentError)
+ -> { SendSpecs::Foo.new.send @method }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if called with more arguments than available parameters" do
@@ -64,7 +64,7 @@ describe :basicobject_send, shared: true do
def bar; end
end
- lambda { SendSpecs::Foo.new.send(@method, :bar, :arg) }.should raise_error(ArgumentError)
+ -> { SendSpecs::Foo.new.send(@method, :bar, :arg) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if called with fewer arguments than required parameters" do
@@ -72,7 +72,7 @@ describe :basicobject_send, shared: true do
def foo(arg); end
end
- lambda { SendSpecs::Foo.new.send(@method, :foo) }.should raise_error(ArgumentError)
+ -> { SendSpecs::Foo.new.send(@method, :foo) }.should raise_error(ArgumentError)
end
it "succeeds if passed an arbitrary number of arguments as a splat parameter" do
diff --git a/spec/ruby/shared/fiber/resume.rb b/spec/ruby/shared/fiber/resume.rb
index e2d30d781b..d3dc438ae2 100644
--- a/spec/ruby/shared/fiber/resume.rb
+++ b/spec/ruby/shared/fiber/resume.rb
@@ -50,7 +50,7 @@ describe :fiber_resume, shared: true do
it "accepts any number of arguments" do
fiber = Fiber.new { |a| }
- lambda { fiber.send(@method, *(1..10).to_a) }.should_not raise_error
+ -> { fiber.send(@method, *(1..10).to_a) }.should_not raise_error
end
it "sets the block parameters to its arguments on the first invocation" do
@@ -64,16 +64,16 @@ describe :fiber_resume, shared: true do
it "raises a FiberError if the Fiber is dead" do
fiber = Fiber.new { true }
fiber.send(@method)
- lambda { fiber.send(@method) }.should raise_error(FiberError)
+ -> { fiber.send(@method) }.should raise_error(FiberError)
end
it "raises a LocalJumpError if the block includes a return statement" do
fiber = Fiber.new { return; }
- lambda { fiber.send(@method) }.should raise_error(LocalJumpError)
+ -> { fiber.send(@method) }.should raise_error(LocalJumpError)
end
it "raises a LocalJumpError if the block includes a break statement" do
fiber = Fiber.new { break; }
- lambda { fiber.send(@method) }.should raise_error(LocalJumpError)
+ -> { fiber.send(@method) }.should raise_error(LocalJumpError)
end
end
diff --git a/spec/ruby/shared/file/directory.rb b/spec/ruby/shared/file/directory.rb
index 67e939bf16..8ba933a601 100644
--- a/spec/ruby/shared/file/directory.rb
+++ b/spec/ruby/shared/file/directory.rb
@@ -24,12 +24,12 @@ describe :file_directory, shared: true do
end
it "raises a TypeError when passed an Integer" do
- lambda { @object.send(@method, 1) }.should raise_error(TypeError)
- lambda { @object.send(@method, bignum_value) }.should raise_error(TypeError)
+ -> { @object.send(@method, 1) }.should raise_error(TypeError)
+ -> { @object.send(@method, bignum_value) }.should raise_error(TypeError)
end
it "raises a TypeError when passed nil" do
- lambda { @object.send(@method, nil) }.should raise_error(TypeError)
+ -> { @object.send(@method, nil) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/shared/file/executable.rb b/spec/ruby/shared/file/executable.rb
index 5b21fb0d97..2987d0aabb 100644
--- a/spec/ruby/shared/file/executable.rb
+++ b/spec/ruby/shared/file/executable.rb
@@ -31,13 +31,13 @@ describe :file_executable, shared: true do
end
it "raises an ArgumentError if not passed one argument" do
- lambda { @object.send(@method) }.should raise_error(ArgumentError)
+ -> { @object.send(@method) }.should raise_error(ArgumentError)
end
it "raises a TypeError if not passed a String type" do
- lambda { @object.send(@method, 1) }.should raise_error(TypeError)
- lambda { @object.send(@method, nil) }.should raise_error(TypeError)
- lambda { @object.send(@method, false) }.should raise_error(TypeError)
+ -> { @object.send(@method, 1) }.should raise_error(TypeError)
+ -> { @object.send(@method, nil) }.should raise_error(TypeError)
+ -> { @object.send(@method, false) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/shared/file/executable_real.rb b/spec/ruby/shared/file/executable_real.rb
index 2b1bf8f585..ce3d5ca176 100644
--- a/spec/ruby/shared/file/executable_real.rb
+++ b/spec/ruby/shared/file/executable_real.rb
@@ -29,13 +29,13 @@ describe :file_executable_real, shared: true do
end
it "raises an ArgumentError if not passed one argument" do
- lambda { @object.send(@method) }.should raise_error(ArgumentError)
+ -> { @object.send(@method) }.should raise_error(ArgumentError)
end
it "raises a TypeError if not passed a String type" do
- lambda { @object.send(@method, 1) }.should raise_error(TypeError)
- lambda { @object.send(@method, nil) }.should raise_error(TypeError)
- lambda { @object.send(@method, false) }.should raise_error(TypeError)
+ -> { @object.send(@method, 1) }.should raise_error(TypeError)
+ -> { @object.send(@method, nil) }.should raise_error(TypeError)
+ -> { @object.send(@method, false) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/shared/file/exist.rb b/spec/ruby/shared/file/exist.rb
index 1557f01a82..3bd97711b4 100644
--- a/spec/ruby/shared/file/exist.rb
+++ b/spec/ruby/shared/file/exist.rb
@@ -10,12 +10,12 @@ describe :file_exist, shared: true do
end
it "raises an ArgumentError if not passed one argument" do
- lambda { @object.send(@method) }.should raise_error(ArgumentError)
- lambda { @object.send(@method, __FILE__, __FILE__) }.should raise_error(ArgumentError)
+ -> { @object.send(@method) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, __FILE__, __FILE__) }.should raise_error(ArgumentError)
end
it "raises a TypeError if not passed a String type" do
- lambda { @object.send(@method, nil) }.should raise_error(TypeError)
+ -> { @object.send(@method, nil) }.should raise_error(TypeError)
end
it "accepts an object that has a #to_path method" do
diff --git a/spec/ruby/shared/file/file.rb b/spec/ruby/shared/file/file.rb
index 095bd63fff..c1748a88b3 100644
--- a/spec/ruby/shared/file/file.rb
+++ b/spec/ruby/shared/file/file.rb
@@ -34,12 +34,12 @@ describe :file_file, shared: true do
end
it "raises an ArgumentError if not passed one argument" do
- lambda { @object.send(@method) }.should raise_error(ArgumentError)
- lambda { @object.send(@method, @null, @file) }.should raise_error(ArgumentError)
+ -> { @object.send(@method) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, @null, @file) }.should raise_error(ArgumentError)
end
it "raises a TypeError if not passed a String type" do
- lambda { @object.send(@method, nil) }.should raise_error(TypeError)
- lambda { @object.send(@method, 1) }.should raise_error(TypeError)
+ -> { @object.send(@method, nil) }.should raise_error(TypeError)
+ -> { @object.send(@method, 1) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/shared/file/identical.rb b/spec/ruby/shared/file/identical.rb
index e89cd309ea..ecc21727ca 100644
--- a/spec/ruby/shared/file/identical.rb
+++ b/spec/ruby/shared/file/identical.rb
@@ -31,12 +31,12 @@ describe :file_identical, shared: true do
end
it "raises an ArgumentError if not passed two arguments" do
- lambda { @object.send(@method, @file1, @file2, @link) }.should raise_error(ArgumentError)
- lambda { @object.send(@method, @file1) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, @file1, @file2, @link) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, @file1) }.should raise_error(ArgumentError)
end
it "raises a TypeError if not passed String types" do
- lambda { @object.send(@method, 1,1) }.should raise_error(TypeError)
+ -> { @object.send(@method, 1,1) }.should raise_error(TypeError)
end
it "returns true if both named files are identical" do
diff --git a/spec/ruby/shared/file/size.rb b/spec/ruby/shared/file/size.rb
index bb95190fc0..880dfbb612 100644
--- a/spec/ruby/shared/file/size.rb
+++ b/spec/ruby/shared/file/size.rb
@@ -56,7 +56,7 @@ describe :file_size_raise_when_missing, shared: true do
end
it "raises an error if file_name doesn't exist" do
- lambda {@object.send(@method, @missing)}.should raise_error(Errno::ENOENT)
+ -> {@object.send(@method, @missing)}.should raise_error(Errno::ENOENT)
end
end
diff --git a/spec/ruby/shared/file/writable_real.rb b/spec/ruby/shared/file/writable_real.rb
index 3730befb7a..e9721fd379 100644
--- a/spec/ruby/shared/file/writable_real.rb
+++ b/spec/ruby/shared/file/writable_real.rb
@@ -16,13 +16,13 @@ describe :file_writable_real, shared: true do
end
it "raises an ArgumentError if not passed one argument" do
- lambda { File.writable_real? }.should raise_error(ArgumentError)
+ -> { File.writable_real? }.should raise_error(ArgumentError)
end
it "raises a TypeError if not passed a String type" do
- lambda { @object.send(@method, 1) }.should raise_error(TypeError)
- lambda { @object.send(@method, nil) }.should raise_error(TypeError)
- lambda { @object.send(@method, false) }.should raise_error(TypeError)
+ -> { @object.send(@method, 1) }.should raise_error(TypeError)
+ -> { @object.send(@method, nil) }.should raise_error(TypeError)
+ -> { @object.send(@method, false) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/shared/file/zero.rb b/spec/ruby/shared/file/zero.rb
index cf014d4722..6a9399a021 100644
--- a/spec/ruby/shared/file/zero.rb
+++ b/spec/ruby/shared/file/zero.rb
@@ -40,13 +40,13 @@ describe :file_zero, shared: true do
end
it "raises an ArgumentError if not passed one argument" do
- lambda { File.zero? }.should raise_error(ArgumentError)
+ -> { File.zero? }.should raise_error(ArgumentError)
end
it "raises a TypeError if not passed a String type" do
- lambda { @object.send(@method, nil) }.should raise_error(TypeError)
- lambda { @object.send(@method, true) }.should raise_error(TypeError)
- lambda { @object.send(@method, false) }.should raise_error(TypeError)
+ -> { @object.send(@method, nil) }.should raise_error(TypeError)
+ -> { @object.send(@method, true) }.should raise_error(TypeError)
+ -> { @object.send(@method, false) }.should raise_error(TypeError)
end
it "returns true inside a block opening a file if it is empty" do
diff --git a/spec/ruby/shared/io/putc.rb b/spec/ruby/shared/io/putc.rb
index b71443e219..fac14886ee 100644
--- a/spec/ruby/shared/io/putc.rb
+++ b/spec/ruby/shared/io/putc.rb
@@ -40,18 +40,18 @@ describe :io_putc, shared: true do
it "raises IOError on a closed stream" do
@io.close
- lambda { @io_object.send(@method, "a") }.should raise_error(IOError)
+ -> { @io_object.send(@method, "a") }.should raise_error(IOError)
end
it "raises a TypeError when passed nil" do
- lambda { @io_object.send(@method, nil) }.should raise_error(TypeError)
+ -> { @io_object.send(@method, nil) }.should raise_error(TypeError)
end
it "raises a TypeError when passed false" do
- lambda { @io_object.send(@method, false) }.should raise_error(TypeError)
+ -> { @io_object.send(@method, false) }.should raise_error(TypeError)
end
it "raises a TypeError when passed true" do
- lambda { @io_object.send(@method, true) }.should raise_error(TypeError)
+ -> { @io_object.send(@method, true) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/shared/kernel/raise.rb b/spec/ruby/shared/kernel/raise.rb
index 7b9a29ca3f..d4553775f4 100644
--- a/spec/ruby/shared/kernel/raise.rb
+++ b/spec/ruby/shared/kernel/raise.rb
@@ -4,7 +4,7 @@ describe :kernel_raise, shared: true do
end
it "aborts execution" do
- lambda do
+ -> do
@object.raise Exception, "abort"
ScratchPad.record :no_abort
end.should raise_error(Exception, "abort")
@@ -13,36 +13,36 @@ describe :kernel_raise, shared: true do
end
it "raises RuntimeError if no exception class is given" do
- lambda { @object.raise }.should raise_error(RuntimeError, "")
+ -> { @object.raise }.should raise_error(RuntimeError, "")
end
it "raises a given Exception instance" do
error = RuntimeError.new
- lambda { @object.raise(error) }.should raise_error(error)
+ -> { @object.raise(error) }.should raise_error(error)
end
it "raises a RuntimeError if string given" do
- lambda { @object.raise("a bad thing") }.should raise_error(RuntimeError)
+ -> { @object.raise("a bad thing") }.should raise_error(RuntimeError)
end
it "raises a TypeError when passed a non-Exception object" do
- lambda { @object.raise(Object.new) }.should raise_error(TypeError)
+ -> { @object.raise(Object.new) }.should raise_error(TypeError)
end
it "raises a TypeError when passed true" do
- lambda { @object.raise(true) }.should raise_error(TypeError)
+ -> { @object.raise(true) }.should raise_error(TypeError)
end
it "raises a TypeError when passed false" do
- lambda { @object.raise(false) }.should raise_error(TypeError)
+ -> { @object.raise(false) }.should raise_error(TypeError)
end
it "raises a TypeError when passed nil" do
- lambda { @object.raise(nil) }.should raise_error(TypeError)
+ -> { @object.raise(nil) }.should raise_error(TypeError)
end
it "re-raises the previously rescued exception if no exception is specified" do
- lambda do
+ -> do
begin
@object.raise Exception, "outer"
ScratchPad.record :no_abort
@@ -78,7 +78,7 @@ describe :kernel_raise, shared: true do
end
it "allows Exception, message, and backtrace parameters" do
- lambda do
+ -> do
@object.raise(ArgumentError, "message", caller)
end.should raise_error(ArgumentError, "message")
end
diff --git a/spec/ruby/shared/math/atanh.rb b/spec/ruby/shared/math/atanh.rb
index 1d1a6ebd74..3fb64153a0 100644
--- a/spec/ruby/shared/math/atanh.rb
+++ b/spec/ruby/shared/math/atanh.rb
@@ -11,11 +11,11 @@ describe :math_atanh_base, shared: true do
end
it "raises a TypeError if the argument is nil" do
- lambda { @object.send(@method, nil) }.should raise_error(TypeError)
+ -> { @object.send(@method, nil) }.should raise_error(TypeError)
end
it "raises a TypeError if the argument is not a Numeric" do
- lambda { @object.send(@method, "test") }.should raise_error(TypeError)
+ -> { @object.send(@method, "test") }.should raise_error(TypeError)
end
it "returns Infinity if x == 1.0" do
@@ -35,10 +35,10 @@ end
describe :math_atanh_no_complex, shared: true do
it "raises a Math::DomainError for arguments greater than 1.0" do
- lambda { @object.send(@method, 1.0 + Float::EPSILON) }.should raise_error(Math::DomainError)
+ -> { @object.send(@method, 1.0 + Float::EPSILON) }.should raise_error(Math::DomainError)
end
it "raises a Math::DomainError for arguments less than -1.0" do
- lambda { @object.send(@method, -1.0 - Float::EPSILON) }.should raise_error(Math::DomainError)
+ -> { @object.send(@method, -1.0 - Float::EPSILON) }.should raise_error(Math::DomainError)
end
end
diff --git a/spec/ruby/shared/process/abort.rb b/spec/ruby/shared/process/abort.rb
index 1a25aeffc2..935637e1c2 100644
--- a/spec/ruby/shared/process/abort.rb
+++ b/spec/ruby/shared/process/abort.rb
@@ -8,29 +8,29 @@ describe :process_abort, shared: true do
end
it "raises a SystemExit exception" do
- lambda { @object.abort }.should raise_error(SystemExit)
+ -> { @object.abort }.should raise_error(SystemExit)
end
it "sets the exception message to the given message" do
- lambda { @object.abort "message" }.should raise_error { |e| e.message.should == "message" }
+ -> { @object.abort "message" }.should raise_error { |e| e.message.should == "message" }
end
it "sets the exception status code of 1" do
- lambda { @object.abort }.should raise_error { |e| e.status.should == 1 }
+ -> { @object.abort }.should raise_error { |e| e.status.should == 1 }
end
it "prints the specified message to STDERR" do
- lambda { @object.abort "a message" }.should raise_error(SystemExit)
+ -> { @object.abort "a message" }.should raise_error(SystemExit)
$stderr.should =~ /a message/
end
it "coerces the argument with #to_str" do
str = mock('to_str')
str.should_receive(:to_str).any_number_of_times.and_return("message")
- lambda { @object.abort str }.should raise_error(SystemExit, "message")
+ -> { @object.abort str }.should raise_error(SystemExit, "message")
end
it "raises TypeError when given a non-String object" do
- lambda { @object.abort 123 }.should raise_error(TypeError)
+ -> { @object.abort 123 }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/shared/process/exit.rb b/spec/ruby/shared/process/exit.rb
index 7d567c8195..1820dd17fd 100644
--- a/spec/ruby/shared/process/exit.rb
+++ b/spec/ruby/shared/process/exit.rb
@@ -1,13 +1,13 @@
describe :process_exit, shared: true do
it "raises a SystemExit with status 0" do
- lambda { @object.exit }.should raise_error(SystemExit) { |e|
+ -> { @object.exit }.should raise_error(SystemExit) { |e|
e.status.should == 0
}
end
it "raises a SystemExit with the specified status" do
[-2**16, -2**8, -8, -1, 0, 1 , 8, 2**8, 2**16].each do |value|
- lambda { @object.exit(value) }.should raise_error(SystemExit) { |e|
+ -> { @object.exit(value) }.should raise_error(SystemExit) { |e|
e.status.should == value
}
end
@@ -15,7 +15,7 @@ describe :process_exit, shared: true do
it "raises a SystemExit with the specified boolean status" do
{ true => 0, false => 1 }.each do |value, status|
- lambda { @object.exit(value) }.should raise_error(SystemExit) { |e|
+ -> { @object.exit(value) }.should raise_error(SystemExit) { |e|
e.status.should == status
}
end
@@ -24,24 +24,24 @@ describe :process_exit, shared: true do
it "tries to convert the passed argument to an Integer using #to_int" do
obj = mock('5')
obj.should_receive(:to_int).and_return(5)
- lambda { @object.exit(obj) }.should raise_error(SystemExit) { |e|
+ -> { @object.exit(obj) }.should raise_error(SystemExit) { |e|
e.status.should == 5
}
end
it "converts the passed Float argument to an Integer" do
{ -2.2 => -2, -0.1 => 0, 5.5 => 5, 827.999 => 827 }.each do |value, status|
- lambda { @object.exit(value) }.should raise_error(SystemExit) { |e|
+ -> { @object.exit(value) }.should raise_error(SystemExit) { |e|
e.status.should == status
}
end
end
it "raises TypeError if can't convert the argument to an Integer" do
- lambda { @object.exit(Object.new) }.should raise_error(TypeError)
- lambda { @object.exit('0') }.should raise_error(TypeError)
- lambda { @object.exit([0]) }.should raise_error(TypeError)
- lambda { @object.exit(nil) }.should raise_error(TypeError)
+ -> { @object.exit(Object.new) }.should raise_error(TypeError)
+ -> { @object.exit('0') }.should raise_error(TypeError)
+ -> { @object.exit([0]) }.should raise_error(TypeError)
+ -> { @object.exit(nil) }.should raise_error(TypeError)
end
it "raises the SystemExit in the main thread if it reaches the top-level handler of another thread" do
@@ -69,7 +69,7 @@ describe :process_exit, shared: true do
ScratchPad.recorded.should == [:in_thread, :in_main]
# the thread also keeps the exception as its value
- lambda { t.value }.should raise_error(SystemExit)
+ -> { t.value }.should raise_error(SystemExit)
end
end
diff --git a/spec/ruby/shared/process/fork.rb b/spec/ruby/shared/process/fork.rb
index c2c2aee9bf..cb863b42d8 100644
--- a/spec/ruby/shared/process/fork.rb
+++ b/spec/ruby/shared/process/fork.rb
@@ -8,7 +8,7 @@ describe :process_fork, shared: true do
end
it "raises a NotImplementedError when called" do
- lambda { @object.fork }.should raise_error(NotImplementedError)
+ -> { @object.fork }.should raise_error(NotImplementedError)
end
end
diff --git a/spec/ruby/shared/queue/deque.rb b/spec/ruby/shared/queue/deque.rb
index 3590f367ba..8b755dd9b7 100644
--- a/spec/ruby/shared/queue/deque.rb
+++ b/spec/ruby/shared/queue/deque.rb
@@ -66,7 +66,7 @@ describe :queue_deq, shared: true do
it "raises a ThreadError if the queue is empty" do
q = @object.call
- lambda { q.send(@method, true) }.should raise_error(ThreadError)
+ -> { q.send(@method, true) }.should raise_error(ThreadError)
end
it "removes an item from a closed queue" do
@@ -79,7 +79,7 @@ describe :queue_deq, shared: true do
it "raises a ThreadError for a closed empty queue" do
q = @object.call
q.close
- lambda { q.send(@method, true) }.should raise_error(ThreadError)
+ -> { q.send(@method, true) }.should raise_error(ThreadError)
end
end
end
diff --git a/spec/ruby/shared/queue/enque.rb b/spec/ruby/shared/queue/enque.rb
index ad413e1f46..8aba02e544 100644
--- a/spec/ruby/shared/queue/enque.rb
+++ b/spec/ruby/shared/queue/enque.rb
@@ -11,7 +11,7 @@ describe :queue_enq, shared: true do
it "is an error for a closed queue" do
q = @object.call
q.close
- lambda {
+ -> {
q.send @method, Object.new
}.should raise_error(ClosedQueueError)
end
diff --git a/spec/ruby/shared/rational/Rational.rb b/spec/ruby/shared/rational/Rational.rb
index 3952f663c6..2c36243dc3 100644
--- a/spec/ruby/shared/rational/Rational.rb
+++ b/spec/ruby/shared/rational/Rational.rb
@@ -80,24 +80,24 @@ describe :kernel_Rational, shared: true do
end
it "raises a RangeError if the imaginary part is not 0" do
- lambda { Rational(Complex(1, 2)) }.should raise_error(RangeError)
+ -> { Rational(Complex(1, 2)) }.should raise_error(RangeError)
end
end
it "raises a TypeError if the first argument is nil" do
- lambda { Rational(nil) }.should raise_error(TypeError)
+ -> { Rational(nil) }.should raise_error(TypeError)
end
it "raises a TypeError if the second argument is nil" do
- lambda { Rational(1, nil) }.should raise_error(TypeError)
+ -> { Rational(1, nil) }.should raise_error(TypeError)
end
it "raises a TypeError if the first argument is a Symbol" do
- lambda { Rational(:sym) }.should raise_error(TypeError)
+ -> { Rational(:sym) }.should raise_error(TypeError)
end
it "raises a TypeError if the second argument is a Symbol" do
- lambda { Rational(1, :sym) }.should raise_error(TypeError)
+ -> { Rational(1, :sym) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/shared/rational/coerce.rb b/spec/ruby/shared/rational/coerce.rb
index 0d6c440993..ffb118e2a7 100644
--- a/spec/ruby/shared/rational/coerce.rb
+++ b/spec/ruby/shared/rational/coerce.rb
@@ -1,5 +1,7 @@
require_relative '../../spec_helper'
+require 'bigdecimal'
+
describe :rational_coerce, shared: true do
it "returns the passed argument, self as Float, when given a Float" do
result = Rational(3, 4).coerce(1.0)
@@ -18,4 +20,10 @@ describe :rational_coerce, shared: true do
it "returns [argument, self] when given a Rational" do
Rational(3, 7).coerce(Rational(9, 2)).should == [Rational(9, 2), Rational(3, 7)]
end
+
+ it "raises an error when passed a BigDecimal" do
+ -> {
+ Rational(500, 3).coerce(BigDecimal('166.666666666'))
+ }.should raise_error(TypeError, /BigDecimal can't be coerced into Rational/)
+ end
end
diff --git a/spec/ruby/shared/rational/div.rb b/spec/ruby/shared/rational/div.rb
index 2bf9b80eb5..d5bd9e6644 100644
--- a/spec/ruby/shared/rational/div.rb
+++ b/spec/ruby/shared/rational/div.rb
@@ -7,11 +7,11 @@ describe :rational_div_rat, shared: true do
end
it "raises a ZeroDivisionError when the argument has a numerator of 0" do
- lambda { Rational(3, 4).div(Rational(0, 3)) }.should raise_error(ZeroDivisionError)
+ -> { Rational(3, 4).div(Rational(0, 3)) }.should raise_error(ZeroDivisionError)
end
it "raises a ZeroDivisionError when the argument has a numerator of 0.0" do
- lambda { Rational(3, 4).div(Rational(0.0, 3)) }.should raise_error(ZeroDivisionError)
+ -> { Rational(3, 4).div(Rational(0.0, 3)) }.should raise_error(ZeroDivisionError)
end
end
@@ -23,7 +23,7 @@ describe :rational_div_float, shared: true do
end
it "raises a ZeroDivisionError when the argument is 0.0" do
- lambda { Rational(3, 4).div(0.0) }.should raise_error(ZeroDivisionError)
+ -> { Rational(3, 4).div(0.0) }.should raise_error(ZeroDivisionError)
end
end
@@ -34,7 +34,7 @@ describe :rational_div_int, shared: true do
end
it "raises a ZeroDivisionError when the argument is 0" do
- lambda { Rational(3, 4).div(0) }.should raise_error(ZeroDivisionError)
+ -> { Rational(3, 4).div(0) }.should raise_error(ZeroDivisionError)
end
end
@@ -44,11 +44,11 @@ describe :rational_div, shared: true do
end
it "raises an ArgumentError if passed more than one argument" do
- lambda { Rational(3, 4).div(2,3) }.should raise_error(ArgumentError)
+ -> { Rational(3, 4).div(2,3) }.should raise_error(ArgumentError)
end
# See http://redmine.ruby-lang.org/issues/show/1648
it "raises a TypeError if passed a non-numeric argument" do
- lambda { Rational(3, 4).div([]) }.should raise_error(TypeError)
+ -> { Rational(3, 4).div([]) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/shared/rational/divide.rb b/spec/ruby/shared/rational/divide.rb
index 86d30c39d8..7d6d66390f 100644
--- a/spec/ruby/shared/rational/divide.rb
+++ b/spec/ruby/shared/rational/divide.rb
@@ -10,7 +10,7 @@ describe :rational_divide_rat, shared: true do
end
it "raises a ZeroDivisionError when passed a Rational with a numerator of 0" do
- lambda { Rational(3, 4).send(@method, Rational(0, 1)) }.should raise_error(ZeroDivisionError)
+ -> { Rational(3, 4).send(@method, Rational(0, 1)) }.should raise_error(ZeroDivisionError)
end
end
@@ -22,7 +22,7 @@ describe :rational_divide_int, shared: true do
end
it "raises a ZeroDivisionError when passed 0" do
- lambda { Rational(3, 4).send(@method, 0) }.should raise_error(ZeroDivisionError)
+ -> { Rational(3, 4).send(@method, 0) }.should raise_error(ZeroDivisionError)
end
end
diff --git a/spec/ruby/shared/rational/divmod.rb b/spec/ruby/shared/rational/divmod.rb
index 9433674007..5b319a95ff 100644
--- a/spec/ruby/shared/rational/divmod.rb
+++ b/spec/ruby/shared/rational/divmod.rb
@@ -10,7 +10,7 @@ describe :rational_divmod_rat, shared: true do
end
it "raises a ZeroDivisonError when passed a Rational with a numerator of 0" do
- lambda { Rational(7, 4).divmod(Rational(0, 3)) }.should raise_error(ZeroDivisionError)
+ -> { Rational(7, 4).divmod(Rational(0, 3)) }.should raise_error(ZeroDivisionError)
end
end
@@ -23,7 +23,7 @@ describe :rational_divmod_int, shared: true do
end
it "raises a ZeroDivisionError when passed 0" do
- lambda { Rational(7, 4).divmod(0) }.should raise_error(ZeroDivisionError)
+ -> { Rational(7, 4).divmod(0) }.should raise_error(ZeroDivisionError)
end
end
@@ -37,6 +37,6 @@ describe :rational_divmod_float, shared: true do
end
it "raises a ZeroDivisionError when passed 0" do
- lambda { Rational(7, 4).divmod(0.0) }.should raise_error(ZeroDivisionError)
+ -> { Rational(7, 4).divmod(0.0) }.should raise_error(ZeroDivisionError)
end
end
diff --git a/spec/ruby/shared/rational/exponent.rb b/spec/ruby/shared/rational/exponent.rb
index ac8237c291..1d808177e9 100644
--- a/spec/ruby/shared/rational/exponent.rb
+++ b/spec/ruby/shared/rational/exponent.rb
@@ -66,7 +66,7 @@ describe :rational_exponent, shared: true do
end
it "raises ZeroDivisionError when self is Rational(0) and the exponent is negative" do
- lambda { Rational(0) ** -bignum_value }.should raise_error(ZeroDivisionError)
+ -> { Rational(0) ** -bignum_value }.should raise_error(ZeroDivisionError)
end
it "returns Rational(1) when self is Rational(1)" do
@@ -153,19 +153,19 @@ describe :rational_exponent, shared: true do
it "raises ZeroDivisionError for Rational(0, 1) passed a negative Integer" do
[-1, -4, -9999].each do |exponent|
- lambda { Rational(0, 1) ** exponent }.should raise_error(ZeroDivisionError, "divided by 0")
+ -> { Rational(0, 1) ** exponent }.should raise_error(ZeroDivisionError, "divided by 0")
end
end
it "raises ZeroDivisionError for Rational(0, 1) passed a negative Rational with denominator 1" do
[Rational(-1, 1), Rational(-3, 1)].each do |exponent|
- lambda { Rational(0, 1) ** exponent }.should raise_error(ZeroDivisionError, "divided by 0")
+ -> { Rational(0, 1) ** exponent }.should raise_error(ZeroDivisionError, "divided by 0")
end
end
# #7513
it "raises ZeroDivisionError for Rational(0, 1) passed a negative Rational" do
- lambda { Rational(0, 1) ** Rational(-3, 2) }.should raise_error(ZeroDivisionError, "divided by 0")
+ -> { Rational(0, 1) ** Rational(-3, 2) }.should raise_error(ZeroDivisionError, "divided by 0")
end
platform_is_not :solaris do # See https://github.com/ruby/spec/issues/134
diff --git a/spec/ruby/shared/rational/modulo.rb b/spec/ruby/shared/rational/modulo.rb
index 39abaed5fe..9e4b0c49e6 100644
--- a/spec/ruby/shared/rational/modulo.rb
+++ b/spec/ruby/shared/rational/modulo.rb
@@ -22,21 +22,21 @@ describe :rational_modulo, shared: true do
end
it "raises ZeroDivisionError on zero denominator" do
- lambda {
+ -> {
Rational(3, 5).send(@method, Rational(0, 1))
}.should raise_error(ZeroDivisionError)
- lambda {
+ -> {
Rational(0, 1).send(@method, Rational(0, 1))
}.should raise_error(ZeroDivisionError)
- lambda {
+ -> {
Rational(3, 5).send(@method, 0)
}.should raise_error(ZeroDivisionError)
end
it "raises a ZeroDivisionError when the argument is 0.0" do
- lambda {
+ -> {
Rational(3, 5).send(@method, 0.0)
}.should raise_error(ZeroDivisionError)
end
diff --git a/spec/ruby/shared/rational/round.rb b/spec/ruby/shared/rational/round.rb
index e99f884cea..5b159ee3e6 100644
--- a/spec/ruby/shared/rational/round.rb
+++ b/spec/ruby/shared/rational/round.rb
@@ -100,7 +100,7 @@ describe :rational_round, shared: true do
end
it "raise for a non-existent round mode" do
- lambda { Rational(10, 4).round(half: :nonsense) }.should raise_error(ArgumentError, "invalid rounding mode: nonsense")
+ -> { Rational(10, 4).round(half: :nonsense) }.should raise_error(ArgumentError, "invalid rounding mode: nonsense")
end
end
end
diff --git a/spec/ruby/shared/sizedqueue/enque.rb b/spec/ruby/shared/sizedqueue/enque.rb
index b724101269..6ef12349f8 100644
--- a/spec/ruby/shared/sizedqueue/enque.rb
+++ b/spec/ruby/shared/sizedqueue/enque.rb
@@ -22,7 +22,7 @@ describe :sizedqueue_enq, shared: true do
q = @object.call(2)
non_blocking = true
- add_to_queue = lambda { q.send(@method, Object.new, non_blocking) }
+ add_to_queue = -> { q.send(@method, Object.new, non_blocking) }
q.size.should == 0
add_to_queue.call
@@ -37,7 +37,7 @@ describe :sizedqueue_enq, shared: true do
q << 1
t = Thread.new {
- lambda { q.send(@method, 2) }.should raise_error(ClosedQueueError)
+ -> { q.send(@method, 2) }.should raise_error(ClosedQueueError)
}
Thread.pass until q.num_waiting == 1
diff --git a/spec/ruby/shared/sizedqueue/max.rb b/spec/ruby/shared/sizedqueue/max.rb
index cd4b47f1c1..ea10d24be0 100644
--- a/spec/ruby/shared/sizedqueue/max.rb
+++ b/spec/ruby/shared/sizedqueue/max.rb
@@ -27,21 +27,21 @@ describe :sizedqueue_max=, shared: true do
it "raises a TypeError when given a non-numeric value" do
q = @object.call(5)
- lambda { q.max = "foo" }.should raise_error(TypeError)
- lambda { q.max = Object.new }.should raise_error(TypeError)
+ -> { q.max = "foo" }.should raise_error(TypeError)
+ -> { q.max = Object.new }.should raise_error(TypeError)
end
it "raises an argument error when set to zero" do
q = @object.call(5)
q.max.should == 5
- lambda { q.max = 0 }.should raise_error(ArgumentError)
+ -> { q.max = 0 }.should raise_error(ArgumentError)
q.max.should == 5
end
it "raises an argument error when set to a negative number" do
q = @object.call(5)
q.max.should == 5
- lambda { q.max = -1 }.should raise_error(ArgumentError)
+ -> { q.max = -1 }.should raise_error(ArgumentError)
q.max.should == 5
end
end
diff --git a/spec/ruby/shared/sizedqueue/new.rb b/spec/ruby/shared/sizedqueue/new.rb
index 4439f2a9c6..713785fb50 100644
--- a/spec/ruby/shared/sizedqueue/new.rb
+++ b/spec/ruby/shared/sizedqueue/new.rb
@@ -1,18 +1,18 @@
describe :sizedqueue_new, shared: true do
it "raises a TypeError when the given argument is not Numeric" do
- lambda { @object.call("foo") }.should raise_error(TypeError)
- lambda { @object.call(Object.new) }.should raise_error(TypeError)
+ -> { @object.call("foo") }.should raise_error(TypeError)
+ -> { @object.call(Object.new) }.should raise_error(TypeError)
end
it "raises an argument error when no argument is given" do
- lambda { @object.call }.should raise_error(ArgumentError)
+ -> { @object.call }.should raise_error(ArgumentError)
end
it "raises an argument error when the given argument is zero" do
- lambda { @object.call(0) }.should raise_error(ArgumentError)
+ -> { @object.call(0) }.should raise_error(ArgumentError)
end
it "raises an argument error when the given argument is negative" do
- lambda { @object.call(-1) }.should raise_error(ArgumentError)
+ -> { @object.call(-1) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/shared/string/times.rb b/spec/ruby/shared/string/times.rb
index e7b788d4f9..0baefd25b1 100644
--- a/spec/ruby/shared/string/times.rb
+++ b/spec/ruby/shared/string/times.rb
@@ -18,12 +18,12 @@ describe :string_times, shared: true do
end
it "raises an ArgumentError when given integer is negative" do
- lambda { @object.call("cool", -3) }.should raise_error(ArgumentError)
- lambda { @object.call("cool", -3.14) }.should raise_error(ArgumentError)
+ -> { @object.call("cool", -3) }.should raise_error(ArgumentError)
+ -> { @object.call("cool", -3.14) }.should raise_error(ArgumentError)
end
it "raises a RangeError when given integer is a Bignum" do
- lambda { @object.call("cool", 999999999999999999999) }.should raise_error(RangeError)
+ -> { @object.call("cool", 999999999999999999999) }.should raise_error(RangeError)
end
it "returns subclass instances" do
@@ -50,13 +50,13 @@ describe :string_times, shared: true do
platform_is wordsize: 32 do
it "raises an ArgumentError if the length of the resulting string doesn't fit into a long" do
- lambda { @object.call("abc", (2 ** 31) - 1) }.should raise_error(ArgumentError)
+ -> { @object.call("abc", (2 ** 31) - 1) }.should raise_error(ArgumentError)
end
end
platform_is wordsize: 64 do
it "raises an ArgumentError if the length of the resulting string doesn't fit into a long" do
- lambda { @object.call("abc", (2 ** 63) - 1) }.should raise_error(ArgumentError)
+ -> { @object.call("abc", (2 ** 63) - 1) }.should raise_error(ArgumentError)
end
end
end