In RSpec 1 there is formatter option which lets you output just
failing examples (named `failing_examples`)
http://rspec.info/documentation/tools/spec.html
I've been googling and looking for alternative for RSpec2
and wasn't able to find anything. Most likely I'm just missing
something since it se
So previously it seems it was possible to configure global before block which
will get run, say only for controller specs (people even used that I
think
http://stackoverflow.com/questions/590100/setting-the-http-referer-in-a-global-beforeall-in-rspec/592219#592219
)
Now I wasn't able to find anyt
My 2cents: while upgrading my test suite I replaced all such cases with just
it { should render_template("layouts/application") }
Worked for me.
On Mon, Sep 6, 2010 at 7:40 PM, Amiruddin Nagri wrote:
> Hello,
>
> I am trying to assert that my controller is rendered with particular layout
> file
Typical Ruby gotcha:
God.transaction do
puts mad.nil?# mad is instance method of God and returns
BelongsToAssociation here
if mad.nil?
puts 'some thing exctue here'
mad = you.mad # Ruby sees mad local variable definition
end
puts mad.nil?# mad is
Use `response.should render_template("main")` to set assertion on
template that should be rendered for an action.
If it fails it will print you the list of templates that got actually rendered.
Also I guess you should show us your PagesController#main action,
seems like what you get there is an em
update_attributes [1] doesn't raise any exception when you try to
assign the attribute which is protected with
`attr_accessible/attr_protected` machinery (only warning in log is
printed).
So your options are:
1. perform update_attributes for an attribute and then assert that the
attribute didn't c
> I suppose I need to be careful that the attribute change was rejected
> for some other reason (bad data, for example). But that's true of any
> example/test.
Good catch, that's why I think the Shoulda approach makes sense (since
otherwise you're duplicating the Rails test suite which is supposed
Not sure why helper_method doesn't work, but just `helper` definetely
works for us
https://github.com/rails/rails/blob/master/actionpack/lib/abstract_controller/helpers.rb#L96
(supports various ways to specify desired helper).
+1 on question about Rails including all helpers vs. RSpec doing it
the
Not sure on how to do that with Steak but you must be looking to
include Rails.application.routes.url_helpers
somewhere, with vanilla RSpec it would be
describes 'included helpers' do
include Rails.application.routes.url_helpers
...
end
On Fri, Nov 12, 2010 at 8:42 PM, Steve wrote:
> I'm wri
I still have a nil error when trying to call
> host_with_port on the request object inside url_for, but I think that
> is related to my app having subdomains, and trying to use those with
> capybara.
>
> On Nov 12, 2:56 pm, Evgeniy Dolzhenko wrote:
>> Not sure on how to do tha
wrote:
> That didn't seem to change anything. I'll have to keep playing with
> it, but if you have any other thoughts I'm all for it.
>
> On Nov 13, 5:53 am, Evgeniy Dolzhenko wrote:
>> Hm, make sure you have something like
>>
>> MySuperApp::Applica
render_template matcher is to be used after the view is rendered.
In your case something like
view.stub!(:render).with(:partial => "event_list", :locals =>
{:calendar => @calendar})
should do the trick
On Tuesday, November 16, 2010, Matt Darby wrote:
> I've been looking for the definitive answe
I'm sorry for introducing the confusion, but `view.stub!(:render)` won't work,
I should've read the list more attention
http://groups.google.com/group/rspec/browse_thread/thread/1590942f2827f55
On Wed, Nov 17, 2010 at 10:01 AM, Evgeniy Dolzhenko wrote:
> render_template mat
https://rails.lighthouseapp.com/projects/8994/tickets/5805-assert_recognizes-does-not-support-constraints
anyone?
On Wed, Nov 24, 2010 at 5:12 AM, jrbruce wrote:
> I'm trying to constrain access to admin routes in my application to
> either www or canonical. I need the custom constraint in
> root
Speaking of `controller.controller_name`: inside of the view spec
controller is an instance of TestController and
`controller.controller_name` and `controller.action_name` won't return
you anything useful.
Though RSpec tries to help us here a little bit by inferring
`controller.controller_path` and
Unfortunately no that I know of, though it shouldn't be very hard to
write a script for that which will rely on running corresponding
generators with `-s, [--skip]` options which makes the generator skip
already existing files.
On Sun, Nov 21, 2010 at 4:07 AM, Volkan Unsal wrote:
> I want to gene
I would just compare the size. Or you can get the MD5 and compare that
to be 100% sure, and avoid the ugly diff too.
On 12/10/2010 6:56 PM, Matt Wynne wrote:
Hello folks,
I'm writing some tests for file upload code. The files are binary, images
mostly. I'm futzing around a bit, trying to figu
You need to pass :id param as well to get the route recognized:
describe "GET 'show'" do
it "should be successful" do
get 'show', :id => '55'
response.should be_success
end
end
On 1/7/2011 8:34 PM, Volkan Unsal wrote:
I am new Rspec and just s
+1, interested in the solution as well. We have the same issue with
controller specs/Shoulda, e.g.:
describe 'GET google_apps (with invalid credentials)' do
before do
...
get :google_apps
end
it { should respond_with(:ok) }
it { should render_template("sessions/new
You can pass a block to `have_selector` to nest your assertions, like:
response.should have_selector("td", :class => "status") do |td|
td.to_s.should == /moribund/i # => td is [#,
...] here
end
On 1/25/2011 12:19 AM, Fearless Fool wrote:
I'm hooked on RSpec after my first taste (thanks t
I wish it would, but no, it won't due to the nature of how Webrat
have_selector matcher works (it uses XPath queries behind the scenes)
On 1/25/2011 11:18 PM, Nick wrote:
Whoops, let me fix that:
Would replacing
:content => "moribund"
with
:content => /moribund/i
work?
__
Do you need the full source code of an example in the log output, or
just a description?
On 1/30/2011 12:16 PM, Tom H. wrote:
This was asked back in 2008 but I'm wondering if there is an easier way
with rspec2 and rails. Seems like it would make my test log much more
meaningful. Surely somebody
RSpec.configure do |c|
c.before do |m|
Rails.logger.debug "==> #{m.example.full_description}"
end
end
Cheers
On 1/30/2011 2:00 PM, Tom H. wrote:
Evgeniy Dolzhenko wrote in post #978481:
Do you need the full source code of an example in the log output, or
just a descr
Btw. there is also before(:suite), and working from there wouldn't it
make sense to have
1. before(:suite)
2. before(:group)
3. before(:example)
which would reflect the hierarchy of RSpec run (i.e. suite > group >
example).
Anyway likely it's too late to introduce something like this, just m
By default Rails provides these task to test_unit tests:
> rake -T
rake test:recent # Run tests for
recenttest:prepare / Test recent changes
rake test:uncommitted# Run tests for
uncommittedtest:prepare / Test changes since last checkin (only
Just tested the debugger statement from controller and it worked as it
should
I'm using the latest RSpec gems, have this in my Gemfile:
group :development do
platforms :mri_18 do
gem "ruby-debug"
end
platforms :mri_19 do
gem "ruby-debug19", :require => "ruby-debug"
end
end
and
You need to change a few syntax-related things, please check the group
archives this thread specifically
http://groups.google.com/group/rspec/browse_frm/thread/7e0232e668c679cc
(also linked from there
http://snyderscribbles.blogspot.com/2011/01/rspec-2-changes-from-rspec-1.html
)
On 3/2/2011
If your question is related to "JSpec JavaScript Testing Framework"
this is the wrong group to post to, you should post to
http://groups.google.com/group/jspec
instead
On 3/18/2011 11:01 AM, Aslak Hellesøy wrote:
What's JSpec?
Aslak
On Mar 18, 2011, at 1:35, "Will C." wrote:
When I run JS
Roger,
Check the list archives - this topic is brought up every other 3 months :)
On 8/26/2011 9:02 PM, Roger Pack wrote:
Hello.
Perhaps rspec-mocks could warn if it stubs a not yet existing method?
class A
end
describe RSpec do
it 'should' do
a = A.new
a.stub!(:nonexistent_method)
29 matches
Mail list logo