ih kerasa intuitif bgt jg ya pesan pesan codes nya :-)
jadi enak ni punya pilihan2x suka2x.
On 08/04/2008, Widi Harsojo <[EMAIL PROTECTED]> wrote:
> require File.dirname(__FILE__) + '/../test_helper'
>
> class EntryTest < Test::Unit::TestCase
> fixtures :entries
>
> context "Entries" do
> def setup
> # code to be run before all test methods
> end
>
> should "a.not save new record without user_id" do
> new_entry = Entry.new(:user_id => nil, :text => 'x'*100)
> assert_equal false, new_entry.save
> end
>
> ....
> ....
> end
>
> result!
>
> rake test:units
> (in C:/rails/tw)
> c:/ruby/bin/ruby -Ilib;test
> "c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/
> rake_test_loader.rb" "test/unit/entry_test.rb"
> "test/unit/invitations_test.rb"
> Loaded suite
> c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader
>
> Started
> F......FE
> Finished in 0.391 seconds.
>
> 1) Failure:
> test: Entries should a.not save new record without user_id. (EntryTest)
> [./test/unit/entry_test.rb:13
> C:/rails/tw/vendor/plugins/shoulda/lib/shoulda/gem/shoulda.rb:190
> C:/rails/tw/vendor/plugins/shoulda/lib/shoulda/gem/shoulda.rb:190]:
> <false> expected but was
> <true>.
>
> 2) Failure:
> test: Invitations should c.not save new record with email password excedd 64
> cha
> r. (InvitationsTest)
> [./test/unit/invitations_test.rb:24
> C:/rails/tw/vendor/plugins/shoulda/lib/shoulda/gem/shoulda.rb:190
> C:/rails/tw/vendor/plugins/shoulda/lib/shoulda/gem/shoulda.rb:190]:
> <false> expected but was
> <true>.
>
> 3) Error:
> test: Invitations should d.not save new record without user.
> (InvitationsTest):
> ActiveRecord::StatementInvalid: Mysql::Error: #23000Column 'user_id' cannot
> be n
> ull: INSERT INTO ....
> ./test/unit/invitations_test.rb:30
> C:/rails/tw/vendor/plugins/shoulda/lib/shoulda/gem/shoulda.rb:190
> C:/rails/tw/vendor/plugins/shoulda/lib/shoulda/gem/shoulda.rb:190
>
> 9 tests, 8 assertions, 2 failures, 1 errors
> rake aborted!
> Command failed with status (1): [c:/ruby/bin/ruby -Ilib;test
> "c:/ruby/lib/r...]
>
> (See full trace by running task with --trace)
>
>
>
> On 4/8/08, Widi Harsojo <[EMAIL PROTECTED]> wrote:
> > Kebetulan lagi dapet kerjaan nge-test program rails, tadinya mo make RSpec
> > eeeee, check di rubyinside malah nyoba-in shoulda
> > ("http://giantrobots.thoughtbot.com/")
> >
> > nice and apalagi ada macro2nya jadi codenya dikiiiiit banget he he he....
> >
> > apalagi yang ngerasa standard test di rails kebanyakan underscore,
> > RSpec terlalu .......
rspec terlalu gampang ya? :-P Emang pada nggak salah tuh semua, rspec
cuman buat mainan anak-anak -_-
> > http://mtnwestrubyconf2008.confreaks.com/12saleh.html
> >
> > Best Regards,
> > Widi Harsojo
--
blog: http://tinyurl.com/2bjgvn,
ruby: http://www.ruby-lang.org/id/about
"Developer Time is expensive...
Servers are cheap...", Ezra Zygmuntowicz - Merb