formulamonks / contest Goto Github PK
View Code? Open in Web Editor NEWWrite more readable tests in Test::Unit with this tiny script.
License: MIT License
Write more readable tests in Test::Unit with this tiny script.
License: MIT License
I think the title passed to context() should be prepended to all child should() titles because it allows for focused testing (passing --name
argument to Test::Unit). This would allow you to pass the title of a context() to --name
to run all should()s inside that context(). Currently, passing the title of a context() to --name
does nothing.
Thanks for your consideration.
When using context() inside an ActionController::TestCase, I get the following error:
RuntimeError: @controller is nil: make sure you set it in your test's setup method.
Here is an example of what my test file looks like:
class ExamplesControllerTest < ActionController::TestCase
context "index action" do
should "return a list of examples" do
get :index, :format => :json
assert_response :success
end
end
end
The error is happening because context() creates a new Test::Unit::TestCase derived class whose name does not contain "ExamplesController", and so Rails becomes confused when it tries to automatically set @controller
inside of the context() body.
Thanks for your consideration.
The context multiple argument/non-string fix does not appear to be in version 0.1.2 of the gem. Version tags would be nice too.
If there are should blocks following context blocks at the same level of nesting, the tests defined by the should blocks are executed more than once. The following example llustrates this:
require 'contest'
class FooTest < Test::Unit::TestCase
context "a" do
context "c" do
should "d" do
puts "B"
end
should "e" do
puts "C"
end
end
should "b" do
puts "A"
end
end
end
If this code is run, "A" will be printed twice.
If you're using both in the same project, Contest is stepping on rspec-rails.
See http://img.skitch.com/20101024-mu3kqqpx81t5jfiyxh84j192yh.jpg
Notice that the "commented-on" and "closed" events don't tell you whose review is involved. One option would be to thread the events. Another would be to add the following suffix: " of #{submitter}'s submission"
or something similar.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.