I have a function that returns the true / false Ruby type. For some reason I cant get rspec to swallow this. This errors out: user.authorize.should == true (where user.authorize in the debugger does return true.... so this test should succeed) With this error (this seems to be a syntax error, not a failed test... it gives me not even the failing line in my rspec test code) /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-expectations-2.0.0.beta.22/lib/rspec/expectations/fail_with.rb:29:in `fail_with'': expected: true, (RSpec::Expectations::ExpectationNotMetError) got: false (using ==) This is the ugly backtrace: /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-expectations-2.0.0.beta.22/lib/rspec/expectations/fail_with.rb:29:in `fail_with'': expected: true, (RSpec::Expectations::ExpectationNotMetError) got: false (using ==) from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-expectations-2.0.0.beta.22/lib/rspec/matchers/operator_matcher.rb:39:in `fail_with_message'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-expectations-2.0.0.beta.22/lib/rspec/matchers/operator_matcher.rb:61:in `__delegate_operator'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-expectations-2.0.0.beta.22/lib/rspec/matchers/operator_matcher.rb:51:in `eval_match'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-expectations-2.0.0.beta.22/lib/rspec/matchers/operator_matcher.rb:29:in `block in use_custom_matcher_or_delegate'' from /Users/DK/Documents/ror/projects/wavelineup3/spec/models/user_spec.rb:32:in `block (2 levels) in <top (required)>'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/example_group.rb:130:in `module_eval'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/example_group.rb:130:in `subclass'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/example_group.rb:117:in `describe'' from /Users/DK/Documents/ror/projects/wavelineup3/spec/models/user_spec.rb:12:in `block in <top (required)>'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/example_group.rb:130:in `module_eval'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/example_group.rb:130:in `subclass'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/example_group.rb:117:in `describe'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/extensions/object.rb:7:in `describe'' from /Users/DK/Documents/ror/projects/wavelineup3/spec/models/user_spec.rb:3:in `<top (required)>'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in `load'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in `block in load'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:227:in `load_dependency'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in `load'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/configuration.rb:308:in `block in load_spec_files'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/configuration.rb:308:in `map'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/configuration.rb:308:in `load_spec_files'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/command_line.rb:18:in `run'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/runner.rb:36:in `run_in_process'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/runner.rb:27:in `run'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/bin/rspec:3:in `<top (required)>'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/bin/rspec:19:in `load'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/bin/rspec:19:in `<main>'' rake aborted! Command failed with status (1): [/Users/DK/.rvm/rubies/ruby-1.9.2-p0/bin/ru...] (See full trace by running task with --trace) Thanks, David -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ok, so it looks like the failure is the failure of the test, but why does rspec complain so much and not just give me a failed test and the line of failure instead of crashing? I''m pretty confused. On Tue, Oct 5, 2010 at 3:03 PM, David Kahn <dk-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org>wrote:> I have a function that returns the true / false Ruby type. For some reason > I cant get rspec to swallow this. > > This errors out: > user.authorize.should == true > (where user.authorize in the debugger does return true.... so this test > should succeed) > > With this error (this seems to be a syntax error, not a failed test... it > gives me not even the failing line in my rspec test code) > /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-expectations-2.0.0.beta.22/lib/rspec/expectations/fail_with.rb:29:in > `fail_with'': expected: true, (RSpec::Expectations::ExpectationNotMetError) > got: false (using ==) > > > > This is the ugly backtrace: > /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-expectations-2.0.0.beta.22/lib/rspec/expectations/fail_with.rb:29:in > `fail_with'': expected: true, (RSpec::Expectations::ExpectationNotMetError) > got: false (using ==) > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-expectations-2.0.0.beta.22/lib/rspec/matchers/operator_matcher.rb:39:in > `fail_with_message'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-expectations-2.0.0.beta.22/lib/rspec/matchers/operator_matcher.rb:61:in > `__delegate_operator'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-expectations-2.0.0.beta.22/lib/rspec/matchers/operator_matcher.rb:51:in > `eval_match'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-expectations-2.0.0.beta.22/lib/rspec/matchers/operator_matcher.rb:29:in > `block in use_custom_matcher_or_delegate'' > from > /Users/DK/Documents/ror/projects/wavelineup3/spec/models/user_spec.rb:32:in > `block (2 levels) in <top (required)>'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/example_group.rb:130:in > `module_eval'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/example_group.rb:130:in > `subclass'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/example_group.rb:117:in > `describe'' > from > /Users/DK/Documents/ror/projects/wavelineup3/spec/models/user_spec.rb:12:in > `block in <top (required)>'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/example_group.rb:130:in > `module_eval'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/example_group.rb:130:in > `subclass'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/example_group.rb:117:in > `describe'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/extensions/object.rb:7:in > `describe'' > from > /Users/DK/Documents/ror/projects/wavelineup3/spec/models/user_spec.rb:3:in > `<top (required)>'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in > `load'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in > `block in load'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:227:in > `load_dependency'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in > `load'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/configuration.rb:308:in > `block in load_spec_files'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/configuration.rb:308:in > `map'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/configuration.rb:308:in > `load_spec_files'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/command_line.rb:18:in > `run'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/runner.rb:36:in > `run_in_process'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/runner.rb:27:in > `run'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/bin/rspec:3:in > `<top (required)>'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/bin/rspec:19:in > `load'' > from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/bin/rspec:19:in > `<main>'' > rake aborted! > Command failed with status (1): > [/Users/DK/.rvm/rubies/ruby-1.9.2-p0/bin/ru...] > > (See full trace by running task with --trace) > > > > Thanks, > > David >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
David Kahn wrote:> I have a function that returns the true / false Ruby type. For some > reason I > cant get rspec to swallow this. > > This errors out: > user.authorize.should == true[...] You normally want to use .should be_true (and .should be_false). Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> You normally want to use .should be_true (and .should be_false).Right, I just changed things back but now get this error: undefined local variable or method `be_true'' for #<Class:0x2a2d710> (NameError) Now, if I do it with .should == true, I have verified that the problem is that this test is failing: user.authorize(''user_sessions'', ''create'')[:success].should be_true Many pass before it. But the only way I got to this is trial and error and going line by line until it failed. Which really really sucks. What I do not understand is why the whole rake task / test suite is failing (seems to be crashing) when this line fails. I am used to getting: ............................... Finished in 1.92 seconds 31 examples, 1 failures DKMac:wavelineup3 DK$ Instead of this vomit: DKMac:wavelineup3 DK$ rake spec ... /Users/DK/Documents/ror/projects/wavelineup3/spec/models/user_spec.rb:14:in `block (2 levels) in <top (required)>'': undefined local variable or method `be_true'' for #<Class:0x2ae0130> (NameError) from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/example_group.rb:130:in `module_eval'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/example_group.rb:130:in `subclass'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/example_group.rb:117:in `describe'' from /Users/DK/Documents/ror/projects/wavelineup3/spec/models/user_spec.rb:12:in `block in <top (required)>'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/example_group.rb:130:in `module_eval'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/example_group.rb:130:in `subclass'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/example_group.rb:117:in `describe'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/extensions/object.rb:7:in `describe'' from /Users/DK/Documents/ror/projects/wavelineup3/spec/models/user_spec.rb:3:in `<top (required)>'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in `load'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in `block in load'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:227:in `load_dependency'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in `load'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/configuration.rb:308:in `block in load_spec_files'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/configuration.rb:308:in `map'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/configuration.rb:308:in `load_spec_files'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/command_line.rb:18:in `run'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/runner.rb:36:in `run_in_process'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/runner.rb:27:in `run'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/gems/rspec-core-2.0.0.beta.22/bin/rspec:3:in `<top (required)>'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/bin/rspec:19:in `load'' from /Users/DK/.rvm/gems/ruby-1.9.2-p0@wavelineup3/bin/rspec:19:in `<main>'' rake aborted! Command failed with status (1): [/Users/DK/.rvm/rubies/ruby-1.9.2-p0/bin/ru...] (See full trace by running task with --trace) DKMac:wavelineup3 DK$ On Tue, Oct 5, 2010 at 3:38 PM, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> David Kahn wrote: > > I have a function that returns the true / false Ruby type. For some > > reason I > > cant get rspec to swallow this. > > > > This errors out: > > user.authorize.should == true > [...] > > You normally want to use .should be_true (and .should be_false). > > Best, > -- > Marnen Laibow-Koser > http://www.marnen.org > marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.