On Wed, Jan 23, 2013 at 2:54 PM, Jim Coble wrote:
> One of my tests needs to be provided with a particular directory path.
> While I can code this path as a literal directly in the test spec, it seems
> to me it might be better to have it in a configuration file somewhere so
> that I have one pl
If you declare :hsh in two peer context (neither inside the other), then
your shared group does the right thing: it demands the existence of :hsh
and blows up when it doesn't exist. Better design, no?
On Fri, Dec 21, 2012 at 9:24 AM, Arne Brasseur wrote:
> I find myself wanting to do something
On Mon, Sep 10, 2012 at 5:51 PM, Fearless Fool wrote:
> I'm trying to understand what belongs -- and what doesn't belong -- in
> controller tests and in integration tests.
>
> As a common example, assume I have a list of named widgets. Somewhere
> in my code, I want to verify that
>
> widget
On Wed, Aug 22, 2012 at 11:36 AM, David Chelimsky wrote:
> On Wed, Aug 22, 2012 at 9:16 AM, J. B. Rainsberger wrote:
> > On Wed, Aug 22, 2012 at 10:07 AM, David Chelimsky
> > wrote:
> >>
> >> On Wed, Aug 22, 2012 at 7:52 AM, J. B. Rainsberger
> wrote:
>
On Wed, Aug 22, 2012 at 10:07 AM, David Chelimsky wrote:
> On Wed, Aug 22, 2012 at 7:52 AM, J. B. Rainsberger wrote:
> > On Tue, Aug 21, 2012 at 11:37 PM, Bas Vodde wrote:
> >>
> >>
> >> JB is right.
> >>
> >> Sometimes, for clarity, it is u
On Tue, Aug 21, 2012 at 11:37 PM, Bas Vodde wrote:
>
> JB is right.
>
> Sometimes, for clarity, it is useful to add should_not, but for
> functionality it is usually not needed.
>
I know JMock has never() for this people. Should RSpec-mocks have something
like object.should_receive(:nothing).
--
On Tue, Aug 21, 2012 at 5:02 PM, Andrew Premdas wrote:
> I want to write
>
> it "should ..." do
> Client.should_not_receive(any_message)
> # do something here that might do Client.xxx
> end
>
I might be wrong, but if you use a mock object and set no expectations on
it, it will expect no mess
On Mon, Jul 23, 2012 at 10:54 PM, David Chelimsky wrote:
> I'd say, let's encourage people to use 'pending' correctly. WDYT?
+1.
--
J. B. (Joe) Rainsberger :: http://www.jbrains.ca ::
http://blog.thecodewhisperer.com
Author, JUnit Recipes
Free Your Mind to Do Great Work :: http://www.freeyourmi
On Thu, Feb 23, 2012 at 22:45, Justin Ko wrote:
> Hello, what you want is "shared examples/context":
> https://gist.github.com/1894922
I commented there, too.
--
J. B. (Joe) Rainsberger :: http://www.jbrains.ca ::
http://blog.thecodewhisperer.com
Author, JUnit Recipes
Free Your Mind to Do Great
On Tue, Jul 12, 2011 at 16:03, Derek Prior wrote:
> I'm a newcomer to the list. Appologies if this has been discussed before,
> but all I could find with regards to specing scopes relates to those that
> filter records or apply sorting. What's the best way to spec a scope that
> uses the includes
n => @encryption)
ldap.search(:filter => filter)
end
end
Now it's easy to check:
describe Collaborator do
context "when searching" do
it "should pass the proper surname to the TermRepository" do
termRepository = mock("a TermRepository")
On Sat, Jun 18, 2011 at 21:10, Karl wrote:
> Found my problem... mostly due to my misunderstanding of mocks. Joe's
> suggestion above led me down the right path. This worked:
>
> @account = mock_model(Account)
> @account.stub!(:next_serial_number).and_return(43, nil)
> Widget.any_instance.stub(:a
On Thu, Jun 9, 2011 at 14:33, Karl wrote:
> Obviously, I'm missing something very simple, can someone please
> explain how to stub an instance of an AR model method.
>
> This does not work:
> @widget = Widget.first # Widget has an instance method called
> 'next_seriel_number'
> @widget.stub(:next_
On Fri, Apr 8, 2011 at 02:52, Stefan Kanev wrote:
> Occasionally, I write specs that verify the order in which some ActiveRecord
> objects are returned. For example, in a toy project I do:
>
> Reply.stub :per_page => 2
> topic.replies_on_page(1).should == [second, first]
>
> The spec out quickly
On Wed, Dec 8, 2010 at 02:46, ssmithstone wrote:
Is it possible to spec that a model should acts_as_authentic which is
> from the authlogic gem?
>
> I'm using rspec-1.3.x
>
Whenever I don't know how to spec something -- or whether to spec something
-- I ask, "If the thing I'm worried about failed
Russell Quinn wrote:
I have the following in my fixtures:
publish_date:<%= DateTime.now.utc - 1.day %>
But 'DateTime.now.utc' always evaluates to my system time. Does anyone
have any ideas?
You might not like it, but what about fixing the date?
--
J. B. Rainsberger :: http:
On Fri, Sep 17, 2010 at 16:48, Doug E. wrote:
> I'm trying to understand BDD and proper testing technique. I'm testing
> a rails view helper method that checks user roles to see if a link
> should be shown. I'm using rails 2.3.8 and rspec version 1.3.0. My
> helper looks like this:
>
> # welcom
On Wed, Sep 8, 2010 at 14:42, Brian Kaney wrote:
> Is it good practice to call matchers from within matchers? Kinda like this
> pattern:
>
> See: http://gist.github.com/570467
David Chelimsky taught me not to invoke #should in a matcher, but
rather just answer a boolean, so I expect that, ra
On Fri, Aug 27, 2010 at 02:43, Zhenning Guan wrote:
> in real world, when user deposit money into their bank, bank have money
> and can check deposit record. so what would it be in rspec?
I prefer two specs, because you are checking two unrelated things:
bank account balance and transaction reco
On Mon, Aug 30, 2010 at 14:09, Rob Biedenharn
> And THAT is the problem with using mocks (or stubs) for this. You run the
> very real risk of specifying the implementation details in the structure of
> the spec/test. There is a problem when you've limited the refactoring that
> can be done withou
t time, I mock #destroy; and finally, if I
want to check that my code reacts appropriately after destroying an
object, then I stub #destroy. To understand some of the underlying
principles, I humbly recommend this:
http://jbrains.ca/integrated_tests_are_a_scam (The articles are in order
d, for which I write a spec. All my authorization
specs are of the form " is not permitted to do " and I
organize them by action.
--
J. B. Rainsberger :: http://www.jbrains.ca ::
http://www.thecodewhisperer.com
___
rspec-users mailing list
rspec-use
the form I expect to
submit. I imagine writing more of the latter kind of spec will encourage
me to avoid complex form submissions.
I treat view specs like any other specs: when I have a tough time
writing the spec, then I rethink my design choices.
--
J. B. Rainsberger :: http://www.jbrai
used me problems, at which point I'd separate the behavior
of deciding what to print from deciding where to print it. I find
formatting messages much easier to check, in general, than displaying them.
Have fun.
--
J. B. Rainsberger :: http://www.jbrains.ca ::
http:/
On Thu, Feb 4, 2010 at 09:40, David Chelimsky wrote:
> On Thu, Feb 4, 2010 at 8:09 AM, J. B. Rainsberger
> wrote:
>> On Thu, Feb 4, 2010 at 00:12, David Mitchell wrote:
>>
>>> What is the 'best practice' way to structure RSpec code and documentation
>>
On Thu, Feb 4, 2010 at 12:35, Levi Conley wrote:
> Thanks for the response. That's an interesting approach. I will try
> that and see how far I can get with it.
>
> If my ruby chops were a little better, I suspect I could find a more
> elegant solution. Any other ideas out there?
It sounds lik
On Thu, Feb 4, 2010 at 00:12, David Mitchell wrote:
> What is the 'best practice' way to structure RSpec code and documentation
> when testing a very large project, where the RSpec code base has to be
> maintained and extended over a long period?
I don't mean to be glib, but my blink reaction is
2010/2/3 Nicolás Sanguinetti :
> On Wed, Feb 3, 2010 at 2:07 PM, wrote:
>> I absolutely love the idea of encapsulated the daisy chained calls
>> (c_u.comp.project) into a controller methods so all i gotta do is stub that
>> out.
>
> Oooh, I hate that one :)
>
> You're adding lots of small methods
On Tue, Feb 2, 2010 at 19:00, Frank Lakatos wrote:
> Hi guys, been following for about 3 weeks, first question -
This might help a little: http://bit.ly/ONpXE
To bring things back to Rails, I use mock_model whenever I want to
design controller behavior without relying on the underlying model
be
On Tue, Feb 2, 2010 at 09:18, J. B. Rainsberger wrote:
> On Tue, Feb 2, 2010 at 07:26, Stephen Smithstone
> wrote:
>
>> cheers for the response , seem that attributes is missing from hash on my
>> system
>
> You'll find #attributes on ActiveRecord::Base, and
On Tue, Feb 2, 2010 at 07:26, Stephen Smithstone
wrote:
> cheers for the response , seem that attributes is missing from hash on my
> system
You'll find #attributes on ActiveRecord::Base, and not Hash.
Try this:
it "should create new client" do
// creates me a hash of generated values usin
On Tue, Feb 2, 2010 at 04:24, Stephen Smithstone wrote:
> A bit stuck here being new to ruby and rspec
Welcome. I hope you like the experience. Good news: we've seen what
you've done a thousand times and so it's quite easy to explain.
> it "should create new client" do
> // creates me a has
On Sun, Jan 31, 2010 at 17:02, Nick Hoffman wrote:
> One of my controller actions sends a redirect if the request URI begins
> with /foods/search
>
> 34 def search
> 35 return redirect_to "/#{params[:name]}" if
> request.request_uri.match /^\/foods\/search/
>
> Unfortunately, I can't figure
On Wed, Oct 28, 2009 at 20:46, nruth wrote:
> I'm going to put the cat amongst the pigeons here in the hope of some
> clarity falling out of the sky on me.
> My question is this: In a world with Cucumber what is the value of
> view specs?
http://blog.thecodewhisperer.com/post/207813060/two-kinds
On Wed, Oct 14, 2009 at 15:36, 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 complex_method...
> def other_complex_methods .
On 2009-09-16, at 08:08 , David Chelimsky wrote:
On Wed, Sep 16, 2009 at 3:34 AM, Ramon Tayag
wrote:
I put an expectation test, but it complains two things are different
when it prints it out in the error in the exact same way:
http://pastie.org/618481
Printing is printing. Time is _not_ t
36 matches
Mail list logo