fis-test 0.0.1
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 +15 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +76 -0
- data/Rakefile +1 -0
- data/fis-test.gemspec +23 -0
- data/fis-test/.gitignore +17 -0
- data/lib/fis/test.rb +38 -0
- data/lib/fis/test/version.rb +5 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YjBiZDQ0MWMxNDU4YjVmMmMwNWI2ZTZhMzA1YTczZjZkN2IxODk3Zg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MDdlYTY1MWRkZTU0OTk1OWFhZjY2MWVjYTIyZDBjMzI4YjBiMjY2MA==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MDM1NjdlMzI5ODYzNTU4ZTVmNTMxZjBkODkzM2Y0YWUyYTA5YzBkM2QwZDVi
|
10
|
+
Y2ZkZDhhN2Y1YTc0ZjI1YjRkZTkwNWZlZmQ2MDU4N2ZhMWFiMGU2NmQ4YThk
|
11
|
+
ZTk5M2VmOWVhNWZlNWFiNTU2NmYyZTVlYWE2MTVlOWUxZjYyNTE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
N2NiMWYxYTEwNzM5YjM2ZTBjZWY1OTg4MWUxYzNiZTU4MDAxZjMzMTUzZDY2
|
14
|
+
MzgzOWNkNmYwNmZiNTcxOTk5NDNjN2E0NGM1ZjQ1ZWQyNjhiNTcyMmYxYmRl
|
15
|
+
ZmM5NmM5MmU1ZTFkZmY3ZWE2N2Q2OTBjY2JiNjY3ZjMyYmZhNmI=
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 aviflombaum
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# Fis::Test
|
2
|
+
|
3
|
+
Testing frameworks are amazing. RSpec, Minitest, all of them are great. For beginners though, those frameworks add so many levels of abstraction and features that teaching the core of test-driven development gets sidetracked by learning framework specific conventions and syntax. Instead of teaching the significance of an assertion, you end up going over `let{}` or `setup`. That's important, but not as important as `assert` or `assert_equal`.
|
4
|
+
|
5
|
+
The Flatiron School test framework is 32 lines of code and provides the essential methods to write a unit test.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'fis-test'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install fis-test
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
The core of `fis-test` is the following structure.
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
test 'a Song should have name' do
|
27
|
+
s = Song.new
|
28
|
+
s.name = "Get Lucky"
|
29
|
+
assert_equal s.name, "Get Lucky"
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
`test` is a simple wrapper method to give you some nice output.
|
34
|
+
|
35
|
+
`assert` and `assert_equal` are all you get.
|
36
|
+
|
37
|
+
No setup/teardown. You can DRY your code with simple helper methods.
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
|
41
|
+
def setup_song
|
42
|
+
@song = Song.new
|
43
|
+
end
|
44
|
+
|
45
|
+
def teardown_song
|
46
|
+
@song = nil
|
47
|
+
end
|
48
|
+
|
49
|
+
test 'a Song should have name' do
|
50
|
+
setup_song
|
51
|
+
@song.name = "Get Lucky"
|
52
|
+
assert_equal @song.name, "Get Lucky"
|
53
|
+
teardown_song
|
54
|
+
end
|
55
|
+
```
|
56
|
+
|
57
|
+
That's it! Write tests. Stop writing code.
|
58
|
+
|
59
|
+
## Contributing
|
60
|
+
|
61
|
+
1. Fork it
|
62
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
63
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
64
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
65
|
+
5. Create new Pull Request
|
66
|
+
|
67
|
+
## TODO
|
68
|
+
|
69
|
+
- Write tests for the tests.
|
70
|
+
- Automate setup/teardown method calls if they exist
|
71
|
+
- More modularity for test groups
|
72
|
+
- Better output
|
73
|
+
|
74
|
+
## Caveats
|
75
|
+
|
76
|
+
I'd like to see this framework stay below 100 loc forever.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/fis-test.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'fis/test/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "fis-test"
|
8
|
+
spec.version = Fis::Test::VERSION
|
9
|
+
spec.authors = ["aviflombaum"]
|
10
|
+
spec.email = ["avi@flombaum.com"]
|
11
|
+
spec.description = %q{Really simple testing framework used at Flatiron School}
|
12
|
+
spec.summary = %q{32 lines of code, the majority of what you need to write tests.}
|
13
|
+
spec.homepage = "http://github.com/flatiron-school/test"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
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.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
data/fis-test/.gitignore
ADDED
data/lib/fis/test.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require "fis/test/version"
|
2
|
+
|
3
|
+
module Fis
|
4
|
+
module Test
|
5
|
+
def test(title, &b)
|
6
|
+
begin
|
7
|
+
if b
|
8
|
+
result = b.call
|
9
|
+
if result.is_a?(Array)
|
10
|
+
puts "fail: #{title}"
|
11
|
+
puts " expected #{result.first} to equal #{result.last}"
|
12
|
+
elsif result
|
13
|
+
puts "pass: #{title}"
|
14
|
+
else
|
15
|
+
puts "fail: #{title}"
|
16
|
+
end
|
17
|
+
else
|
18
|
+
puts "pending: #{title}"
|
19
|
+
end
|
20
|
+
rescue => e
|
21
|
+
puts "fail: #{title}"
|
22
|
+
puts e
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def assert(statement)
|
27
|
+
!!statement
|
28
|
+
end
|
29
|
+
|
30
|
+
def assert_equal(actual, expected)
|
31
|
+
if expected == actual
|
32
|
+
true
|
33
|
+
else
|
34
|
+
[expected, actual]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fis-test
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- aviflombaum
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-06-18 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.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Really simple testing framework used at Flatiron School
|
42
|
+
email:
|
43
|
+
- avi@flombaum.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- Gemfile
|
49
|
+
- LICENSE.txt
|
50
|
+
- README.md
|
51
|
+
- Rakefile
|
52
|
+
- fis-test.gemspec
|
53
|
+
- fis-test/.gitignore
|
54
|
+
- lib/fis/test.rb
|
55
|
+
- lib/fis/test/version.rb
|
56
|
+
homepage: http://github.com/flatiron-school/test
|
57
|
+
licenses:
|
58
|
+
- MIT
|
59
|
+
metadata: {}
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ! '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 2.0.3
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: 32 lines of code, the majority of what you need to write tests.
|
80
|
+
test_files: []
|