Displaying 20 results from an estimated 600 matches similar to: "Can I construct the controller myself in a controller spec?"
2007 Apr 12
1
rspec on rails: undefined method ''controller_name''
Im trying to write a controller spec, but when I run it I get an error like
the one below.
I found Bug6707
(http://rubyforge.org/pipermail/rspec-devel/2007-March/002147.html
), but I get the error no matter how I run the spec
( whether I use rake or not)
Any ideas?
I am using 0.8.2
The Error:
C:/rails/InstantRails/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/expectati
ons/sugar.rb:14:in
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 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
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 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
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 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
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 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
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
2009 Apr 16
6
Cucumber - step negating another expecting step
On 16 Apr 2009, at 11:22, Joaquin Rivera Padron wrote:
> at the moment I do it this way, hiding the complexity out of the
> steps:
>
> Then /^I should see the people search form$/ do
> people_search_form_exists
> end
>
> Then /^I should not see the people search form$/ do
> people_search_form_exists "not"
> end
>
> and then the method:
>
>
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
2011 Oct 18
8
rspec 1.3.2, Rails 2.3.14 - plugins not loading
Hi there
I have a weird situation. I have inherited a project in Rails 1.2.3
that has been upgraded to Rails 2.3.14 (and is running). I have
installed Cucumber and Rspec to start to write features/tests for the
new code that needs to be written. In my Gemfile, these Gems are
loaded:
group :test do
gem ''rspec-rails'', ''~> 1.3.4'', :require =>
2008 Sep 09
8
Cucumber and fixtures/FixtureReplacement
Hey guys,
I''d never used RSpec Stories before, so I decided to follow the
apparent direction of the wind and just jump right into cucumber. I''m
dabbling with/using Cucumber and really like it. Good job, aslak!
Where i''m struggling right now is using either fixtures or a model
factory methodology like the FixtureReplacement. In both cases, I''m
not
2009 Apr 27
2
[cucumber] Setting a constant in step definition
On Mon, Apr 27, 2009 at 7:00 AM, Andrew Premdas <apremdas at gmail.com> wrote:
> Currently I have a very simple constants implementation being loaded as a
> Rails initialiser
>
> module MVOR
> ? module Postage
> ??? THRESHOLD = BigDecimal.new(''6.99'')
> ??? RATE = BigDecimal.new(''30.00'')
> ? end
> end
>
>
> My scenarios
2008 Nov 07
13
features and form filling - going declarative?
I''m working on writing features for a wizard. The wizard collects
information from a number of different forms, and you can navigate through
it in a number of ways. Anyhow one of these forms is a customer form
collecting name, and email.
In the context of the wizard I feel that the following scenarios
Scenario:
Given I step to customer
And I fill in my customer details
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
2008 Nov 04
8
Testing a wizard with Cucumber
Assuming you have a multi-step wizard like thing, with lots of different
states and paths through it. What approach would your use to write a feature
for it? What I want to do is do the separate states and then reuse these
things in more complex scenarios that cover paths. For example
Scenario: State A
Given I''m ...
And I''m ...
When I ...
Then I should see
And I at