diff --git a/.github/workflows/exercise-tests.yml b/.github/workflows/exercise-tests.yml index 33df406432..8ed279c0f3 100644 --- a/.github/workflows/exercise-tests.yml +++ b/.github/workflows/exercise-tests.yml @@ -19,10 +19,10 @@ jobs: ruby-version: [3.2, 3.3] steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - name: Set up Ruby - uses: ruby/setup-ruby@4c24fa5ec04b2e79eb40571b1cee2a0d2b705771 + uses: ruby/setup-ruby@8d27f39a5e7ad39aebbcbd1324f7af020229645c with: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true diff --git a/.github/workflows/generator-tests.yml b/.github/workflows/generator-tests.yml index 2445790607..582b8d2cee 100644 --- a/.github/workflows/generator-tests.yml +++ b/.github/workflows/generator-tests.yml @@ -12,9 +12,9 @@ jobs: name: Check Generator Templates runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - name: Set up Ruby - uses: ruby/setup-ruby@4c24fa5ec04b2e79eb40571b1cee2a0d2b705771 + uses: ruby/setup-ruby@8d27f39a5e7ad39aebbcbd1324f7af020229645c with: ruby-version: "3.3" bundler-cache: true @@ -24,9 +24,9 @@ jobs: name: Test Generator runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - name: Set up Ruby - uses: ruby/setup-ruby@4c24fa5ec04b2e79eb40571b1cee2a0d2b705771 + uses: ruby/setup-ruby@8d27f39a5e7ad39aebbcbd1324f7af020229645c with: ruby-version: "3.3" bundler-cache: true diff --git a/concepts/advanced-enumeration/about.md b/concepts/advanced-enumeration/about.md index afa1e3cdfe..d5e7c2b63b 100644 --- a/concepts/advanced-enumeration/about.md +++ b/concepts/advanced-enumeration/about.md @@ -14,12 +14,12 @@ fibonacci.none? { |number| number > 20 } #=> true fibonacci.select { |number| number.odd? } #=> [1, 1, 3, 5, 13] fibonacci.all? { |number| number < 20 } #=> true fibonacci.map { |number| number * 2 } #=> [0, 2, 2, 4, 6, 10, 16, 26] -fibonacci.select { |number| number >= 5} #=> [5, 8, 13] -fibonacci.find { |number| number >= 5} #=> 5 +fibonacci.select { |number| number >= 5 } #=> [5, 8, 13] +fibonacci.find { |number| number >= 5 } #=> 5 # Some methods work with or without a block fibonacci.sum #=> 33 -fibonacci.sum {| number | number * number } #=> 273 +fibonacci.sum { |number| number * number } #=> 273 # There are also methods to help with nested arrays: animals = [ ['cat', 'bob'], ['horse', 'caris'], ['mouse', 'arya'] ] diff --git a/concepts/advanced-enumeration/introduction.md b/concepts/advanced-enumeration/introduction.md index 5a20fb38a2..f2ccb0bcde 100644 --- a/concepts/advanced-enumeration/introduction.md +++ b/concepts/advanced-enumeration/introduction.md @@ -14,12 +14,12 @@ fibonacci.none? { |number| number > 20 } #=> true fibonacci.select { |number| number.odd? } #=> [1, 1, 3, 5, 13] fibonacci.all? { |number| number < 20 } #=> true fibonacci.map { |number| number * 2 } #=> [0, 2, 2, 4, 6, 10, 16, 26] -fibonacci.select { |number| number >= 5} #=> [5, 8, 13] -fibonacci.find { |number| number >= 5} #=> 5 +fibonacci.select { |number| number >= 5 } #=> [5, 8, 13] +fibonacci.find { |number| number >= 5 } #=> 5 # Some methods work with or without a block fibonacci.sum #=> 33 -fibonacci.sum {| number | number * number } #=> 273 +fibonacci.sum { |number| number * number } #=> 273 # There are also methods to help with nested arrays: animals = [ ['cat', 'bob'], ['horse', 'caris'], ['mouse', 'arya'] ] diff --git a/exercises/concept/boutique-inventory-improvements/.docs/instructions.md b/exercises/concept/boutique-inventory-improvements/.docs/instructions.md index b60f347dd3..34fc952837 100644 --- a/exercises/concept/boutique-inventory-improvements/.docs/instructions.md +++ b/exercises/concept/boutique-inventory-improvements/.docs/instructions.md @@ -1,6 +1,8 @@ # Instructions -You're continuing to work on the stock management system you built previously. Since discovering `OpenStruct` and block shortcuts, you've decided to refactor the code a little. Rather than storing the items as hashes, you're going to utilize your newfound skills. +You're continuing to work on the stock management system you built previously. +Since discovering `OpenStruct` and block shortcuts, you've decided to refactor the code a little. +Rather than storing the items as hashes, you're going to utilize your newfound skills. ## 1. Allow retrievable of items @@ -24,7 +26,7 @@ inventory.items.size # => 4 ``` -# 2. Refactor `item_names` +## 2. Refactor `item_names` Refactor `item_names` to use the new block shortcut you've learnt rather than hashes. As a reminder, the method should return: @@ -40,11 +42,10 @@ BoutiqueInventory.new([ # => ["Bamboo Socks Cats", "Black Short Skirt", "Maxi Brown Dress", "Red Short Skirt"] ``` +## 3. Refactor `total_stock` -# 2. Refactor `total_stock` - -Refactor `total_stock` to use the openstruct's method, rather than referencing a hash. -As a reminder, the method should return:: +Refactor `total_stock` to use the OpenStruct's method, rather than referencing a hash. +As a reminder, the method should return: ```ruby BoutiqueInventory.new([ diff --git a/exercises/concept/boutique-inventory/.docs/introduction.md b/exercises/concept/boutique-inventory/.docs/introduction.md index d7cf341980..7d88a22671 100644 --- a/exercises/concept/boutique-inventory/.docs/introduction.md +++ b/exercises/concept/boutique-inventory/.docs/introduction.md @@ -14,12 +14,12 @@ fibonacci.none? { |number| number > 20 } #=> true fibonacci.select { |number| number.odd? } #=> [1, 1, 3, 5, 13] fibonacci.all? { |number| number < 20 } #=> true fibonacci.map { |number| number * 2 } #=> [0, 2, 2, 4, 6, 10, 16, 26] -fibonacci.select { |number| number >= 5} #=> [5, 8, 13] -fibonacci.find { |number| number >= 6} #=> 8 +fibonacci.select { |number| number >= 5 } #=> [5, 8, 13] +fibonacci.find { |number| number >= 6 } #=> 8 # Some methods work with or without a block fibonacci.sum #=> 33 -fibonacci.sum {| number | number * number } #=> 273 +fibonacci.sum { |number| number * number } #=> 273 # There are also methods to help with nested arrays: animals = [ ['cat', 'bob'], ['horse', 'caris'], ['mouse', 'arya'] ] diff --git a/exercises/concept/moviegoer/moviegoer_test.rb b/exercises/concept/moviegoer/moviegoer_test.rb index c31a3e4641..892ffcc615 100644 --- a/exercises/concept/moviegoer/moviegoer_test.rb +++ b/exercises/concept/moviegoer/moviegoer_test.rb @@ -23,7 +23,8 @@ def test_members_get_free_popcorn end def test_regular_moviegoers_dont_get_free_popcorn - assert_raises NotMovieClubMemberError do + expected_exception = Moviegoer.include?(NotMovieClubMemberError) ? Moviegoer::NotMovieClubMemberError : NotMovieClubMemberError + assert_raises expected_exception do Moviegoer.new(25, member: false).claim_free_popcorn! end end diff --git a/exercises/concept/simple-calculator/simple_calculator_test.rb b/exercises/concept/simple-calculator/simple_calculator_test.rb index 1b26e42796..7b1c8b8023 100644 --- a/exercises/concept/simple-calculator/simple_calculator_test.rb +++ b/exercises/concept/simple-calculator/simple_calculator_test.rb @@ -27,14 +27,17 @@ def test_no_number_second_operand_raises_exception end def test_raises_exception_for_non_valid_operations - assert_raises(SimpleCalculator::UnsupportedOperation) { SimpleCalculator.calculate(1, 2, '**') } + expected_exception = SimpleCalculator.include?(UnsupportedOperation) ? SimpleCalculator::UnsupportedOperation : UnsupportedOperation + assert_raises(expected_exception) { SimpleCalculator.calculate(1, 2, '**') } end def test_raises_exception_when_operation_is_nil - assert_raises(SimpleCalculator::UnsupportedOperation) { SimpleCalculator.calculate(1, 2, nil) } + expected_exception = SimpleCalculator.include?(UnsupportedOperation) ? SimpleCalculator::UnsupportedOperation : UnsupportedOperation + assert_raises(expected_exception) { SimpleCalculator.calculate(1, 2, nil) } end def test_raises_exception_when_operation_is_an_empty_string - assert_raises(SimpleCalculator::UnsupportedOperation) { SimpleCalculator.calculate(1, 2, '') } + expected_exception = SimpleCalculator.include?(UnsupportedOperation) ? SimpleCalculator::UnsupportedOperation : UnsupportedOperation + assert_raises(expected_exception) { SimpleCalculator.calculate(1, 2, '') } end end