Displaying 20 results from an estimated 3000 matches similar to: "Mocking within a Proc/Block?"
2007 Sep 20
4
alias :calling :lambda
Sprinkling my examples with ''lambda'' has always seemed like a bit of a
wart to me. I''ve gotten into the habit of adding ''alias :calling
:lambda'' to my spec suites. My examples then look like:
calling { Foo }.should raise_error
calling { Bar }.should_not raise_error
Is there a reason that RSpec core has chosen not to make exception
expectations more
2008 Jan 31
4
RSpec-1.1.3
RSpec-1.1.3 has been released.
If you''re using RSpec and autotest, you''ll have to upgrade to
RSpec-1.1.3 and ZenTest-3.9.0 at the same time.
== Version 1.1.3
Maintenance release.
* Tightened up exceptions list in autotest/rails_spec. Closes #264.
* Applied patch from Ryan Davis for ZenTest-3.9.0 compatibility
* Applied patch from Kero to add step_upcoming to story listeners.
2009 Aug 17
0
Paperclip: processor proc not firing
Hi
It''s extremely rare that I have to post something on the Rails list,
but this is one of those times that I''ve been completely stuck for
countless hours.
Environment: Rails 2.3.3
I''ve implemented a custom processor proc for video thumbnailing with
Paperclip (latest trunk version as git submodule, and yes, it''s
updated) using the instructions posted
2007 Nov 01
3
autotest debugger?
Hi,
I keep facing problems with autotest, and I don''t know what''s happening
in the background, is there anyway to know what''s happening while
testing?
Example:
@user = User.new
@user.email = "testcom"
@user.errors.on(:email).should_not be_empty
...throws error failure
- You have a nil object when you didn''t expect it!
- You might have expected an
2009 May 02
10
Problem verifying routing error
Hi,
When upgrading to rspec/rspec-rails 1.2.6 gem (from 1.1.12), I''m having
a new problem verifying routes that should not exist.
This is to support something like this in routes.rb:
map.resources :orders do |orders|
orders.resources :items, :except => [:index,:show]
end
I used to use lambda {}.should_raise( routing error ), but it stopped
detecting any raised error.
2007 Dec 07
0
weird behavior of mocking ruby class methods
Hello everyone:
After I played with Rspec for three months, I realized a weird behavior of
mocking ruby classes (e.g. File).
Please let me post a sample code before I point out the problems:
#file_reader.rb (to be tested)
class FileReader
def do_read
File.read(''asd.txt'')
end
end
#file_reader_spec.rb
describe FileReader, "do_read" do
it
2007 Jul 09
12
Mocking User.find( :all, :limit => 10 )
Hi,
I''m trying to setup a mock for my controller test but I can''t get it to
recognise the mock.
I use
it "should find all users" do
User.should_receive(:find).with( :all, :limit => 10
).and_return([@user])
do_get
end
and in the controller
@users = User.find(:all, :limit => 10 )
But this does not work. It gives me
User expected :find with (:all)
2019 Aug 13
4
ORC v2 question
Hi Lang,
On Tue, 13 Aug 2019 at 22:03, Lang Hames <lhames at gmail.com> wrote:
> When you say your code is not getting optimized, do you mean that IR optimizations are not being applied, or that codegen optimizations are not being applied?
>
> What do you see if you dump the modules before/after running the pass manager on them, like this:
>
> dbgs() << "Before
2007 Nov 17
7
Down with Lambda!!
Rspec is all about using natural language to define behavior. In this
context, I feel that lambda is sorely out of place. I was chatting on
#irc and a pal of mine (wycats) proposed an interesting alternative:
alias_method :doing, :lambda
so instead of something like
lambda {post :create, {:title => nil}}.should
raise_error(ActiveRecord::RecordInvalid)
we get
doing {post :create, {:title
2007 Apr 17
1
updating textmate bundle
Just to let you know - in the textmate bundle the snippet shra =>
"Should raise error" is missing an open parenthesis. The snippet
code should be this:
lambda { $1 }.should raise_error(${2:error})
$0
and not this:
lambda { $1 }.should raise_error${2:error})
$0
Best,
Scott
2007 Nov 21
7
describe scope
Hi,
Googling ''RSpec describe scope'' didn''t yield much, so apologies if
this question has been dealt with.
It seem well known that a ruby class is ''visible'' between describes,
and if this is a problem then you should use some counter as prefix or
suffix:
''class Item_001; ... end''
Is there any work underway, or sheduled release where
2009 Mar 15
0
rspec 1.2.0 Released
rspec version 1.2.0 has been released!
Behaviour Driven Development for Ruby.
Changes:
### Version 1.2.0
WARNINGS:
* If you use the ruby command to run specs instead of the spec command, you''ll
need to require ''spec/autorun'' or they won''t run. This won''t affect you if
you use the spec command or the Spec::Rake::SpecTask that ships with
2007 Sep 05
3
Rspec Caveman questions.
Hello!
I''m just a caveman with some caveman questions.
I''ve been parsing Rspec for quite a while, and I''m writing my first series
of specs. My initial impressions are "Verbose, but understandable. Helpful
and intuitive, but so much to digest." I want to congratulate the folks who
are dedicating a chunk of their lives to writing this, and ask 2 caveman
2013 Jul 09
1
[off topic] [research] Interviews for contributors over 50 for Oregon State University research
Hello,
Researchers at Oregon State University are striving to conduct
research to learn more about the free/open source software community
landscape as it relates to older adults. We have identified you as a
leader for a free/open source software community. If you?re
interested, we will either do an in-person interview (if you are local
to the Corvallis or Portland area), or an interview over the
2007 May 20
9
How to test for exceptions
Hi folks,
I''m in the process of converting a Test::Unit functional test to RSpec, but I''ve run into a slight problem. I tried looking through the documentation but I still don''t know what I missed.
Thanks in advance,
Blake
describe VenuesController, "on update" do
before(:each) do
@venue = mock("venue")
2009 Jun 05
1
OT: Inference for R - Interview
Dear All,
Slightly off -non technical topic ( but hey it is Friday)
Following last week's interview with REvolution Computing which makes
enterprise versions of R, here is another interview with the rapidly
growing company Blue Reference CEOPaul van Eikeren at
<http://www.decisionstats.com/2009/06/04/interview-inference-for-r/>
2008 Jan 11
13
Role of stories vs specs, revisited
A couple months ago I asked how stories and specs might impact each
other. [1] If you look at Dan North''s example of what''s in a story
[2], and you imagine using the spec framework to drive the design, you
can probably imagine a significant bit of overlap in the two. Is that
a bad thing? I''m not sure. It has made me a bit uncomfortable
though, and I''ve
2008 Jan 30
9
catching errors, rspec basics
Trying to spec the following but don''t know if I''m using the right matcher.
How do I spec? Plz, sugar on tops.
Audience.stats
- should have a stats of 80 when passed a flux of 10
- should return an error when passed a string (ERROR - 1)
1)
TypeError in ''Audience.stats should return an error when passed a string''
String can''t be coerced into Fixnum
2012 Jan 15
1
NoMethodError: undefined method `expect'
Ideas?
ruby-1.9.2-p290 :002 > require ''rspec''
=> true
ruby-1.9.2-p290 :003 > RSpec::Version::STRING
=> "2.8.0"
ruby-1.9.2-p290 :004 > describe ''division by zero'' do
ruby-1.9.2-p290 :005 > expect { 2/0 }.to raise_error
ruby-1.9.2-p290 :006?> end
NoMethodError: undefined method `expect'' for
2010 Nov 02
7
Testing attr_accessible (and/or attr_protected)
I''ve been puzzling over how to test that attr_accessible has been set
for the correct columns; but the tests I''ve come up with so far seem
to fail to fail when I expect. I came across this old message from
this list:
http://www.mail-archive.com/rspec-users at rubyforge.org/msg01570.html
Which seemed like a plausible example, but my attempt (modeled on the
example)