Skip to content

Instantly share code, notes, and snippets.

@tinogomes
Created July 10, 2009 01:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tinogomes/144170 to your computer and use it in GitHub Desktop.
Save tinogomes/144170 to your computer and use it in GitHub Desktop.
Usando git bisect para encontrar o erro
celestino@macbook:~/Projects/blog (master)
$ git log --pretty=oneline
0a49fcb771a39b7d3931c63a818de94eed5f10e8 limpando o README
245d8ce9d09c1645583e93e53896b638f664e6a2 ajustes no rake do rcov
be76c6dd3a155079e99195e0335382291653efa1 tarefas do rcov
8d7dc0a7b3832965f5fc021467ee44687df31a8e PostController publico
d34b775d33d0887109cd45848ef73a85fcbf0f9c Post com comentarios e comentarios de um post
3a510b83646bef7f1a9f69f9b7efc74a099589f9 substituindo fixtures por factories
7c1e5231858a8afbd409e3437fca80b88831e206 Movi os CRUDS de Post e Comentarios para admin
1d2ab7b0ceaf7257ff812791e06de72ef55d399a merge with branch "comments" <<== o erro está aqui
e280f577f01785e6cd0b9b0df99984315f400473 Colocando campos obrigatorios para Post
a17411e98d7b521b5cc786a3104af5dc8ffa3dc9 CRUD de post
bbc1f556624e315faf20b2247a6dd7136213a0e3 Configuracoes no ambiente de teste: factory_girl, shoulda, mocha e redgren
91d418a60c551bcc5bf0e8a41a3b65d2176cedc2 Definido layout e configuracoes
e2fd4fcbf3b55e24a3c43ee24145be404cac64c2 O começo
celestino@macbook:~/Projects/blog (master)
$ git bisect start HEAD a17411e98d7b521b5cc786a3104af5dc8ffa3dc9
Bisecting: 4 revisions left to test after this
[3a510b83646bef7f1a9f69f9b7efc74a099589f9] substituindo fixtures por factories
celestino@macbook:~/Projects/blog (3a510b8...|BISECTING)
$ git bisect run rake test:units
running rake test:units
(in /Users/celestino/Projects/blog)
/usr/local/bin/ruby -I"lib:test" "/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/unit/comment_test.rb" "test/unit/post_test.rb"
Loaded suite /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
.F.
Finished in 0.134892 seconds.
1) Failure:
test: A Post model should require body to be set. (PostTest)
[/usr/local/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/assertions.rb:50:in `assert_accepts'
/usr/local/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/macros.rb:46:in `__bind_1247189405_595492'
/usr/local/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/context.rb:253:in `call'
/usr/local/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/context.rb:253:in `test: A Post model should require body to be set. ']:
Expected errors to include "can't be blank" when body is set to nil, got errors: title can't be blank (nil)
3 tests, 3 assertions, 1 failures, 0 errors
rake aborted!
Command failed with status (1): [/usr/local/bin/ruby -I"lib:test" "/usr/loc...]
(See full trace by running task with --trace)
Bisecting: 1 revisions left to test after this
[1d2ab7b0ceaf7257ff812791e06de72ef55d399a] merge with branch "comments"
running rake test:units
(in /Users/celestino/Projects/blog)
/usr/local/bin/ruby -I"lib:test" "/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/unit/comment_test.rb" "test/unit/post_test.rb"
Loaded suite /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
.F.
Finished in 0.178006 seconds.
1) Failure:
test: A Post model should require body to be set. (PostTest)
[/usr/local/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/assertions.rb:50:in `assert_accepts'
/usr/local/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/macros.rb:46:in `__bind_1247189412_616550'
/usr/local/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/context.rb:253:in `call'
/usr/local/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/context.rb:253:in `test: A Post model should require body to be set. ']:
Expected errors to include "can't be blank" when body is set to nil, got errors: title can't be blank (nil)
3 tests, 3 assertions, 1 failures, 0 errors
rake aborted!
Command failed with status (1): [/usr/local/bin/ruby -I"lib:test" "/usr/loc...]
(See full trace by running task with --trace)
Bisecting: 0 revisions left to test after this
[e280f577f01785e6cd0b9b0df99984315f400473] Colocando campos obrigatorios para Post
running rake test:units
(in /Users/celestino/Projects/blog)
/usr/local/bin/ruby -I"lib:test" "/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/unit/post_test.rb"
Loaded suite /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
..
Finished in 0.150119 seconds.
2 tests, 2 assertions, 0 failures, 0 errors
1d2ab7b0ceaf7257ff812791e06de72ef55d399a is first bad commit <<= encontrou!
commit 1d2ab7b0ceaf7257ff812791e06de72ef55d399a
Author: tinogomes <tinorj@gmail.com>
Date: Thu Jul 9 10:00:49 2009 -0300
merge with branch "comments"
:040000 040000 7d91b350196ccca684d3b2a5c080ae1b008596b5 0765b113edefb913e54f5988b0479acf93226b29 M app
:040000 040000 14379cc6be9fc281ac38ce417d6cea4177aab12a 6998002ed51932435c14dfbb79131b306816ecba M config
:040000 040000 15fbcef4d615b7a246b1f1f2c2a1ceb3ce486c21 22e2a940f1e0883311d7fcea58d1905f5c69a6e3 M db
:040000 040000 8a8d16444176d16585d1937624274abe371760c9 35ee1bd7388a5c8cfa860c0a4d26b32bf42a22a4 M test
bisect run success
celestino@macbook:~/Projects/blog (e280f57...|BISECTING)
$ git bisect reset
Previous HEAD position was e280f57... Colocando campos obrigatorios para Post
Switched to branch "master"
celestino@macbook:~/Projects/blog (master)
$ git diff 7d91b350196ccca684d3b2a5c080ae1b008596b5 0765b113edefb913e54f5988b0479acf93226b29
...
diff --git a/models/post.rb b/models/post.rb
index 512d2c4..45593df 100644
--- a/models/post.rb
+++ b/models/post.rb
@@ -1,4 +1,3 @@
class Post < ActiveRecord::Base
validates_presence_of :title
- validates_presence_of :body <<== aqui está o erro
end
diff --git a/views/comments/_form.html.erb b/views/comments/_form.html.erb
new file mode 100644
index 0000000..c174378
...
celestino@macbook:~/Projects/blog (master)
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment