Hi
I am new to Rspec and try to mock my controller that looks like
def create
@friendship = current_user.friendships.build(:friend_id =>
params[:friend_id])
if @friendship.save
flash[:notice] = "Added friend."
render :text => flash[:notice]
else
flash[:error] = "Erro
Thanks guys, you really helped me a lot where to put my focus on. I will
refactor my code to have it more easily being mocked, I thought about
this at one point, but kept it for readability. Hope to get my specs up
running soon.
--
Posted via http://www.ruby-forum.com/.
Well, I'm still looking for a solution.
Best regards,
Christoph
On Sep 5, 2009, at 5:32 PM, Yury Kotlyarov wrote:
I have just the same problem. Any suggestion?
TIA,
Yury
Christoph Schiessl wrote:
I've created a small application to demonstrate the problem in more
det
trace
undefined method `let' for #
Some kind of workaround to make this work would be really nice. Is this usage
of `let` supported at all?
Thx & best regards,
Christoph
PS: I'm using rspec 2.0.1, rails 3.0.1 and ruby 1.8.7.
___
rspec-us
e from backtrace
undefined method `let' for #
Some kind of workaround to make this work would be really nice. Is this usage
of `let` supported at all?
Thx & best regards,
Christoph
PS: I'm using rspec 2.0.1, rails 3.0.1 and ruby 1.8.7.
__
ilure/Error: Allocation.on_day(start_of_day + 3.hours).should == "result"
NoMethodError:
undefined method `includes_values' for "result":String
I'm using Rails 3.0.4 and RSpec 2.5 (latest versions).
Best regards,
Christoph Schiessl
ot; }
end
However, (1) is passing and (2) is failing. Output as before:
>> Failure/Error: Allocation.on_day(start_of_day + 3.hours).should == "result"
>> NoMethodError:
>> undefined method `includes_values' for "result":String
Any ideas?
Best regards,
So...
I settled for testing with message expectations without return values. Guess
that's good enough for now. Thank you anyway!
Best regards,
Christoph Schiessl
On Feb 15, 2011, at 21:34 , Justin Ko wrote:
>
>
> On Feb 15, 11:14 am, Christoph Schiessl wrote:
>> Thanks
I have two models in a has_many relationship. The parent model
(Invoice) accepts the attributes for it's children (InvoiceItem).
The models and the associated controller (InvoicesController) are
absolutely standard stuff. This is the significant part of the model
code:
class Invoice < ActiveReco
opy and paste):
git clone git://github.com/cs/nested_attributes_spec_demo.git
cd nested_attributes_spec_demo
rake db:migrate
rake db:test:clone
rake spec
On Aug 23, 2009, at 1:57 PM, Matt Wynne wrote:
On 23 Aug 2009, at 10:51, Christoph Schiessl wrote:
I have two models in a has_many relations
users
Your controller is okay.
Try to change your test like this:
it "should assign an instance variable" do
City.should_receive(:new).and_return(@city = mock_model(City))
get 'new'
assigns[:city].should == @city
end
That way, you are comparing the same
wn mocking that you
have to use. (This is fixed now and rspec plays very nice with mocha,
great)
regards
christoph
On 9/3/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I've talked this over w/ a couple of the other committers and we've
> decided th
On 9/5/07, Steven R. Baker <[EMAIL PROTECTED]> wrote:
> Wilson Bilkovich wrote:
> > On 9/5/07, Christoph Sturm <[EMAIL PROTECTED]> wrote:
> >> One thing is clear, mocha is much nicer than the integrated mocking,
> >> nicer syntax, better errormessages, be
t's already
> there waiting for them.
>
> Chris Pratt
>
>
> On 9/6/07, Christoph Sturm <[EMAIL PROTECTED]> wrote:
> >
> > On 9/5/07, Steven R. Baker <[EMAIL PROTECTED]> wrote:
> > > Wilson Bilkovich wrote:
> > > > On 9/5/07, Ch
14 matches
Mail list logo