similar to: How to intercept an instance method from StdLib (1.9.2)

Displaying 20 results from an estimated 2000 matches similar to: "How to intercept an instance method from StdLib (1.9.2)"

2011 Mar 03
1
Does RSpec interfere with Pathname#dirname or Pathname#realpath ?
Hi, I starting a new project, and have run into behavior I cannot replicate in irb, (i.e. outside of using rspec) when the directory? returns true, so I thought I''d ask here, in case any one has seen this badhavior. ruby-1.9.2-p136 rspec (2.5.0) rspec-core (2.5.1) rspec-expectations (2.5.0) rspec-mocks (2.5.0) When I try to run this spec: require Pathname(__FILE__).ascend { |d|
2010 Nov 07
2
Hooks before a scenario but not the background: possible or bad practice
Hi, I''d like to activate FakeFS for some scenarios, which I tag @fakefs, however it seems Before(''@fakefs'') runs before the background of the feature - unfortunately this clobbers Grit, and I can''t Grit::Repo.new(...) in the backbround. Is it currently possible to get a hook to run before a scenario, but not the Background of the feature? Or am I mistaken in
2009 Mar 05
8
Can I construct the controller myself in a controller spec?
Hi I am experimenting with Constructor based dependency injection for rails controllers. So I have something like this class LoginSessionsController < ApplicationController def initialize(authenticator = TheRealAuthenticator) @authenticator = authenticator end .... end The plan was to override the authenticator used when testing with something like describe
2008 Aug 26
9
stub_model() and ActiveRecord Associations
Hi all, I have what I thought was quite a simple requirement but something to do with the way ActiveRecord''s associations work is making it quite puzzling. I guess I can sum it up with this failing test: before(:each) do @source_comment = @source.comments.create(:user_id => 1) @target_comment = @target.comments.create(:user_id => 1) end
2008 Sep 24
19
How to define request.domain in when testing
Hi, My application relies on request.domain for doing its job. The problem I am encountering, is that when running tests, request.domain returns "test.host", how can I change that so that it returns "mysite.com"? Thanks in advance. -- Posted via http://www.ruby-forum.com/.
2008 Nov 03
1
stub! and null_object
I have some code I want to stub out as it''s not part of what I''m testing. It''s got a bit of DSL going on, so there are method calls chained together. The call I want to stub out looks like this: user.record_action(:uploaded_a_photo => concert).with_result(photo) So ideally, I''d just do @user.stub!(:record_action) and that would return a null
2009 Nov 17
8
rspec-rails gem double quoting (My)SQL?
Hi all, This seems like a plugin conflict (I haven''t yet had success replicating this in a new project), but short version is: when I have "rspec-rails" in my environment.rb plugin config, table names are double quoted in mysql queries generated by my standard finders. rspec-rails commented out: SELECT * FROM `users` WHERE (`users`.`id` = ''159564615'')
2009 Oct 20
8
Stub that returns hash values
Is it possible to create a stub that returns hash values. For example I would like to convert this: @siteItem = stub(''plmSiteItem'', :one => "uno") To something like this: @siteItem = stub(''plmSiteItem'', {''one'' => ''uno'', ''two'' => ''dos''} ) So that I can do this:
2009 Oct 14
14
spec-ing private methods?
On Wed, Oct 14, 2009 at 5:49 PM, Scott Taylor <scott at railsnewbie.com> wrote: > > On Oct 14, 2009, at 3:36 PM, 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...
2009 Aug 25
11
[Bug 23495] New: nouveau KMS produces no output on a Dell 3008WFP monitor
http://bugs.freedesktop.org/show_bug.cgi?id=23495 Summary: nouveau KMS produces no output on a Dell 3008WFP monitor Product: xorg Version: unspecified Platform: x86-64 (AMD64) OS/Version: Linux (All) Status: NEW Severity: normal Priority: medium Component: Driver/nouveau AssignedTo: nouveau at
2009 Apr 17
2
Error messages 3.0.6pre1
I compiled 3.0.6pre1, including the crtimes and fileflags patches for use on Intel OS X 10.5.6, as described by Mr. Bombich (thanks!) here: <http://www.bombich.com/mactips/rsync.html> I want to use 3.0.6 because it seems that this bug: <https://bugzilla.samba.org/show_bug.cgi?id=5365> has been resolved (yay!). ----- [~]$ rsync --version rsync version 3.0.6pre1 protocol version 30
2011 Nov 14
2
Looking for environment setup help
Can anyone help with setting up my environment? This all started when I tried to install Aptana Studio 3, and want to use the debugger. I have installed ruby 1.9.2, and rails 3.1.0. When I try to install the ruby-debug-base gem, I get an error that does not make sense to me - it tells me it needs ruby version > 1.8.7. Here is the error message, along with other details. I am running this
2012 Feb 21
8
should_receive_chain
Do you often find yourself doing this: active = double(''active'') active.should_receive(:first) users = double(''users'', active: active) account.should_receive(:users).and_return(users) for this: account.users.active.first ? Of course, we could use stub_chain, but that doesn''t let us know *where* the chain broke. Would you like to do this?
2011 Mar 18
7
Controller Spec & DataMapper Chaining
Hi there, I''m fairly new to RSpec, and DataMapper and I''m trying to write a controller spec for an index action that will include DM query chaining. Here is a very simplified version of the Controller#index I''m working on def index @widgets = Widget.all(:order => [ :name.asc ]) if params[:alpha] @widgets = @widgets.by_alpha(params[:alpha]) elsif
2011 Mar 03
1
Cucumber not inserting record in db
Hi, I am trying to learn Cucumber. I have followed the tutorial on "http://www.ultrasaurus.com/sarahblog/2008/12/rails-2-day-3-behavior-driven-development/" Everything is working fine but my problem is it is not inserting any record in either development or test database. Can anyone tell me IS it the behaviour of the Cucumber or Am I missing something? Thanks, Tushar -- Posted via
2010 Mar 03
1
Disabling database access in controller specs
It took a while, but now I an totally convinced that controller specs should not access the database and stub as much as possible. I''m committed to that style of writing, yet from time to time I incidentally allow it to happen. Is there a way to err on the safe side and have RSpec throw an error every time a controller spec attempts to access the database? And does it sound like a good
2003 May 08
1
SIP client registration
Hello, I'm trying to register some dynamic SIP softphone (SJphone) but it's not very clear to me where (sip.conf??) I have to configure the registration. Can you give me an example of configuration file to register a dynamic SIP phone? Thanks Marco Poet QiNet SRL Via Oulx 30/A 10139 Torino Italy Email marco.poet@qinet.it Phone +39 0117410856 Fax +39 0117571140 Mobile +39 3493009702
2009 Feb 05
2
[Cucumber] Progress Bar
Inspired by Nick Evans'' RSpec progress bar[1], I had a little crack at implementing the progress bar for cucumber, ''cause I want to know how long a break I can take while the features are running :) It''s in my fork, in the coverage_formatter branch: http://github.com/mattwynne/cucumber/tree/master It will dump failing feature, scenario, step and the exception as
2011 Sep 13
12
Assertions for asynchronous behaviour
Hi all, In GOOS[1] they use an assertion called assertEventually which samples the system for a success state until a certain timeout has elapsed. This allows you to synchronise the tests with asynchronous code. Do we have an equivalent of that in the Ruby / RSpec world already? I know capybara has wait_until { } but that''s fairly rudimentary - the failure message isn''t very
2008 Sep 09
12
cucumber - mark a step as pending
I love the way I can throw a call to pending() in the top of an unfinished RSpec example and stop it from failing the build. Is there a similar way to do such a thing with good ole'' cucumber? cheers, Matt ---- http://blog.mattwynne.net http://songkick.com In case you wondered: The opinions expressed in this email are my own and do not necessarily reflect the views of any former,