On 19 Mar 2011, at 13:35, David Chelimsky wrote:
> On Mar 18, 2011, at 10:37 AM, Srushti Ambekallu wrote:
>
>> Hey all,
>>
>> I would like to be able to be able to have mocks where I can make all the
>> calls and assert that it was called afterwards. This would be especially
>> useful when ass
On 26 Jan 2011, at 13:34, Rob Aldred wrote:
> I'm having a bit of trouble stubbing out a method on a model which has some
> quite specific behaviour.
> Basically I want to check the method returns something different after ive
> called update_attributes
>
> eg.
>
> @exam.draft? (returns true)
If the idea of having to say 'stubs(:method)' for every method that you're
going to call and verify, give my new mocking library Matahari a go:
https://github.com/mortice/matahari
It's brand new and deficient in many ways but I'm planning on improving it and
it sounds like we appreciate the sa
Hi David,
On 3 Oct 2010, at 23:41, David Chelimsky wrote:
> These are release candidate gems for updates 1.x series, including some bug
> fixes and deprecation warnings for functionality that will be removed in
> rspec-2.
I'm having to maintain a fork of RSpec just so that I can revert the comm
On 16 Jul 2010, at 10:29, Matt Wynne wrote:
>> For those following along at home, this exact technique did not work. The
>> +actual_foo+ variable was holding some mock value instead of the real self
>> value.
> Sorry. Do we think this is a bug in rspec? I'd have expected the block to
> return th
On 13 Jun 2010, at 21:20, David Chelimsky wrote:
>> But as of http://github.com/dchelimsky/rspec/commit/386e334 (i.e. in 1.3.0)
>> it no longer works when the stub uses an argument matcher:
> Please report to http://rspec.lighthouseapp.com for rspec-1 and
> http://github.com/rspec/rspec-mocks for
Hi,
RSpec has long had the ability to set a message expectation for a stubbed
method without disrupting its (stubbed) return value. This is really helpful
for a variety of reasons, not least because it decouples the stubbed method's
return value from the expectation that the method will be call
Hi David,
On 20 Mar 2010, at 10:42, David Chelimsky wrote:
> There is an alternate syntax that I'm using nearly exclusively at this
> point, which is to pass a block along with the stub() and
> should_receive() messages:
> [...]
> I've been thinking of deprecating the and_xxx methods in rspec-2. D
On 2 Mar 2010, at 14:51, David Chelimsky wrote:
> I'm happy to announce that The RSpec Book will be updated for RSpec-2
> and Rails-3 before its final release.
Wow, this is great news. Thanks, David! I'm sure it'll be well worth the wait;
having the beta book available in the meantime gives RSpec
On 19 Jan 2010, at 13:22, David Chelimsky wrote:
> Start here: http://blog.davidchelimsky.net/2010/01/12/rspec-2-and-rails-3/
> I'll be making some more announcements about rspec-2 soon. Our goal is
> to release rspec-rails-2.0.0.a1 when rails-3.0.0.pre comes out.
Oh, that's great, thanks David. S
Hi folks,
DHH has tentatively suggested a Rails 3 beta this month, so an innocent
question: what's the plan, such as it is, for Rails 3 support in RSpec?
Personally there's no way I'll be able to move any of my applications to Rails
3 until I can run the specs.
Absent any specific information
On 14 Jan 2010, at 12:33, John Polling wrote:
> Do Rails developers generally not test things in isolation using mocking
> and stubbing?
Yes, that's what RSpec is for.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/l
On 9 Jan 2010, at 18:34, rogerdpack wrote:
> I saw some tests like this the other day:
> it "the nodes are the contents of the directory" do
In this case I say "specify" instead.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org
On 4 Jan 2010, at 22:46, Pat Maddox wrote:
> I use resource_controller, and then don't need to write controller specs
> because it's all boiler-plate. If I add any custom behavior that needs more
> focused testing than cucumber provides, I can just write a couple specs to
> cover it.
Ditto: I
On 30 Dec 2009, at 21:04, Paul Hinze wrote:
> I'm fighting with this error messages that _only_ shows up in certain
> situations that I can't quite pin down
Sounds eerily familiar:
http://yehudakatz.com/2010/01/02/the-craziest-fing-bug-ive-ever-seen/
Cheers,
-Tom
___
On 22 Dec 2009, at 11:26, Gnagno Gnagno wrote:
> it "should redirect to spanish home page" do
> get 'index'
> #don't know how to say the culture is spanish
> response.should redirect_to(spanish_home_page)
> end
How does the application detect the user's "culture"?
Cheers,
-Tom
On 18 Dec 2009, at 14:35, Ashley Moran wrote:
> The principle appears to be
> object O has sent message M => O is in state S
> followed by
> O is in state S => (expectation E met) passes spec
> O is not in state S => (expectation E met) violates spec
Can you elaborate? From a position of n
On 14 Dec 2009, at 21:28, Matt Riches wrote:
> describe Address do
> #Test Fixture - Before Each test Create a Standard Bread with the following
> attributes and properties
> before(:each) do
> @address = {
> :business_name => 'business', :first_line => '10, This Street',
> :second_
On 14 Dec 2009, at 20:36, Matt Riches wrote:
> 1) Why are my methods undefined, when they are there (I can create the object
> via script/console and call the status and reset methods and see them work)
> 2) What is the best way of resolving the issue
You'd be much better off using pastie.org to
Hi,
Is it realistic and desirable to tweak RSpec so that the MockExpectationError
for a stubbed message works as specified in the attached spec patch?
In short, we wasted some time today on a wild goose chase because a failing
expectation error was saying "unexpected arguments, expected: (#,
#
On 10 Nov 2009, at 14:08, Saverio Miroddi wrote:
> Is there a clean/simple way of stubbing the activerecord find() for a
> single instance?
MyModel.stub(:find).with(42).and_return(myModel)
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rub
On 5 Nov 2009, at 11:59, Conrad Taylor wrote:
Hi, the following page needs to be updated to use spork instead of
spec_server:
Incidentally, I strongly second David's suggestion that rspec.info be
turned into, for want of a better word, "brochureware" like
cukes.info, with all of the actual
On 21 Oct 2009, at 16:45, David Chelimsky wrote:
On Oct 19, 2009, at 2:12 PM, iain wrote:
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.
I'm not certain, but I _think_ that the problem is the w
On 29 Oct 2009, at 13:46, Stephen Eley wrote:
Everyone's busy programming. >8->
I imagine the book helps a bit, too.
Cheers,
-Tom
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
On 25 Aug 2009, at 23:39, Joaquin Rivera Padron wrote:
where you iterate over an array of known required attributes and
then generate the typical %{it 'should require required attribute'}
spec example. That's easy with shoulda, but in this case the
validations are contextual, they have the :
On 25 Aug 2009, at 20:59, Chuck Remes wrote:
The documentation says the expectation passes or fails based upon
the return value of the block. I can't even force it to fail by
returning false.
The docs (http://rspec.info/documentation/mocks/message_expectations.html
) say:
You can supply a
On 25 Aug 2009, at 18:12, Denis Haskin wrote:
The key expectation in this example is:
@discount.should_not be_available(@order)
But I changed the implementation of Discount#available? so that it
calls Order#num_products instead of Order#line_items. My examples
now fail.
Why am I havin
On 24 Aug 2009, at 18:56, Alex Chaffee wrote:
== will occasionally mysteriously fail. So my proposal remains: can
the == matcher do be_close(x, 0.01) for floats? Arguments pro
and con?
The "problem" you describe is with Ruby's == operator, not with RSpec.
The == matcher must agree with
On 21 Aug 2009, at 17:15, George Anderson wrote:
expected: Fri, 21 Aug 2009 16:08:51 UTC +00:00,
got: Fri, 21 Aug 2009 16:08:51 UTC +00:00 (using ==)
They're identical, no?
Not necessarily -- Time instances are microsecond precision, so two of
them can differ (in microseconds) but hav
On 20 Aug 2009, at 17:37, Davide Benini wrote:
Then /^I should see a flash player with "([^\"]*)"$/ do |arg1|
response.should have_selector('param', :name => 'FlashVars') do |
param|
param.should =~ /.+#{Regexp.escape("numero-1")}.+/m
end
end
I have been tweaking the regex a bit (eliminat
On 18 Aug 2009, at 20:16, Paul Mylchreest wrote:
So, taking from your book, on page 212:
[...]
I guess that is a typo, correct?
As an aside, I don't understand this section of the book ("Expecting a
Throw") at all. The original version of the loop already "short
circuits" (with return) wi
On 22 Jul 2009, at 13:57, David Chelimsky wrote:
The problem is that RSpec starts with an empty test database
Not exactly. RSpec starts with whatever database you have and rolls
back to that state after each example provided you're only using
before(:each) to set up state before each example.
Hi,
A Rails project I'm working on has, for better or worse, some data-
driven structure in its models: a few model classes need certain
values (e.g. some enumerations) to be available in the database at
load time in order for certain bits of metaprogramming to kick off
correctly. It would
Hi Chris,
On 16 Jul 2009, at 06:46, internetchris
wrote:
So would I be correct in saying that I should develop all of my spec
tests first, and then finish it up by running some cucumber tests?
You can do whatever you like. This is certainly a valid way of
working, and as a testing strateg
Hi Chris,
On 16 Jul 2009, at 04:14, Chris Sund wrote:
Can someone clarify in "simple" terms the relationship between rspec
and cucumber.
Very short answer:
RSpec is for specifying the behaviour of individual pieces of your
application, ideally in isolation from all of the other pieces. The
Hi David,
On 29 May 2009, at 12:10, David Chelimsky wrote:
Have you read "Mock Roles, not Objects"?
"its corresponding mock" suggests a single mock object for each real
implementation. There's nothing stopping you from writing your own
mock objects to play this role. IMO, this is not what a dyna
Hi,
One of the problems with mocks, as far as I can tell, is that they
might go out of sync with the real object they're mocking. Is it
possible and sane to detect this by running each spec against its
corresponding mock? Does anyone already do this?
For example: your Account object has a
On 22 Apr 2009, at 14:51, Kerstin Geiling wrote:
actually I had the same problems
I solved it now using the old task file from rspec-rails 1.2.0 and
it works.
Thanks to Tom for making this issue public!
I've opened a ticket in Lighthouse for this issue:
http://rspec.lighthouseapp.com/projec
On 20 Apr 2009, at 02:57, Michael Schuerig wrote:
I'd rather check that a particular scope is in effect for a call to
#find. Just as I said. ;-)
As is always the case with spec'ing Rails, I don't know which level of
abstraction is the right one to check, but it seems like what you're
asking
On 18 Apr 2009, at 05:08, David Chelimsky wrote:
I'm not sure that requiring environment.rb is the right solution
because it will be loaded no matter what rake task is invoked, and
that is clearly not the intent for all rake tasks.
I hate to go back to the ugly mess that was there to add either
On 17 Apr 2009, at 15:03, Tom Stuart wrote:
the bad commit is
http://github.com/dchelimsky/rspec-rails/commit/c9abdccedee97217f28e07ec824bb12cda1c9173
I don't understand what's happening to rspec.rake in this commit. In
particular, how is the "require 'spec/rake/spec
On 17 Apr 2009, at 14:56, Tom Stuart wrote:
Can I git-bisect rspec and rspec-rails independently to try to track
down the problem, or are there going to be interdependent changes
between RSpec versions 1.2.0 and 1.2.1?
I tried this anyway; the bad commit is http://github.com/dchelimsky
On 17 Apr 2009, at 11:35, David Chelimsky wrote:
So there is something different about your environment than mine.
Hm, that's weird. Thanks for trying.
What OS? Ruby version? Versions of rspec/rspec-rails installed on
the system?
I'm trying to run everything vendored, so no RSpec (or Rails
Hi,
I've been seeing the below problem since RSpec 1.2.1 on any machine
that doesn't have the RSpec gems installed. 1.2.0 was fine. I'd hoping
it would magically go away with later versions but it hasn't; does
anyone have any clues?
--
$ git clone git://github.com/rails/rails testapp/ven
On 4 Nov 2008, at 11:10, Andrew Premdas wrote:
Is there any way to do
foo.should (be_nil || be_empty)
in rspec.
"foo.should be_blank" would work if you're using Rails (i.e.
ActiveSupport is loaded).
Cheers,
-Tom
___
rspec-users mailing list
rspe
Hi,
Any responses to http://blog.caboo.se/articles/2008/11/4/we-ve-stopped-using-rspec
? How much of this is due to legitimate bugs/problems versus
unfortunate circumstances? Feels kind of worrying that they haven't
been able to make it work for them.
Cheers,
-Tom
Hi,
Going to dive into Cucumber soon, and just reading through all the
docs now.
Can anyone point to an example of writing Cucumber features first and
then "when you get down to nitty gritty details, drop down one
abstraction level and use RSpec to write some specs for your
classes" (as
On 1 Jul 2008, at 13:06, Matt Darby wrote:
When run via 'rake spec:models'
Date.today = 2008-07-01
self.start_date = 0825-09-17
self.end_date = 2008-07-02
Pretty obvious what the bug is suddenly, but would cause this?
Not a solution, but a clue:
$ ./script/console
>> Date.today.minus_with_dur
On 4 Jun 2008, at 15:14, Matt Mower wrote:
On Wed, Jun 4, 2008 at 3:06 PM, David Chelimsky
<[EMAIL PROTECTED]> wrote:
Rails 2.1 supports plugins from git.
Yep 2.1 and I used script/plugin to install from git this time. That's
new again to me since I've been using piston for quite a while (or
s
On 27 May 2008, at 12:44, andypearson wrote:
xml = REXML::Document.new Net::HTTP.get(URI.parse(feed.url))
It won't make the problem go away, but you can certainly reduce the
blizzard of intermediate stubs by pulling this chain out into its own
method (e.g. fetch_xml_from_url) and stubbin
On 27 May 2008, at 01:22, Tim Glen wrote:
whiz_banger = Object.new
whiz_banger.extend WhizBangModule
I like that as far as it goes, but I'm wondering if there's a way to
take it one step further and actually have it extend the typical
controller functionality - some of my methods make use
On 23 May 2008, at 10:56, Doug Livesey wrote:
Hi -- is there an equivalent to the anything() method to use with Hash
parameters?
FYI this was discussed in March, so you might be able to find
something useful in the list archive if you'd rather roll your own
parameter matcher than switch to
On 14 Dec 2007, at 06:36, Chris Olsen wrote:
> BTW. Has anyone heard if the pragmatic rspec book is still planned to
> be released this month?
I second this -- O'Reilly owe me a book for the November hackfest and
I'm wondering whether I should ask for a rain check until the RSpec
tome arrives
On 6 Dec 2007, at 16:56, Andy Goundry wrote:
> This is handy and keeps the view test isolated from changes to your
> models, but is that really the point?
Yes, that's part of the whole idea of using mocks. (Similarly, two
interacting models will be isolated from each other's implementation.)
>
On 5 Dec 2007, at 15:02, David Chelimsky wrote:
>> @order_address = mock_model( OrderAddress, :null_object => TRUE )
> :null_object => true (lower case) should work.
Well, I'm talking bollocks then, aren't I?
___
rspec-users mailing list
rspec-users@rub
On 5 Dec 2007, at 14:52, Al Chou wrote:
> @order_address = mock_model( OrderAddress, :null_object => TRUE )
> Mock 'OrderAddress_1026' received unexpected message :first_name
> with (no args)
> so I'm starting to wonder whether the :null_object option is doing
> anything at all
:null_obj
On 4 Dec 2007, at 15:41, Andy Goundry wrote:
> I've created the following spec test to simply ensure that the
> Account model receives a call to :new, but the spec is failing as it
> also receives a call to :save! and it isn't expecting it. I am using
> "@account = mock_model(Account)". If i
On 7 Nov 2007, at 14:49, Chris Olsen wrote:
> So now the question is, why does the data not exist in the test
> database. The country and province data inserts exist within the
> migration files, ex for countries:
As someone who knows literally nothing about how this all works, I
still feel con
On 6 Nov 2007, at 14:40, Jim Lindley wrote:
> Tom, there is likely a better path then the one I'm going down, and I
> would love to hear it. I am no RSpec expert.
Neither am I! From David's response it sounds as though there isn't a
particularly tidy way to solve this problem at the moment, so I
On 6 Nov 2007, at 14:39, David Chelimsky wrote:
>> I'm hoping that this sort of "okay, you
>> understand the basics, but NOW what?" issue is the kind of thing that
>> the hotly-anticipated RSpec book will address, because any
>> information
>> about best practice in this area is really lacking
>
On 6 Nov 2007, at 02:00, Jim Lindley wrote:
> Add an additional describe block for the class that you're including
> the module into, and then setup a genericly named object in the before
> block
[...]
>
> # page_spec.rb
> describe Page, "should include publishing features" do
> include Publishabl
Hi folks,
Can anyone share some accumulated wisdom about the best way to spec
mixins in general, and (Jamis Buck-style) ActiveRecord "concerns" in
particular?
The standard situation here is that there's a bunch of functionality,
related by concept if not by implementation, that one wants to
> Step 3: Let her open the box … no, that’s not it …
I'm ashamed to admit it, but I actually laughed out loud. (And, erm,
the step groups are cool, too.)
Thanks, David!
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailma
On 21 Oct 2007, at 11:01, Wincent Colaiuta wrote:
> Not actually a big deal; seeing as the specs don't have any side-
> effects and running them twice is harmless, and in any case getting
> rid of the nesting (putting all the specs in a single shared
> behaviour block) gets rid of the duplicate. Bu
On 15 Oct 2007, at 10:25, Wincent Colaiuta wrote:
> - The customer/client (not necessarily with any programming
> knowledge) writes the stories in a format which is (almost) plain
> text.
> - The developer then writes custom "step matchers"; where do they go?
> - How much of parsing can be genera
On 8 Oct 2007, at 18:29, David Chelimsky wrote:
> What you can do to eliminate this is go to
> vendor/plugins/rspec/lib/spec.rb and remove the following lines (at
> the end):
Great, thanks very much -- this is more than good enough for now. (It
works fine.)
Cheers,
-Tom
_
On 8 Oct 2007, at 17:26, David Chelimsky wrote:
> On Oct 8, 2007, at 11:14 AM, Scott Taylor wrote:
>> escher: ./script/spec spec/models/item_spec.rb
>>
>> Finished in 8.0e-06 seconds
>>
>> 0 examples, 0 failures
>> ./script/spec:4:in `run': wrong number of arguments (3 for 1)
>> (ArgumentError)
>>
On 16 Sep 2007, at 06:43, Pat Maddox wrote:
> You can't assign mock objects to associations.
Actually I haven't had any trouble with e.g.
@company = Company.new :name => 'BigCo'
@mock_employee = mock_model(Employee, :name => 'Pat', :[]= =>
true, :save => true)
@company.employees << @mo
On 16 Sep 2007, at 06:12, David James wrote:
> I've seen reference to an 'add' method, as in Model.add. When and
> why would I want to use it? Is it related to Model.collection.build?
Perhaps you're thinking of http://api.rubyonrails.org/classes/
ActiveRecord/Errors.html#M000960. You can use
Hi folks,
Is there any way I can call #include from within a shared behaviour
without it blowing up?:
> vendor/plugins/rspec/lib/spec/dsl/shared_behaviour.rb:48:in
> `included': private method `include' called for #
> (NoMethodError)
More detail: I have a spec/concerns directory which cont
On 1 Sep 2007, at 09:31, rupert wrote:
>> Are we planning on dumping the mock framework in favor of using
>> Mocha
> The idea has been banded around on the dev list recently
This makes me sad, because it means only one thing for the majority
of users: more hassle. So now I have to choose a mo
On 29 Aug 2007, at 14:44, David Chelimsky wrote:
> I just added a feature request for this outlining my thoughts on
> how it should work:
> Please feel free to add comments to that item in the tracker.
Thanks a lot, David, I'll read and respond to that.
In the meantime, assuming one is restrict
Hi,
I'm developing a RESTful Rails application whose code and specs are
becoming increasingly repetitive: every controller does pretty much
the same set of things (give or take the occasional twiddle), for
example, and so every controller spec is almost identical modulo some
names, constan
On 16 Jul 2007, at 12:14, Marcus Crafter wrote:
> On 16/07/2007, at 9:11 PM, Tom Stuart wrote:
>> On 16 Jul 2007, at 12:02, Marcus Crafter wrote:
>>> <% content_for :blah do %> . <% end %>
>>> It ends up in @content_for_blah, doesn't it?
> I th
On 16 Jul 2007, at 12:02, Marcus Crafter wrote:
> <% content_for :blah do %> . <% end %>
> Has anyone worked out a way to be able to access the html that's
> generated inside those blocks?
It ends up in @content_for_blah, doesn't it?
___
rspec-users
On 13 Jul 2007, at 20:31, Gregory Murphy wrote:
> I'm referring in particular to RSpec for Rails. It generates a
> number of directories in a Rails app, with a place for model specs,
> for
> example, and a rake task to run them, e.g. 'rake spec:models'. But
> there
> is no place and no task for
On 11 Jul 2007, at 17:12, Anthony Carlos wrote:
> Perhaps we need to bundle "The Elements of RSpec Style" with the
> documentation on the website. I'm happy to collect and edit
> suggestions.
I would like to enthusiastically (albeit fundamentally unhelpfully)
voice my support for this idea. Th
77 matches
Mail list logo