You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2023/03/21 17:22:17 UTC

[incubator-opendal] branch main updated: feat(bindings/ruby): setup cucumber tests (#1725)

This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new 32fe0c73 feat(bindings/ruby): setup cucumber tests (#1725)
32fe0c73 is described below

commit 32fe0c73c23e8f95f749c889a53619fcd5371ca3
Author: Chojan Shang <ps...@apache.org>
AuthorDate: Wed Mar 22 01:22:12 2023 +0800

    feat(bindings/ruby): setup cucumber tests (#1725)
    
    * feat(bindings/ruby): setup cucumber
    
    Signed-off-by: Chojan Shang <ps...@outlook.com>
    
    * docs(bindings/ruby): add step for running cucumber tests
    
    Signed-off-by: Chojan Shang <ps...@outlook.com>
    
    * chore(bindings/ruby): add license header
    
    Signed-off-by: Chojan Shang <ps...@outlook.com>
    
    * refactor(bindings/ruby): switch to similar layout
    
    Signed-off-by: Chojan Shang <ps...@outlook.com>
    
    * refactor(bindings/ruby): simplify test cmd
    
    Signed-off-by: Chojan Shang <ps...@outlook.com>
    
    ---------
    
    Signed-off-by: Chojan Shang <ps...@outlook.com>
---
 bindings/ruby/Gemfile                              |  1 +
 bindings/ruby/Rakefile                             |  8 ++-
 .../ruby/{test/opendal_test.rb => cucumber.yml}    |  8 +--
 bindings/ruby/tests/binding.feature                |  1 +
 bindings/ruby/{test => tests}/opendal_test.rb      |  0
 bindings/ruby/tests/steps/binding.rb               | 64 ++++++++++++++++++++++
 bindings/ruby/{test => tests}/test_helper.rb       |  0
 7 files changed, 74 insertions(+), 8 deletions(-)

diff --git a/bindings/ruby/Gemfile b/bindings/ruby/Gemfile
index 27866d0d..096e4143 100644
--- a/bindings/ruby/Gemfile
+++ b/bindings/ruby/Gemfile
@@ -26,6 +26,7 @@ gem "rake", "~> 13.0"
 
 gem "minitest", "~> 5.10"
 gem "minitest-reporters", "~> 1.1"
+gem "cucumber", "~> 8.0"
 gem "color_pound_spec_reporter", "~> 0.0.6"
 
 gem "standard", "~> 1.3"
diff --git a/bindings/ruby/Rakefile b/bindings/ruby/Rakefile
index 89bbfaef..3e57b59a 100644
--- a/bindings/ruby/Rakefile
+++ b/bindings/ruby/Rakefile
@@ -21,6 +21,8 @@ require "rake/testtask"
 require "rake/extensiontask"
 require "bundler/gem_tasks"
 require "standard/rake"
+require "cucumber"
+require "cucumber/rake/task"
 
 task default: ["lint", "test"]
 
@@ -38,5 +40,9 @@ end
 
 Rake::TestTask.new do |t|
   t.deps << :dev << :compile
-  t.test_files = FileList[File.expand_path("test/*_test.rb", __dir__)]
+  t.test_files = FileList[File.expand_path("tests/*_test.rb", __dir__)]
+end
+
+Cucumber::Rake::Task.new(:test) do |t|
+  t.cucumber_opts = ["--format pretty", "--publish-quiet"] # Any valid command line option can go here.
 end
diff --git a/bindings/ruby/test/opendal_test.rb b/bindings/ruby/cucumber.yml
similarity index 86%
copy from bindings/ruby/test/opendal_test.rb
copy to bindings/ruby/cucumber.yml
index 1b5c2ac6..c4cc853e 100644
--- a/bindings/ruby/test/opendal_test.rb
+++ b/bindings/ruby/cucumber.yml
@@ -15,10 +15,4 @@
 # specific language governing permissions and limitations
 # under the License.
 
-require_relative "test_helper"
-
-class OpenDALTest < Minitest::Test
-  def test_hello_opendal
-    hello_opendal
-  end
-end
+default: tests -r tests/steps
\ No newline at end of file
diff --git a/bindings/ruby/tests/binding.feature b/bindings/ruby/tests/binding.feature
new file mode 120000
index 00000000..fcb71d38
--- /dev/null
+++ b/bindings/ruby/tests/binding.feature
@@ -0,0 +1 @@
+../../tests/features/binding.feature
\ No newline at end of file
diff --git a/bindings/ruby/test/opendal_test.rb b/bindings/ruby/tests/opendal_test.rb
similarity index 100%
rename from bindings/ruby/test/opendal_test.rb
rename to bindings/ruby/tests/opendal_test.rb
diff --git a/bindings/ruby/tests/steps/binding.rb b/bindings/ruby/tests/steps/binding.rb
new file mode 100644
index 00000000..adaa886e
--- /dev/null
+++ b/bindings/ruby/tests/steps/binding.rb
@@ -0,0 +1,64 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+Given("A new OpenDAL Blocking Operator") do
+  pending # Write code here that turns the phrase above into concrete actions
+end
+
+When("Blocking write path {string} with content {string}") do |string, string2|
+  pending # Write code here that turns the phrase above into concrete actions
+end
+
+Then("The blocking file {string} should exist") do |string|
+  pending # Write code here that turns the phrase above into concrete actions
+end
+
+Then("The blocking file {string} entry mode must be file") do |string|
+  pending # Write code here that turns the phrase above into concrete actions
+end
+
+Then("The blocking file {string} content length must be {string}") do |string, string2|
+  pending # Write code here that turns the phrase above into concrete actions
+end
+
+Then("The blocking file {string} must have content {string}") do |string, string2|
+  pending # Write code here that turns the phrase above into concrete actions
+end
+
+Given("A new OpenDAL Async Operator") do
+  pending # Write code here that turns the phrase above into concrete actions
+end
+
+When("Async write path {string} with content {string}") do |string, string2|
+  pending # Write code here that turns the phrase above into concrete actions
+end
+
+Then("The async file {string} should exist") do |string|
+  pending # Write code here that turns the phrase above into concrete actions
+end
+
+Then("The async file {string} entry mode must be file") do |string|
+  pending # Write code here that turns the phrase above into concrete actions
+end
+
+Then("The async file {string} content length must be {string}") do |string, string2|
+  pending # Write code here that turns the phrase above into concrete actions
+end
+
+Then("The async file {string} must have content {string}") do |string, string2|
+  pending # Write code here that turns the phrase above into concrete actions
+end
diff --git a/bindings/ruby/test/test_helper.rb b/bindings/ruby/tests/test_helper.rb
similarity index 100%
rename from bindings/ruby/test/test_helper.rb
rename to bindings/ruby/tests/test_helper.rb