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/.
On Wed, Oct 21, 2009 at 1:12 PM, Carl Graff wrote:
>
> In truth, due to my inexperience and confusion, mocks seem to slow my
> development more than just creating real objects. But since there has been
> so much effort to put these into testing frameworks, I think it must be
> important to try and
On Wed, Oct 21, 2009 at 1:07 PM, Alexander Seidl wrote:
>
> But why does this filter prevents the index action from being executed?
Because returning 'false' from a filter does exactly that: it prevents
the execution of the controller action.
I'll bet I know what you're thinking -- you're thinki
Hi Carl,
Some thoughts below...
On 21 Oct 2009, at 18:12, Carl Graff wrote:
Well i just started using RSpec about a week ago and mostly I was
just trying to learn how to use mocks as I could have easily just
created the real object in this case.
Anyway, I had a real object, that needed to
On 21 Oct 2009, at 17:31, Elza wrote:
How can I spec the 3rd line of my controller?
What does that method do to the other objects in your domain? Can you
describe that behaviour easily using mocks and stubs?
If not, you would be best to move the method out of the controller and
onto an
Pat Maddox wrote:
> On Wed, Oct 21, 2009 at 3:58 AM, Alexander Seidl
> wrote:
>> hi pat,
>> thats all of the code that will be executed in
>> categories_controller_spec.rb. the rest is commented out.
>
> Looks like this may be the same issue as the other thread. You didn't
> show all the code,
Well i just started using RSpec about a week ago and mostly I was just
trying to learn how to use mocks as I could have easily just created the
real object in this case.
Anyway, I had a real object, that needed to contain a hash of a yet to
be created object, which itself contained a hash of a
How can I spec the 3rd line of my controller?
update_successful, error_msg = update_channels_association
def create
@user = User.new(get_param(:user, :hash))
if @user.save
update_successful, error_msg = update_channels_association
set_flash_if update_successful,
:resource_s
im repeating this message here in the mailing list with an email.
i already answered the message at http://www.ruby-forum.com,
but it seems that delivering messages via
http://www.ruby-forum.com lasts way too long, so i write an email to the mailing list.
hi pat,
thats all of the code that wil
On Oct 19, 2009, at 2:12 PM, iain wrote:
Hi all!
I'm testing some named scopes. I use be_all(&:some_predicate) to test
if all the elements in the collection are valid, which works, but when
I try to test the inverse, it fails.
You can see the complete code at: http://gist.github.com/213636
B
On Oct 21, 2009, at 8:08 AM, Tom Hoen wrote:
My site allows users to change the backround color (among other
things) for their page. These values are stored in database.
Their choices (or the default) are placed on the page using a
block at the end of the block in the layout. Here
On Wed, Oct 21, 2009 at 3:58 AM, Alexander Seidl wrote:
> hi pat,
> thats all of the code that will be executed in
> categories_controller_spec.rb. the rest is commented out.
Looks like this may be the same issue as the other thread. You didn't
show all the code, because there's an unknown UserC
On Wed, Oct 21, 2009 at 6:56 AM, Alexander Seidl wrote:
> I started a new test: Have a look at my new code:
> http://pastie.org/663455
>
> 1) The categories_controller is NOT called from the test!
>
> 2) I created another example with a message_controller and associated
> tests. There, the control
My site allows users to change the backround color (among other things) for
their page. These values are stored in database.
Their choices (or the default) are placed on the page using a block
at the end of the block in the layout. Here is what the style block
looks like.
<% if !!
Its definitly that line that causes trouble:
class User::CategoriesController < UserController
^
...
end
If i change it to:
class User::CategoriesController < ActionController::Base
^^^
...
en
David Chelimsky wrote:
> On Wed, Oct 21, 2009 at 7:19 AM, Alexander Seidl
> wrote:
>
>> http://pastie.org/663143. The test still failes. But it shouldn't!
>>
> Rails version?
> Ruby version?
> OS?
> etc
BTW :)
The second example with the message_controller is copied from your
Book^^
Cheers,
Al
David Chelimsky wrote:
> On Wed, Oct 21, 2009 at 7:19 AM, Alexander Seidl
> wrote:
>
>> http://pastie.org/663143. The test still failes. But it shouldn't!
>>
> Rails version?
> Ruby version?
> OS?
> etc
:( Really sorry for triple answer. But my mind is weakened by all this
RAILS_GEM_VERSION = '2
David Chelimsky wrote:
> On Wed, Oct 21, 2009 at 7:19 AM, Alexander Seidl
> wrote:
>
>> http://pastie.org/663143. The test still failes. But it shouldn't!
>>
> Rails version?
> Ruby version?
> OS?
> etc
Sorry,
forgot OS:
alexand...@alexanders-desktop:$ lsb_release -a
No LSB modules are available
David Chelimsky wrote:
> On Wed, Oct 21, 2009 at 7:19 AM, Alexander Seidl
> wrote:
>
>> http://pastie.org/663143. The test still failes. But it shouldn't!
>>
> Rails version?
> Ruby version?
> OS?
> etc
Hi David,
alexand...@alexanders-desktop:$ gem list -l rspec
*** LOCAL GEMS ***
rspec (1.2.9
I started a new test: Have a look at my new code:
http://pastie.org/663455
1) The categories_controller is NOT called from the test!
2) I created another example with a message_controller and associated
tests. There, the controller IS called!
You can see that, because the puts statement produce
On 21 Oct 2009, at 09:46, Pat Maddox wrote:
Response written as I go through the slides, and late at night under
sleep deprivation ;)
Seems fitting, I wrote them under the exact same conditions =)
* 57 juicy slides in half an hour? Damn dude.
Well, might have had about 45-50 mins, but the
On Wed, Oct 21, 2009 at 7:19 AM, Alexander Seidl wrote:
> David Chelimsky wrote:
> > [...]
> > Please quote at least the relevant part of the previous email when you
> > respond
> > [...]
> yes ok, i'll keep that in mind.
>
> > If you reverse lines 6 and 7 on http://pastie.org/663143, the example
David Chelimsky wrote:
> [...]
> Please quote at least the relevant part of the previous email when you
> respond
> [...]
yes ok, i'll keep that in mind.
> If you reverse lines 6 and 7 on http://pastie.org/663143, the example
> _should_ pass, so I'm a bit mystified.
I changed this two lines. Pleas
On Wed, Oct 21, 2009 at 6:12 AM, Alexander Seidl wrote:
> hi ben,
> no impact, same result.
>
> cheers,
> Alexander
Please quote at least the relevant part of the previous email when you
respond. I can get the context if I'm looking at mail in a web browser. Not
so much on my phone.
If you reve
hi ben,
no impact, same result.
cheers,
Alexander
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
hi pat,
thats all of the code that will be executed in
categories_controller_spec.rb. the rest is commented out.
i use the newest version of both gems? could that be a bug. which
versions of rpsec and rspec-rails do you use?
alexand...@alexanders-desktop:$ gem list -l rspec
*** LOCAL GEMS ***
2009/10/21 Alexander Seidl
> Alexander Seidl wrote:
> > i call current_user in the index-method, but the test fails and says:
> > "# expected :current_user with
> > (any args) once, but received it 0 times"
> >
> > Why?
>
>
Try putting line 7 before line 6.
Cheers,
Ben
__
Alexander Seidl wrote:
> i call current_user in the index-method, but the test fails and says:
> "# expected :current_user with
> (any args) once, but received it 0 times"
>
> Why?
i forgot "get :index" in test. but anyways, no impact. same result.
http://pastie.org/663143
--
Posted via http://
i call current_user in the index-method, but the test fails and says:
"# expected :current_user with
(any args) once, but received it 0 times"
Why?
Attachments:
http://www.ruby-forum.com/attachment/4166/pastie-663143.rb
--
Posted via http://www.ruby-forum.com/.
_
On Mon, Oct 12, 2009 at 6:26 PM, Scott Taylor wrote:
>
> On Oct 12, 2009, at 9:14 PM, David Chelimsky wrote:
>
>> On Oct 12, 2009, at 9:37 PM, Sam Woodard wrote:
>>
>>> I have an interesting setup: I am using rspec for mocking but I have
>>> mocha installed which give me access to any_instance, e
or check out fixjour (http://github.com/nakajima/fixjour/) which is
better imo because it has a better API and fewer surprises
(associations in factory girl always confuse me)
Pat
On Mon, Oct 5, 2009 at 3:32 AM, Mithun Perera wrote:
> Hi
> please any body can help me to learn the basics of Facto
Response written as I go through the slides, and late at night under
sleep deprivation ;)
* 57 juicy slides in half an hour? Damn dude.
* Not a fan of the "defining an interface" service example. A single
method named #query that accepts a string that appears to have the
real command is not much
Is this all of the code, or did you remove some stuff? I copied the
code in a new rails app and the test passed. What versions of rspec &
rspec-rails are you running?
Pat
On Tue, Oct 20, 2009 at 5:23 AM, Alexander Seidl wrote:
> http://pastie.org/pastes/661816
>
> hi,
> please have a look at m
user = mock('user')
controller.stub(:current_user).and_return user
friendships_proxy = mock('friendships proxy')
user.stub(:friendships).and_return friendships_proxy
friendship = mock('friendship')
friendhips_proxy.stub(:build).and_return friendship
Try to avoid chains like this. Makes the test s
On 21 Oct 2009, at 08:41, Pat Maddox wrote:
wait why do you want to do this?? Just use a regular hash and do
state-based assertions on it. Or determine the role that this
hash-like thing is doing, and use a mock to define a proper interface.
Ashley's solution works but I am very skeptical tha
wait why do you want to do this?? Just use a regular hash and do
state-based assertions on it. Or determine the role that this
hash-like thing is doing, and use a mock to define a proper interface.
Ashley's solution works but I am very skeptical that the approach is
a good one. Can you post som
On 21 Oct 2009, at 06:40, Christoph wrote:
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[
Break your object up. It's too big.
On Wed, Oct 14, 2009 at 12:36 PM, Joaquin Rivera Padron
wrote:
> hello there,
> how do you tipically spec private methods? The thing is Ï have something
> like this:
>
> def some_method
> complex_method + other_complex_methods
> end
>
> private
> def comple
38 matches
Mail list logo