Categories: None [Edit]
lookout
Lookout
Lookout is a unit testing framework for Ruby┬╣ that puts your results in
focus. Tests (expectations) are written as follows
expect 2 do
1 + 1
end
expect ArgumentError do
Integer('1 + 1')
end
expect Array do
[1, 2, 3].select{ |i| i % 2 == 0 }
end
expect [2, 4, 6] do
[1, 2, 3].map{ |i| i * 2 }
end
Lookout is designed to encourage ΓÇô force, even ΓÇô unit testing best practices
such as
ΓÇó Setting up only one expectation per test
ΓÇó Not setting expectations on non-public APIs
ΓÇó Test isolation
This is done by
ΓÇó Only allowing one expectation to be set per test
ΓÇó Providing no (additional) way of accessing private state
ΓÇó Providing no setup and tear-down methods, nor a method of providing test
helpers
Other important points are
ΓÇó Putting the expected outcome of a test in focus with the steps of the
calculation of the actual result only as a secondary concern
ΓÇó A focus on code readability by providing no mechanism for describing an
expectation other than the code in the expectation itself
ΓÇó A unified syntax for setting up both state-based and behavior-based
expectations
The way Lookout works has been heavily influenced by expectations┬▓, by
{Jay Fields}┬│. The code base was once also heavily based on expectations,
based at Subversion {revision 76}⁴. A lot has happened since then and all of
the work past that revision are due to {Nikolai Weibull}⁵.
┬╣ Ruby: http://ruby-lang.org/
┬▓ Expectations: http://expectations.rubyforge.org/
┬│ Jay FieldsΓÇÖs blog: http://blog.jayfields.com/
⁴ Lookout revision 76:
https://github.com/now/lookout/commit/537bedf3e5b3eb4b31c066b3266f42964ac35ebe
⁵ Nikolai Weibull’s home page: http://disu.se/
§ Installation
Install Lookout with
% gem install lookout
§ Usage
Lookout allows you to set expectations on an objectΓÇÖs state or behavior.
WeΓÇÖll begin by looking at state expectatio...
Total
Ranking: 33,530 of 183,477
Downloads: 34,417
Daily
Ranking: 30,305 of 183,470
Downloads: 2
Downloads Trends
Ranking Trends
Num of Versions Trends
Popular Versions (Major)
Popular Versions (Major.Minor)
Depended by
Rank | Downloads | Name |
---|---|---|
22,686 | 59,037 | inventory |
34,658 | 32,880 | inventory-rake |
34,988 | 32,467 | inventory-rake-tasks-yard |
40,741 | 26,631 | value |
51,619 | 19,375 | yard-heuristics |
54,465 | 17,999 | yard-value |
61,849 | 15,204 | lookout-rake |
67,649 | 13,372 | ame |
68,969 | 13,005 | com |
77,575 | 10,922 | u |
99,729 | 7,319 | lookout-rack |
132,192 | 4,237 | rbtags |
133,503 | 4,171 | value-yard |
Depends on
Rank | Downloads | Name |
---|---|---|
224 | 160,939,746 | yard |
22,686 | 59,037 | inventory |
34,658 | 32,880 | inventory-rake |
34,988 | 32,467 | inventory-rake-tasks-yard |
40,741 | 26,631 | value |
51,619 | 19,375 | yard-heuristics |
54,465 | 17,999 | yard-value |
61,849 | 15,204 | lookout-rake |
Owners
# | Gravatar | Handle |
---|---|---|
1 | now |