Skip to content

Commit

Permalink
RUB-14 Use ruby 2.7 to generate class files for comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
ashish91 committed Oct 12, 2023
1 parent bd46ae2 commit 5723d48
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 15 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
with:
ruby-version: '2.7'
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
# - run: bundle exec rake
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
- run: bundle exec rake
# Follow steps to debug => https://til.simonwillison.net/github-actions/debug-tmate
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ GEM
google-cloud-translate-v3 (0.9.0)
gapic-common (>= 0.20.0, < 2.a)
google-cloud-errors (~> 1.0)
google-protobuf (3.24.3)
google-protobuf (3.24.3-x86_64-linux)
googleapis-common-protos (1.4.0)
google-protobuf (~> 3.14)
Expand All @@ -45,6 +46,9 @@ GEM
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
grpc (1.58.0)
google-protobuf (~> 3.23)
googleapis-common-protos-types (~> 1.0)
grpc (1.58.0-x86_64-linux)
google-protobuf (~> 3.23)
googleapis-common-protos-types (~> 1.0)
Expand Down Expand Up @@ -81,6 +85,7 @@ GEM
yaml (0.2.0)

PLATFORMS
ruby
x86_64-linux

DEPENDENCIES
Expand Down
2 changes: 1 addition & 1 deletion ruby-vernac-parser.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
spec.summary = "Write a short summary, because RubyGems requires one."
spec.homepage = "https://github.com/betacraft/ruby-vernac-parser"
spec.license = "MIT"
spec.required_ruby_version = ">= 2.6.0"
spec.required_ruby_version = ">= 2.7"

spec.metadata["homepage_uri"] = "https://github.com/betacraft/ruby-vernac-parser"
spec.metadata["source_code_uri"] = "https://github.com/betacraft/ruby-vernac-parser"
Expand Down
16 changes: 14 additions & 2 deletions spec/generators/language_classes_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,20 @@
it "generates translation files for ruby classes" do
subject.generate_class_files

['array.yml', 'class.yml', 'integer.yml', 'math.yml', 'module.yml', 'object.yml'].each do |file|
expect(FileUtils.compare_file(Dir.pwd + '/spec/stubs/gem_path/lib/translations/classes/' + file, Dir.pwd + '/spec/stubs/language_classes_generator/' + file)).to be_truthy
['array.yml'].each do |file|
generated = YAML.load_file(Dir.pwd + '/spec/stubs/gem_path/lib/translations/classes/' + file)
orig = YAML.load_file(Dir.pwd + '/spec/stubs/language_classes_generator/' + file)

klass = file.split('.')[0]
expect(generated[klass]['cname']).to eq(orig[klass]['cname'])

orig[klass].keys.each do |method_type|
next if method_type == 'cname'

