Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 49 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,61 @@
name: CI
on: [push]
on:
pull_request:
push:
branches:
- master
- main
Comment on lines +6 to +7

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case #49 happens

schedule:
- cron: '0 9 1 * *'

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Monthly seems OK for a scheduled run. Let me know if something else makes more sense.


jobs:
koans:
strategy:
fail-fast: false
matrix:
ruby:
- '2.0'
- '2.1'
- '2.2'
- '2.3'
- '2.4'
- '2.5'
- '2.6'
- '2.7'
- '3.0'
- '3.1'
- '3.2'
- '3.3'
- '3.4'
- '4.0'
- ruby-head
os: [ubuntu-latest]
include:
- ruby: '1.9'
os: ubuntu-22.04
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v7

- name: Install Ruby!
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}

- name: Run solved koans
run: rake run

test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v7

- name: Install Ruby!
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2.2"
ruby-version: '4.0'

- name: run tests
run: rake test
run: rake test
4 changes: 2 additions & 2 deletions rakelib/checks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ namespace "check" do
task :asserts do
puts "Checking for asserts missing the replacement text:"
begin
sh "egrep -n 'assert( |_)' src/about_*.rb | egrep -v '__|_n_|project|about_assert' | egrep -v ' *#'"
sh "grep -En 'assert( |_)' src/about_*.rb | grep -Ev '__|_n_|project|about_assert' | grep -Ev ' *#'"
puts
puts "Examine the above lines for missing __ replacements"
rescue RuntimeError => ex
rescue RuntimeError
puts "OK"
end
puts
Expand Down
4 changes: 3 additions & 1 deletion src/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ require 'rake/testtask'
task :default => :test

task :test do
ruby 'path_to_enlightenment.rb'
ruby 'path_to_enlightenment.rb' do |ok, res|
exit res.exitstatus unless ok
end
end

2 changes: 1 addition & 1 deletion src/about_keyword_arguments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_mandatory_keyword_arguments_without_mandatory_argument
exception = assert_raise(___(ArgumentError)) do
method_with_mandatory_keyword_arguments
end
assert_match(/#{__("missing keyword: :one")}/, exception.message)
assert_match(/#{__("missing keyword: :?one")}/, exception.message)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruby 2.1-2.6 don't have the : in the message.

end

end
7 changes: 5 additions & 2 deletions src/neo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def in_ruby_version(*versions)
end

def before_ruby_version(version)
Gem::Version.new(RUBY_VERSION) < Gem::Version.new(version)
Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new(version)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version of Rubygems that ships with Ruby 1.9.3 tries to mutate the string passed into Gem::Version.new, and RUBY_VERSION is frozen.

end

in_ruby_version("1.8") do
Expand Down Expand Up @@ -519,6 +519,7 @@ def walk
sensei.observe(step.meditate)
end
sensei.instruct
!sensei.failed?
end

def each_step
Expand All @@ -536,6 +537,8 @@ def each_step
end

END {
exception = $!

Neo::Koan.command_line(ARGV)
Neo::ThePath.new.walk
exit exception.nil? && Neo::ThePath.new.walk
}
2 changes: 1 addition & 1 deletion src/path_to_enlightenment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
require 'about_nil'
require 'about_hashes'
require 'about_methods'
in_ruby_version("2", "3", "4") do
in_ruby_version("2.[1-7]", "3", "4") do

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruby 2.0 has keyword arguments, but not required keyword arguments (which is about half the tests in this file).

require 'about_keyword_arguments'
end
require 'about_constants'
Expand Down
Loading