mini_test_practice 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f8ee1279d9e028c4a62c64df6277757478cdedc6
4
+ data.tar.gz: 1ce1e18164cb92ba9e835126aeb695d3c0bae97d
5
+ SHA512:
6
+ metadata.gz: 5ddf1a138fe72f224e8185227c0c36aee5b5be7807e671b720d543277395202c11a121c65e3749859acef5012adad2462c90abe27dea63ec3a881ac767b6287c
7
+ data.tar.gz: 439c32c47de4b9d3400ee0c6943b4df826435ad943370b96ea68605d7cf5391b1f191052f69990fea77fa40156e862a32f695fbc7c93a87e4761ff4758852dac
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mini_test_practice.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem 'guard-minitest'
8
+ end
@@ -0,0 +1,28 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :minitest do
5
+ # with Minitest::Unit
6
+ watch(%r{^test/(.*)\/?test_(.*)\.rb$})
7
+ watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
8
+ watch(%r{^test/test_helper\.rb$}) { 'test' }
9
+
10
+ # with Minitest::Spec
11
+ # watch(%r{^spec/(.*)_spec\.rb$})
12
+ # watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
13
+ # watch(%r{^spec/spec_helper\.rb$}) { 'spec' }
14
+
15
+ # Rails 4
16
+ # watch(%r{^app/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
17
+ # watch(%r{^app/controllers/application_controller\.rb$}) { 'test/controllers' }
18
+ # watch(%r{^app/controllers/(.+)_controller\.rb$}) { |m| "test/integration/#{m[1]}_test.rb" }
19
+ # watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
20
+ # watch(%r{^lib/(.+)\.rb$}) { |m| "test/lib/#{m[1]}_test.rb" }
21
+ # watch(%r{^test/.+_test\.rb$})
22
+ # watch(%r{^test/test_helper\.rb$}) { 'test' }
23
+
24
+ # Rails < 4
25
+ # watch(%r{^app/controllers/(.*)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" }
26
+ # watch(%r{^app/helpers/(.*)\.rb$}) { |m| "test/helpers/#{m[1]}_test.rb" }
27
+ # watch(%r{^app/models/(.*)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" }
28
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Le Bao Linh
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,31 @@
1
+ # MiniTestPractice
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'mini_test_practice'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install mini_test_practice
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/mini_test_practice/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ end
7
+
8
+ task :default => :test
9
+
@@ -0,0 +1,36 @@
1
+ require "mini_test_practice/version"
2
+
3
+ module MiniTestPractice
4
+ # Your code goes here...
5
+ class MyClass
6
+ def odd?(value)
7
+ (value % 2) == 1
8
+ end
9
+
10
+ def check_number?(value)
11
+ (value >= 1000) and (value <= 9999) and (value % 2) == 0
12
+ end
13
+
14
+ def enough_length?(str)
15
+ (str.length >= 3) and (str.length <= 8)
16
+ end
17
+
18
+ def divide(a, b)
19
+ a / b
20
+ end
21
+
22
+ def fizz_buzz(value)
23
+ if value%15 == 0 then
24
+ "FizzBuzz"
25
+ elsif value%3 == 0 then "Fizz"
26
+ elsif value%5 == 0 then "Buzz"
27
+ else nil
28
+ end
29
+ end
30
+
31
+ def hello(word)
32
+
33
+
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,3 @@
1
+ module MiniTestPractice
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'mini_test_practice/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "mini_test_practice"
8
+ spec.version = MiniTestPractice::VERSION
9
+ spec.authors = ["Le Bao Linh"]
10
+ spec.email = ["a1447ll@aiit.ac.jp"]
11
+ spec.summary = "Mini Test "
12
+ spec.description = ""
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "minitest"
24
+ end
@@ -0,0 +1,4 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'mini_test_practice'
3
+
4
+ require 'minitest/autorun'
@@ -0,0 +1,49 @@
1
+ require 'minitest_helper'
2
+
3
+ class TestMiniTestPractice < MiniTest::Unit::TestCase
4
+ def test_that_it_has_a_version_number
5
+ refute_nil ::MiniTestPractice::VERSION
6
+ end
7
+
8
+ def setup
9
+ @my_class = ::MiniTestPractice::MyClass.new
10
+ end
11
+
12
+ def teardown
13
+ @my_class = nil
14
+ end
15
+
16
+ def test_odd?
17
+ assert_equal true, @my_class.odd?(1)
18
+ assert_equal false, @my_class.odd?(2)
19
+ end
20
+
21
+
22
+ def test_check_number?
23
+ assert_equal true, @my_class.check_number?(1000)
24
+ assert_equal false, @my_class.check_number?(9999)
25
+ assert_equal false, @my_class.check_number?(999)
26
+ assert_equal false, @my_class.check_number?(10000)
27
+ end
28
+
29
+ def test_enough_length?
30
+ assert_equal true, @my_class.enough_length?("rin")
31
+ assert_equal true, @my_class.enough_length?("12345678")
32
+ assert_equal false, @my_class.enough_length?("123456789")
33
+ assert_equal false, @my_class.enough_length?(" ")
34
+ end
35
+
36
+ def test_divide
37
+ assert_equal 3, @my_class.divide(9 , 3)
38
+ assert_raises ZeroDivisionError do
39
+ @my_class.divide(1, 0)
40
+ end
41
+ end
42
+
43
+ def test_fizz_buzz
44
+ assert_equal "FizzBuzz", @my_class.fizz_buzz(15)
45
+ assert_equal "Fizz", @my_class.fizz_buzz(3)
46
+ assert_equal "Buzz", @my_class.fizz_buzz(5)
47
+ assert_equal nil, @my_class.fizz_buzz(2)
48
+ end
49
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mini_test_practice
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Le Bao Linh
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: ''
56
+ email:
57
+ - a1447ll@aiit.ac.jp
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".travis.yml"
64
+ - Gemfile
65
+ - Gemfile.lock
66
+ - Guardfile
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - lib/mini_test_practice.rb
71
+ - lib/mini_test_practice/version.rb
72
+ - mini_test_practice.gemspec
73
+ - pkg/mini_test_practice-0.0.1.gem
74
+ - test/minitest_helper.rb
75
+ - test/test_mini_test_practice.rb
76
+ homepage: ''
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.2.2
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Mini Test
100
+ test_files:
101
+ - test/minitest_helper.rb
102
+ - test/test_mini_test_practice.rb