setup do
#ここにコントローラのコードを書いてしまった
end
Showing posts with label shoulda. Show all posts
Showing posts with label shoulda. Show all posts
shouldaでlogin_requiedのテスト
shouldaです。
ログイン用のマクロを作った。
こういう書き方ができるのはいいすね。これはauthlogicですが、authlogic以外でも勿論できる。
でも、リダイレクト先でテストは適当すぎる…
余談ですが、ついにauthlogicがrestful_authenticationを追い越した。
ログイン用のマクロを作った。
こういう書き方ができるのはいいすね。これはauthlogicですが、authlogic以外でも勿論できる。
context "ArticlesController" do
should_require_login :get, :new
should_require_login :post, :create
should_require_login :get, :edit
should_require_login :put, :update
should_require_login :delete, :destroy
end
でも、リダイレクト先でテストは適当すぎる…
余談ですが、ついにauthlogicがrestful_authenticationを追い越した。
shouldaの結果を読みやすくするgemを作りました
shouldaでautotestしてると".FE"しか出ないのが嫌でした!なので、gemを作りました。
http://github.com/fujimura/speak_your_mind
実行結果が全部テストメソッド名で出るようにしました。例えば
を走らせると
と出てくれるようにしてあげました。
私はspecが全部字で出てくれないと心配になってしまうので、これで安心です。
元々自分用だったんですが、gemにしました。gemにすればどこでも使えるから。
中身はtest/unitの出力部分のラッパーです。コンソール用出力の部分でmediatorとか使われてて、コード追うのが大変でした。
http://github.com/fujimura/speak_your_mind
実行結果が全部テストメソッド名で出るようにしました。例えば
context "Test" do
should 'success' do
assert true
end
should 'fail' do
assert false
end
should 'error' do
raise
end
end
を走らせると
E Test should error.
F Test should fail.
. Test should success.
と出てくれるようにしてあげました。
私はspecが全部字で出てくれないと心配になってしまうので、これで安心です。
元々自分用だったんですが、gemにしました。gemにすればどこでも使えるから。
中身はtest/unitの出力部分のラッパーです。コンソール用出力の部分でmediatorとか使われてて、コード追うのが大変でした。
Subscribe to:
Posts (Atom)
Author
Archive
Labels
- actionmailer (2)
- ActionView (2)
- activerecord (5)
- Ajax (1)
- apache (2)
- authlogic (2)
- awk (2)
- bash (4)
- block (1)
- cache (1)
- capistrano (1)
- crontab (1)
- Debian (1)
- deployment (1)
- design (2)
- design pattern (1)
- exception_notifier (1)
- factory_girl (2)
- firefox (1)
- flash (1)
- git (2)
- haml (1)
- html (1)
- javascript (5)
- jQuery (3)
- life (2)
- linux (3)
- lisp (2)
- mail (1)
- migration (1)
- mysql (2)
- Passenger (2)
- prototype.js (1)
- Rails (26)
- Rails3 (1)
- rake (1)
- restful_authentication (2)
- Rspec (3)
- ruby (10)
- rubygems (1)
- screen (1)
- script/console (1)
- Security (1)
- shouda (1)
- shoulda (3)
- subversion (2)
- sudo (1)
- tdd (1)
- testing (4)
- thunderbird (1)
- UI (1)
- unix (1)
- vim (3)
- work (1)
- xargs (1)
- xss (1)
- zsh (1)