Error: can't convert Rspec::Mocks::Mock to String

Hello *,
I started today to test rspec current beta with ruby 1.9.2 and rails
3.0. I created a basic app with a scaffold. I am experiencing a lot of
failures in the geneated controller spec. I am pasting the complete
error string:

can’t convert Rspec::Mocks::Mock to String (Rspec::Mocks::Mock#to_str
gives Rspec::Mocks::Mock)

This is my current rspec gems setup:

rspec (2.0.0.beta.8)
rspec-core (2.0.0.beta.8)
rspec-expectations (2.0.0.beta.8)
rspec-mocks (2.0.0.beta.8)
rspec-rails (2.0.0.beta.8)

Of course no error is raised using ruby 1.9.1 or 1.8.7
Am I missing something?

regards
Andrea

On May 3, 2010, at 6:06 AM, andrea longhi wrote:

Andrea
I see the same error (hadn’t run against 1.9.2 in a while). Reported to
http://github.com/rspec/rspec-rails/issues/issue/41

On 3 Mag, 14:14, David C. removed_email_address@domain.invalid wrote:

I see the same error (hadn’t run against 1.9.2 in a while). Reported tohttp://github.com/rspec/rspec-rails/issues/issue/41

Thanks David.
I added this to my spec_helper.rb file

Rspec::Mocks::Mock.module_eval do
alias to_str to_s
end

and now it seems to work properly with no side effects, at least for
now

regards

Andrea

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

Sponsor our Newsletter | Privacy Policy | Terms of Service