[rspec-users] Formatter failing_examples option

2010-08-25 Thread Evgeniy Dolzhenko
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

[rspec-users] Global before block for specific spec type

2010-08-31 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] render_with_layout not working with RSpec 2 + Rails 3 + shoulda 2.11.3

2010-09-07 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] variable strange change

2010-09-15 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] How do I figure out which (wrong) file rspec is loading?

2010-11-01 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] Testing attr_accessible (and/or attr_protected)

2010-11-02 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] Testing attr_accessible (and/or attr_protected)

2010-11-02 Thread Evgeniy Dolzhenko
> 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

Re: [rspec-users] rspec-rails - expected helper_method behaviour in view specs

2010-11-11 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] How do I include routing path helpers?

2010-11-12 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] How do I include routing path helpers?

2010-11-13 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] How do I include routing path helpers?

2010-11-13 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] view.should render_template best practices?

2010-11-16 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] view.should render_template best practices?

2010-11-17 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] rspec2, rails 3, subdomain constraints

2010-11-25 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] Rspec: rendering a certain template with a certain layout is needed

2010-11-25 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] How do I generate specs for existing controllers?

2010-11-25 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] Comparing files

2010-12-10 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] "No route matches" error?

2011-01-07 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] View specs - best practices

2011-01-10 Thread Evgeniy Dolzhenko
+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

Re: [rspec-users] [newbie] CSS navigation in controller response?

2011-01-24 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] [newbie] CSS navigation in controller response?

2011-01-25 Thread Evgeniy Dolzhenko
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? __

Re: [rspec-users] Is there an easy way to inject each example text into test.log

2011-01-30 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] Is there an easy way to inject each example text into test.log

2011-01-30 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] Difference between :each and :all

2011-01-31 Thread Evgeniy Dolzhenko
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

[rspec-users] Are there test:recent, test:uncommitted task alternative for RSpec

2011-01-31 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] debugger in controller in rspec

2011-02-08 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] Rails 3 Upgrade

2011-03-06 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] 'spec' command not working

2011-03-18 Thread Evgeniy Dolzhenko
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

Re: [rspec-users] warn on stubbing nonexistent method?

2011-08-26 Thread Evgeniy Dolzhenko
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)