-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build on JRuby again #1383
Build on JRuby again #1383
Changes from 12 commits
48dc0c7
7d4d7bf
4d3e882
e0066cf
cc248d7
4285973
af11161
18d2bfe
73ae38e
835d765
a216105
a59ea7f
86b5d47
4c83414
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,40 @@ | ||||||
# Cucumber and JRuby limitations | ||||||
|
||||||
`cucumber` can be executed on `JRuby` (tested with `9.1`and `9.2`), although some of the features | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well, it seems we have even more problems with JRuby 9.1 (apparently it's failing with language |
||||||
are not available on this platform. | ||||||
|
||||||
## Defining steps with native languages | ||||||
|
||||||
There are currently three languages (Russian, Ukrainian and Uzbek) for which the step definition | ||||||
can not be written in native language. | ||||||
That means, for example, that you can not write the following code: | ||||||
|
||||||
```ruby | ||||||
Допустим('я ввожу число {int}') do |число| | ||||||
calc.push число | ||||||
end | ||||||
``` | ||||||
|
||||||
Instead, you have to write: | ||||||
```ruby | ||||||
Given('я ввожу число {int}') do |number| | ||||||
calc.push number | ||||||
end | ||||||
``` | ||||||
|
||||||
Of course, you can still write your feature files in a native language, for example, the following | ||||||
feature file can be executed on JRuby: | ||||||
|
||||||
```gherkin | ||||||
# language: ru | ||||||
Функционал: Сложение чисел | ||||||
Чтобы не складывать в уме | ||||||
Все, у кого с этим туго | ||||||
Хотят автоматическое сложение целых чисел | ||||||
|
||||||
Сценарий: Сложение двух целых чисел | ||||||
Допустим я ввожу число 50 | ||||||
И затем ввожу число 70 | ||||||
Если я нажимаю "+" | ||||||
То результатом должно быть число 120 | ||||||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,29 +4,45 @@ task :cucumber do | |
Dir["#{dir}/*"].sort.each do |f| | ||
next unless File.directory?(f) | ||
lang = f[dir.length + 1..-1] | ||
if examples_working?(lang) | ||
Dir.chdir(f) do | ||
puts "DIR: #{f}" | ||
rake('cucumber') | ||
end | ||
else | ||
STDERR.puts %{ | ||
!!!!! | ||
!!!!! | ||
!!!!! SKIPPING #{lang} (The examples are out of date - please help update them) | ||
!!!!! | ||
!!!!! | ||
} | ||
message = examples_disabled?(lang) | ||
unless message.nil? | ||
STDERR.puts(message) | ||
next | ||
end | ||
|
||
Dir.chdir(f) do | ||
puts "DIR: #{f}" | ||
rake('cucumber') | ||
end | ||
end | ||
end | ||
|
||
task default: :cucumber | ||
|
||
def examples_disabled?(lang) | ||
return make_warning("SKIPPING #{lang} (The examples are out of date - please help update them)") unless examples_working?(lang) | ||
return make_warning("SKIPPING #{lang}: examples have been disabled for JRuby.") if jruby_disabled_examples?(lang) | ||
end | ||
|
||
def jruby_disabled_examples?(lang) | ||
return unless RUBY_PLATFORM == 'java' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rubocop will flag this. Linespace after guard clause. |
||
%w[ru uk uz].include?(lang) | ||
end | ||
|
||
def examples_working?(lang) | ||
!%w[ar].index(lang) | ||
end | ||
|
||
def make_warning(msg) | ||
%( | ||
!!!!! | ||
!!!!! | ||
!!!!! #{msg} | ||
!!!!! | ||
!!!!! | ||
) | ||
end | ||
|
||
def rake(args) | ||
ruby($PROGRAM_NAME, args) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps "JRuby 9.1, 9.2"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be worth checking it still build with JRuby 9.1, but that's just a task to add to CircleCI, should not be much of a trouble.
I'll add that :)