From 45c2ee2b07d583c13695c4f98ac50ab71f456d56 Mon Sep 17 00:00:00 2001 From: Oscar Swanros Date: Thu, 26 Dec 2013 11:54:18 -0600 Subject: [PATCH 1/9] Stage 1 --- .path_progress | 2 +- about_blocks.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.path_progress b/.path_progress index 8d259c7..6ae9940 100644 --- a/.path_progress +++ b/.path_progress @@ -1 +1 @@ -1,2,2,3,1,1,1,2,3,4,4,4,4,6,7,0,1,2,2,2,2,3,3,4,4,4,5,6,6,6,6,7,7,8,9,10,11,11,12,13,13,0,1,2,3,3,4,5,6,6,7,8,9,10,10,10,10,11,11,11,11,1,2,3,3,3,4,4,4,5,6,7,8,8,9,9,10,11,12,13,13,13,14,15,16,17,18,18,19,20,20,21,21,22,22,22,22,23,24,24,25,25,26 \ No newline at end of file +1,2,2,3,1,1,1,2,3,4,4,4,4,6,7,0,1,2,2,2,2,3,3,4,4,4,5,6,6,6,6,7,7,8,9,10,11,11,12,13,13,0,1,2,3,3,4,5,6,6,7,8,9,10,10,10,10,11,11,11,11,1,2,3,3,3,4,4,4,5,6,7,8,8,9,9,10,11,12,13,13,13,14,15,16,17,18,18,19,20,20,21,21,22,22,22,22,23,24,24,25,25,26,1 \ No newline at end of file diff --git a/about_blocks.rb b/about_blocks.rb index c02dab9..ea00c0b 100644 --- a/about_blocks.rb +++ b/about_blocks.rb @@ -8,7 +8,7 @@ def method_with_block def test_methods_can_take_blocks yielded_result = method_with_block { 1 + 2 } - assert_equal __, yielded_result + assert_equal 3, yielded_result end def test_blocks_can_be_defined_with_do_end_too From 92ab6a94b156904906f0b596d547d8feff484bef Mon Sep 17 00:00:00 2001 From: Oscar Swanros Date: Thu, 26 Dec 2013 11:55:18 -0600 Subject: [PATCH 2/9] Stage 2 --- .path_progress | 2 +- about_blocks.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.path_progress b/.path_progress index 6ae9940..6eddc7d 100644 --- a/.path_progress +++ b/.path_progress @@ -1 +1 @@ -1,2,2,3,1,1,1,2,3,4,4,4,4,6,7,0,1,2,2,2,2,3,3,4,4,4,5,6,6,6,6,7,7,8,9,10,11,11,12,13,13,0,1,2,3,3,4,5,6,6,7,8,9,10,10,10,10,11,11,11,11,1,2,3,3,3,4,4,4,5,6,7,8,8,9,9,10,11,12,13,13,13,14,15,16,17,18,18,19,20,20,21,21,22,22,22,22,23,24,24,25,25,26,1 \ No newline at end of file +1,2,2,3,1,1,1,2,3,4,4,4,4,6,7,0,1,2,2,2,2,3,3,4,4,4,5,6,6,6,6,7,7,8,9,10,11,11,12,13,13,0,1,2,3,3,4,5,6,6,7,8,9,10,10,10,10,11,11,11,11,1,2,3,3,3,4,4,4,5,6,7,8,8,9,9,10,11,12,13,13,13,14,15,16,17,18,18,19,20,20,21,21,22,22,22,22,23,24,24,25,25,26,1,2 \ No newline at end of file diff --git a/about_blocks.rb b/about_blocks.rb index ea00c0b..6903281 100644 --- a/about_blocks.rb +++ b/about_blocks.rb @@ -13,7 +13,7 @@ def test_methods_can_take_blocks def test_blocks_can_be_defined_with_do_end_too yielded_result = method_with_block do 1 + 2 end - assert_equal __, yielded_result + assert_equal 3, yielded_result end # ------------------------------------------------------------------ From 60bb52686f2711ebdaf3b7e341648317b6bdd9f3 Mon Sep 17 00:00:00 2001 From: Oscar Swanros Date: Thu, 26 Dec 2013 11:55:59 -0600 Subject: [PATCH 3/9] Stage 3 --- .path_progress | 2 +- about_blocks.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.path_progress b/.path_progress index 6eddc7d..2c113a8 100644 --- a/.path_progress +++ b/.path_progress @@ -1 +1 @@ -1,2,2,3,1,1,1,2,3,4,4,4,4,6,7,0,1,2,2,2,2,3,3,4,4,4,5,6,6,6,6,7,7,8,9,10,11,11,12,13,13,0,1,2,3,3,4,5,6,6,7,8,9,10,10,10,10,11,11,11,11,1,2,3,3,3,4,4,4,5,6,7,8,8,9,9,10,11,12,13,13,13,14,15,16,17,18,18,19,20,20,21,21,22,22,22,22,23,24,24,25,25,26,1,2 \ No newline at end of file +1,2,2,3,1,1,1,2,3,4,4,4,4,6,7,0,1,2,2,2,2,3,3,4,4,4,5,6,6,6,6,7,7,8,9,10,11,11,12,13,13,0,1,2,3,3,4,5,6,6,7,8,9,10,10,10,10,11,11,11,11,1,2,3,3,3,4,4,4,5,6,7,8,8,9,9,10,11,12,13,13,13,14,15,16,17,18,18,19,20,20,21,21,22,22,22,22,23,24,24,25,25,26,1,2,3 \ No newline at end of file diff --git a/about_blocks.rb b/about_blocks.rb index 6903281..074f9a7 100644 --- a/about_blocks.rb +++ b/about_blocks.rb @@ -24,7 +24,7 @@ def method_with_block_arguments def test_blocks_can_take_arguments method_with_block_arguments do |argument| - assert_equal __, argument + assert_equal "Jim", argument end end From f0902388a1bd7554743af4679735630a452c1390 Mon Sep 17 00:00:00 2001 From: Oscar Swanros Date: Thu, 26 Dec 2013 11:56:45 -0600 Subject: [PATCH 4/9] Stage 4 --- .path_progress | 2 +- about_blocks.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.path_progress b/.path_progress index 2c113a8..3f06cc0 100644 --- a/.path_progress +++ b/.path_progress @@ -1 +1 @@ -1,2,2,3,1,1,1,2,3,4,4,4,4,6,7,0,1,2,2,2,2,3,3,4,4,4,5,6,6,6,6,7,7,8,9,10,11,11,12,13,13,0,1,2,3,3,4,5,6,6,7,8,9,10,10,10,10,11,11,11,11,1,2,3,3,3,4,4,4,5,6,7,8,8,9,9,10,11,12,13,13,13,14,15,16,17,18,18,19,20,20,21,21,22,22,22,22,23,24,24,25,25,26,1,2,3 \ No newline at end of file +1,2,2,3,1,1,1,2,3,4,4,4,4,6,7,0,1,2,2,2,2,3,3,4,4,4,5,6,6,6,6,7,7,8,9,10,11,11,12,13,13,0,1,2,3,3,4,5,6,6,7,8,9,10,10,10,10,11,11,11,11,1,2,3,3,3,4,4,4,5,6,7,8,8,9,9,10,11,12,13,13,13,14,15,16,17,18,18,19,20,20,21,21,22,22,22,22,23,24,24,25,25,26,1,2,3,4 \ No newline at end of file diff --git a/about_blocks.rb b/about_blocks.rb index 074f9a7..fa2ee54 100644 --- a/about_blocks.rb +++ b/about_blocks.rb @@ -40,7 +40,7 @@ def many_yields def test_methods_can_call_yield_many_times result = [] many_yields { |item| result << item } - assert_equal __, result + assert_equal [:peanut, :butter, :and, :jelly], result end # ------------------------------------------------------------------ From b1c98e81f18eaf72f4a7f00a4eb5dc1082f04670 Mon Sep 17 00:00:00 2001 From: Oscar Swanros Date: Thu, 26 Dec 2013 11:59:28 -0600 Subject: [PATCH 5/9] Stage 5 --- .path_progress | 2 +- about_blocks.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.path_progress b/.path_progress index 3f06cc0..a060947 100644 --- a/.path_progress +++ b/.path_progress @@ -1 +1 @@ -1,2,2,3,1,1,1,2,3,4,4,4,4,6,7,0,1,2,2,2,2,3,3,4,4,4,5,6,6,6,6,7,7,8,9,10,11,11,12,13,13,0,1,2,3,3,4,5,6,6,7,8,9,10,10,10,10,11,11,11,11,1,2,3,3,3,4,4,4,5,6,7,8,8,9,9,10,11,12,13,13,13,14,15,16,17,18,18,19,20,20,21,21,22,22,22,22,23,24,24,25,25,26,1,2,3,4 \ No newline at end of file +1,2,2,3,1,1,1,2,3,4,4,4,4,6,7,0,1,2,2,2,2,3,3,4,4,4,5,6,6,6,6,7,7,8,9,10,11,11,12,13,13,0,1,2,3,3,4,5,6,6,7,8,9,10,10,10,10,11,11,11,11,1,2,3,3,3,4,4,4,5,6,7,8,8,9,9,10,11,12,13,13,13,14,15,16,17,18,18,19,20,20,21,21,22,22,22,22,23,24,24,25,25,26,1,2,3,4,5 \ No newline at end of file diff --git a/about_blocks.rb b/about_blocks.rb index fa2ee54..1b3834b 100644 --- a/about_blocks.rb +++ b/about_blocks.rb @@ -54,8 +54,8 @@ def yield_tester end def test_methods_can_see_if_they_have_been_called_with_a_block - assert_equal __, yield_tester { :with_block } - assert_equal __, yield_tester + assert_equal :with_block, yield_tester { :with_block } + assert_equal :no_block, yield_tester end # ------------------------------------------------------------------ From 16750cb26381520b9be832eba280dc4cc8378628 Mon Sep 17 00:00:00 2001 From: Oscar Swanros Date: Thu, 26 Dec 2013 12:01:55 -0600 Subject: [PATCH 6/9] Stage 6 --- .path_progress | 2 +- about_blocks.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.path_progress b/.path_progress index a060947..e7081ae 100644 --- a/.path_progress +++ b/.path_progress @@ -1 +1 @@ -1,2,2,3,1,1,1,2,3,4,4,4,4,6,7,0,1,2,2,2,2,3,3,4,4,4,5,6,6,6,6,7,7,8,9,10,11,11,12,13,13,0,1,2,3,3,4,5,6,6,7,8,9,10,10,10,10,11,11,11,11,1,2,3,3,3,4,4,4,5,6,7,8,8,9,9,10,11,12,13,13,13,14,15,16,17,18,18,19,20,20,21,21,22,22,22,22,23,24,24,25,25,26,1,2,3,4,5 \ No newline at end of file +1,2,2,3,1,1,1,2,3,4,4,4,4,6,7,0,1,2,2,2,2,3,3,4,4,4,5,6,6,6,6,7,7,8,9,10,11,11,12,13,13,0,1,2,3,3,4,5,6,6,7,8,9,10,10,10,10,11,11,11,11,1,2,3,3,3,4,4,4,5,6,7,8,8,9,9,10,11,12,13,13,13,14,15,16,17,18,18,19,20,20,21,21,22,22,22,22,23,24,24,25,25,26,1,2,3,4,5,6 \ No newline at end of file diff --git a/about_blocks.rb b/about_blocks.rb index 1b3834b..05ce703 100644 --- a/about_blocks.rb +++ b/about_blocks.rb @@ -63,7 +63,7 @@ def test_methods_can_see_if_they_have_been_called_with_a_block def test_block_can_affect_variables_in_the_code_where_they_are_created value = :initial_value method_with_block { value = :modified_in_a_block } - assert_equal __, value + assert_equal :modified_in_a_block, value end def test_blocks_can_be_assigned_to_variables_and_called_explicitly From 4b82d96d122a9a1756e4224cd2bd8844d688d15b Mon Sep 17 00:00:00 2001 From: Oscar Swanros Date: Thu, 26 Dec 2013 12:08:06 -0600 Subject: [PATCH 7/9] Stage 7 --- .path_progress | 2 +- about_blocks.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.path_progress b/.path_progress index e7081ae..5cc85c2 100644 --- a/.path_progress +++ b/.path_progress @@ -1 +1 @@ -1,2,2,3,1,1,1,2,3,4,4,4,4,6,7,0,1,2,2,2,2,3,3,4,4,4,5,6,6,6,6,7,7,8,9,10,11,11,12,13,13,0,1,2,3,3,4,5,6,6,7,8,9,10,10,10,10,11,11,11,11,1,2,3,3,3,4,4,4,5,6,7,8,8,9,9,10,11,12,13,13,13,14,15,16,17,18,18,19,20,20,21,21,22,22,22,22,23,24,24,25,25,26,1,2,3,4,5,6 \ No newline at end of file +1,2,2,3,1,1,1,2,3,4,4,4,4,6,7,0,1,2,2,2,2,3,3,4,4,4,5,6,6,6,6,7,7,8,9,10,11,11,12,13,13,0,1,2,3,3,4,5,6,6,7,8,9,10,10,10,10,11,11,11,11,1,2,3,3,3,4,4,4,5,6,7,8,8,9,9,10,11,12,13,13,13,14,15,16,17,18,18,19,20,20,21,21,22,22,22,22,23,24,24,25,25,26,1,2,3,4,5,6,6,6,6,6,7 \ No newline at end of file diff --git a/about_blocks.rb b/about_blocks.rb index 05ce703..0b15d06 100644 --- a/about_blocks.rb +++ b/about_blocks.rb @@ -68,10 +68,10 @@ def test_block_can_affect_variables_in_the_code_where_they_are_created def test_blocks_can_be_assigned_to_variables_and_called_explicitly add_one = lambda { |n| n + 1 } - assert_equal __, add_one.call(10) + assert_equal 11, add_one.call(10) # Alternative calling syntax - assert_equal __, add_one[10] + assert_equal 11, add_one[10] end def test_stand_alone_blocks_can_be_passed_to_methods_expecting_blocks From 02bb6e65724e4c7daa2dcfcfb08f25c5837ecfd5 Mon Sep 17 00:00:00 2001 From: Oscar Swanros Date: Thu, 26 Dec 2013 12:10:44 -0600 Subject: [PATCH 8/9] Stage 8 --- .path_progress | 2 +- about_blocks.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.path_progress b/.path_progress index 5cc85c2..8dae378 100644 --- a/.path_progress +++ b/.path_progress @@ -1 +1 @@ -1,2,2,3,1,1,1,2,3,4,4,4,4,6,7,0,1,2,2,2,2,3,3,4,4,4,5,6,6,6,6,7,7,8,9,10,11,11,12,13,13,0,1,2,3,3,4,5,6,6,7,8,9,10,10,10,10,11,11,11,11,1,2,3,3,3,4,4,4,5,6,7,8,8,9,9,10,11,12,13,13,13,14,15,16,17,18,18,19,20,20,21,21,22,22,22,22,23,24,24,25,25,26,1,2,3,4,5,6,6,6,6,6,7 \ No newline at end of file +1,2,2,3,1,1,1,2,3,4,4,4,4,6,7,0,1,2,2,2,2,3,3,4,4,4,5,6,6,6,6,7,7,8,9,10,11,11,12,13,13,0,1,2,3,3,4,5,6,6,7,8,9,10,10,10,10,11,11,11,11,1,2,3,3,3,4,4,4,5,6,7,8,8,9,9,10,11,12,13,13,13,14,15,16,17,18,18,19,20,20,21,21,22,22,22,22,23,24,24,25,25,26,1,2,3,4,5,6,6,6,6,6,7,8 \ No newline at end of file diff --git a/about_blocks.rb b/about_blocks.rb index 0b15d06..4808936 100644 --- a/about_blocks.rb +++ b/about_blocks.rb @@ -77,7 +77,7 @@ def test_blocks_can_be_assigned_to_variables_and_called_explicitly def test_stand_alone_blocks_can_be_passed_to_methods_expecting_blocks make_upper = lambda { |n| n.upcase } result = method_with_block_arguments(&make_upper) - assert_equal __, result + assert_equal "JIM", result end # ------------------------------------------------------------------ From 5eaaa5e2e8401f032889cb7c38e70316b1aa0e9e Mon Sep 17 00:00:00 2001 From: Oscar Swanros Date: Thu, 26 Dec 2013 12:11:43 -0600 Subject: [PATCH 9/9] Stage 9 --- about_blocks.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/about_blocks.rb b/about_blocks.rb index 4808936..79ab9f6 100644 --- a/about_blocks.rb +++ b/about_blocks.rb @@ -87,10 +87,10 @@ def method_with_explicit_block(&block) end def test_methods_can_take_an_explicit_block_argument - assert_equal __, method_with_explicit_block { |n| n * 2 } + assert_equal 20, method_with_explicit_block { |n| n * 2 } add_one = lambda { |n| n + 1 } - assert_equal __, method_with_explicit_block(&add_one) + assert_equal 11, method_with_explicit_block(&add_one) end end