orig[klass][method_type].keys do |method|
expect(generated[klass][method_type][method]).to eq(orig[klass][method_type][method])
end
end
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/stubs/language_classes_generator/array.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ array:
singleton_methods: singleton_methods
stub: stub
stub_chain: stub_chain
subclasses: subclasses
superclass: superclass
taint: taint
tainted?: tainted?
Expand Down Expand Up @@ -237,6 +236,7 @@ array:
system: system
test: test
throw: throw
timeout: timeout
trace_var: trace_var
trap: trap
untrace_var: untrace_var
Expand Down Expand Up @@ -339,7 +339,6 @@ array:
instance_variable_get: instance_variable_get
instance_variable_set: instance_variable_set
instance_variables: instance_variables
intersect?: intersect?
intersection: intersection
is_a?: is_a?
itself: itself
Expand Down Expand Up @@ -532,6 +531,7 @@ array:
system: system
test: test
throw: throw
timeout: timeout
trace_var: trace_var
trap: trap
untrace_var: untrace_var
Expand Down
4 changes: 2 additions & 2 deletions spec/stubs/language_classes_generator/class.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ class:
singleton_methods: singleton_methods
stub: stub
stub_chain: stub_chain
subclasses: subclasses
superclass: superclass
taint: taint
tainted?: tainted?
Expand Down Expand Up @@ -237,6 +236,7 @@ class:
system: system
test: test
throw: throw
timeout: timeout
trace_var: trace_var
trap: trap
untrace_var: untrace_var
Expand Down Expand Up @@ -369,7 +369,6 @@ class:
singleton_methods: singleton_methods
stub: stub
stub_chain: stub_chain
subclasses: subclasses
superclass: superclass
taint: taint
tainted?: tainted?
Expand Down Expand Up @@ -475,6 +474,7 @@ class:
system: system
test: test
throw: throw
timeout: timeout
trace_var: trace_var
trap: trap
untrace_var: untrace_var
Expand Down
4 changes: 2 additions & 2 deletions spec/stubs/language_classes_generator/integer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ integer:
sqrt: sqrt
stub: stub
stub_chain: stub_chain
subclasses: subclasses
superclass: superclass
taint: taint
tainted?: tainted?
Expand All @@ -139,7 +138,6 @@ integer:
to_s: to_s
to_yaml: to_yaml
trust: trust
try_convert: try_convert
undef_method: undef_method
unstub: unstub
untaint: untaint
Expand Down Expand Up @@ -236,6 +234,7 @@ integer:
system: system
test: test
throw: throw
timeout: timeout
trace_var: trace_var
trap: trap
untrace_var: untrace_var
Expand Down Expand Up @@ -482,6 +481,7 @@ integer:
system: system
test: test
throw: throw
timeout: timeout
trace_var: trace_var
trap: trap
untrace_var: untrace_var
Expand Down
1 change: 1 addition & 0 deletions spec/stubs/language_classes_generator/math.yml
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ math:
system: system
test: test
throw: throw
timeout: timeout
trace_var: trace_var
trap: trap
untrace_var: untrace_var
Expand Down
4 changes: 3 additions & 1 deletion spec/stubs/language_classes_generator/module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module:
__id__: __id__
__send__: __send__
alias_method: alias_method
allocate: allocate
ancestors: ancestors
any_instance: any_instance
as_null_object: as_null_object
Expand Down Expand Up @@ -128,7 +129,6 @@ module:
singleton_methods: singleton_methods
stub: stub
stub_chain: stub_chain
subclasses: subclasses
superclass: superclass
taint: taint
tainted?: tainted?
Expand Down Expand Up @@ -236,6 +236,7 @@ module:
system: system
test: test
throw: throw
timeout: timeout
trace_var: trace_var
trap: trap
untrace_var: untrace_var
Expand Down Expand Up @@ -472,6 +473,7 @@ module:
system: system
test: test
throw: throw
timeout: timeout
trace_var: trace_var
trap: trap
untrace_var: untrace_var
Expand Down
3 changes: 2 additions & 1 deletion spec/stubs/language_classes_generator/object.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ object:
singleton_methods: singleton_methods
stub: stub
stub_chain: stub_chain
subclasses: subclasses
superclass: superclass
taint: taint
tainted?: tainted?
Expand Down Expand Up @@ -235,6 +234,7 @@ object:
system: system
test: test
throw: throw
timeout: timeout
trace_var: trace_var
trap: trap
untrace_var: untrace_var
Expand Down Expand Up @@ -396,6 +396,7 @@ object:
system: system
test: test
throw: throw
timeout: timeout
trace_var: trace_var
trap: trap
untrace_var: untrace_var
Expand Down
2 changes: 1 addition & 1 deletion spec/utils/file_handler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
end

it "returns files in a directory" do
expect(subject.list_files(@file_dir)).to eq(@paths)
expect(subject.list_files(@file_dir).sort).to eq(@paths)
end

after :all do
Expand Down

0 comments on commit 5723d48

Please sign in to comment.