Displaying 20 results from an estimated 8000 matches similar to: "Disabling database access in controller specs"
2009 Jan 28
2
[Cucumber, TextMate Bundle] Call for help
Hey all,
As some of you may know I created the Cucumber TextMate bundle:
http://github.com/bmabey/cucumber-tmbundle/tree/master
What most of you probably don''t know is that I stopped using TextMate
(in favor of Vim) several months ago. Since then the Cucumber bundle
has been somewhat neglected by me and I''ve mostly pulled in patches and
regenerated the syntax for new
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 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...
2011 Mar 04
5
How to intercept an instance method from StdLib (1.9.2)
Hi,
I''m struggling with something that seems to be simple, and I''ve not
had any joy following the RSpec books suggestions (p. 187).
I''d like to test that a method raises and error when a file is not found.
I''ve tried adding this in my example just before I call my method, but
it never seems to get invoked.
Pathname.stub(:exist?).and_return(false)
The whole
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
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 Oct 16
3
Rails: View specs and implicit parameters in link_to()
Hi all,
I''ve been cleaning up our routing file, and removed the default
map.connect ":controller/:action" route.
It''s thrown up a bunch of sloppy mistakes, which is great, but I also
think I''ve found a problem with the view specs.
We have a generic navbar partial which is rendered in the index page
of several different controllers. The navbar contains
2009 Feb 25
5
[Cucumber] pretty html output?
Cucumberists (and RSpec Classic users ;):
How can we convert a Cucumber feature file into HTML with syntax highlighting?
Not the test-runner output; that''s preprocessed so it does not match the input
file...
Tx!
--
Phlip
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
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
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,
2008 Sep 13
3
RCov / RSpec segfaults on Ubuntu
Hi all,
I appreciate that this is not an RSpec question, but I wondered if
anyone out there can offer some pointers. We''re using the latest
versions of RSpec and RCov, and ruby --version says this (on the
Ubuntu build server):
ruby 1.8.6 (2008-07-17 patchlevel 279) [x86_64-linux]
We''re getting intermittent (yes, intermittent!) segfaults from the
build when running
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 Dec 13
4
Reuse of Cucumber Features
What''s the best way to handle a requirement that shows up as a
sub-requirement requirement in other features? For example let''s say users
can enter dates in various forms throughout my application. There is one
set of global rules specifying the formats in which dates may be entered,
and how they are interpreted. I put that in one feature. In various other
features, like
2010 Sep 30
5
response.should have_text leads to undefined method `has_text?'
One of my controllers directly renders some JSON output that I would
like to test with RSpec. For that I use ''response.should
have_text("foobar")'' in my spec file, but that leads to a
Failure/Error: response.should have_text("enim")
undefined method `has_text?'' for #<ActionController::TestResponse:
0xb6736944>
I read here somewhere that webrat
2008 Sep 26
6
BDD / cucumber thought - chaining ''Then'' steps with Which
Going back to the debate about keeping state between steps, I found
myself with the mild urge to be able to write this today:
Given there is a user
And the user has 20 friends
Then I should see a thumbnail of each of the users''s friends
Which should be a link to the user profile page for that friend
NB: An idiom in this which may be songkick-only but was inspired by
what
2008 Aug 15
7
Autotest and subclasses / namespaces
I am writing a controller admin/cities_controller.rb
it inherits from AdminController, so it''s defined like
class Admin::CitiesController > AdminController
Whenever I save the controller file, autotest freaks out:
uninitialized constant Admin::AdminController (NameError)
I''m pretty used to just hitting CTRL-C to get autotest to re-load all
the files, or flicking to
2009 Feb 05
3
[Cucumber, Webrat] Error backtraces shown as HTML in console
Since upgrading to Cucumber 0.1.99.19 I''ve noticed that the backtraces
appearing in the console output are of the form:
Page load was not successful (Code: 500):
Followed by the dump of the rails error page. That page looks fine in
a browser, and it''s helpful enough to see it when save_and_open_page
does its thing, but I''m pretty used to reading plain old
2008 Aug 27
3
array_including()
I found myself having to write this today:
class ArrayMatcher
def initialize(array_to_match)
@array_to_match = array_to_match
end
def ==(other)
ok = true
@array_to_match.each do |item|
ok = ok and other.include?(item)
end
ok
end
end
def array_including(array_to_match)
ArrayMatcher.new(array_to_match)
end
Is there already something in the