gem_tutorial_kcheung 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0418bb78c39242f141f88bf8fe8cc180d4f039c92fef495acd3c995dba7a91a
4
- data.tar.gz: 197c0feb206b58716bd53ea41775f47a40a27b8190c4c034edf6ba456d5d5b5a
3
+ metadata.gz: abf6c5f3f1a351c4aa21d472d4dcabde7fdd9f4cd72a44a5581763b1d3fbe3e6
4
+ data.tar.gz: 9d9c78b1062f4df78fed797983f555ced682bd50b4606e92762c197be038a1f7
5
5
  SHA512:
6
- metadata.gz: 74a2f9804bc7b9df0495e88d5dda83e0fea9b6023ba10524ed47068ce4a89ec0bffd23a01829ac162f11e93f3886b4320d5bc63df03785aaac786151e2c2be79
7
- data.tar.gz: 5adf480723b4e0713721c9caef2d6e005647bf1fbfedbfd91a24c6703cee8724630fa2045e3ca401f7215521dd23079cd8d0fc327c74127d1d00317314bd077b
6
+ metadata.gz: 0d8c3123faefc3ee3cf18c64aded9297bbaea13893dc1f4e0a67f8dee616c8e7677d70bbd259ce248dbf2359b81769ff7579bf0fd0762d0d32b8e037ae263911
7
+ data.tar.gz: 129df06f77b97fc9b945921603b1d3d2b092eddbf9ed1d645de8e06db81133870009c4a8b03b582a479c201a7597a451c3903faad0afce33f2c5ec67fa44c5cf
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require 'rake/testtask'
2
+
3
+ Rake::TestTask.new do |t|
4
+ t.libs << 'test'
5
+ end
6
+
7
+ desc 'Run tests'
8
+ task default: :test
@@ -1,14 +1,22 @@
1
+ # This class is responsible for translating "hello world" based on the
2
+ # given language
1
3
  class GemTutorial::Translator
4
+ # Initialize translator with language
5
+ #
6
+ # @param language [String] the language
2
7
  def initialize(language)
3
8
  @language = language
4
9
  end
5
10
 
11
+ # Print 'hello world' depending on the class language passed in
12
+ #
13
+ # @return [nil] Prints 'hello world'.
6
14
  def hi
7
15
  case @language
8
16
  when 'spanish'
9
17
  'hola mundo'
10
18
  else
11
- 'hellow world'
19
+ 'hello world'
12
20
  end
13
21
  end
14
22
  end
@@ -1,4 +1,10 @@
1
+ # This class is responsible for exposing methods to be used from
2
+ # the gem
1
3
  class GemTutorial
4
+ # Print 'hello world' depending on the language passed in
5
+ #
6
+ # @param language [String] the language
7
+ # @return [nil] Prints 'hello world'.
2
8
  def self.hi(language = 'english')
3
9
  translator = Translator.new(language)
4
10
  translator.hi
@@ -0,0 +1,19 @@
1
+ require "minitest/autorun"
2
+ require "gem_tutorial_kcheung"
3
+
4
+ class GemTutorialTest < Minitest::Test
5
+ def test_english_hello
6
+ assert_equal "hello world",
7
+ GemTutorial.hi("english")
8
+ end
9
+
10
+ def test_any_hello
11
+ assert_equal "hello world",
12
+ GemTutorial.hi("ruby")
13
+ end
14
+
15
+ def test_spanish_hello
16
+ assert_equal "hola mundo",
17
+ GemTutorial.hi("spanish")
18
+ end
19
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem_tutorial_kcheung
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - kcheung
@@ -17,9 +17,11 @@ executables:
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - Rakefile
20
21
  - bin/gem_tutorial_kcheung
21
22
  - lib/gem_tutorial_kcheung.rb
22
23
  - lib/gem_tutorial_kcheung/translator.rb
24
+ - test/test_gem_tutorial_kcheung.rb
23
25
  homepage: https://rubygems.org/gems/gem_tutorial_kcheung
24
26
  licenses:
25
27
  - MIT
@@ -43,4 +45,5 @@ rubygems_version: 3.2.3
43
45
  signing_key:
44
46
  specification_version: 4
45
47
  summary: gem tutorial!
46
- test_files: []
48
+ test_files:
49
+ - test/test_gem_tutorial_kcheung.rb