hello all,
i am new to RoR programming and am struck with the functional test
whole checking for uniqeness of carriers. If it is not unique,the the
bin shudn't be created.Can someone help me in correcting my code.
def test_create_failure_cycle_unique
begin
num_bins = Bin.count
post :create, {:bin => { :carrier => carriers(:A), :cycle => cycles
(:one), :name => "701", :start => "1:00", :end => "1:01" }}, { :user
=> @user_id, :division => @division_id }
validates_uniqueness_of :cycles
assert_response :redirect
assert_redirected_to :action => 'list'
assert_equal num_bins + 1, Bin.count
rescue exception: NoMethodError
assert_response :error
flash[:notice]="Cycle name not unique."
end
end
1) Error:
test_create_failure_cycle_unique(BinsControllerTest):
NameError: undefined local variable or method `exception' for
#<BinsControllerTest:0x48077e0>
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
action_controller/test_process.rb:471:in `method_missing'
bins_controller_test.rb:119:in `test_create_failure_cycle_unique'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
active_support/testing/setup_and_teardown.rb:60:in `__send__'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
active_support/testing/setup_and_teardown.rb:60:in `run'
14 tests, 28 assertions, 0 failures, 1 errors
>Exit code: 1
Thanx a lot.
Regards,
cutelucks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "ruby-on-rails-programming-with-passion" group.
To unsubscribe from this group, send email to
ruby-on-rails-programming-with-passion-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/ruby-on-rails-programming-with-passion?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---