Displaying 20 results from an estimated 20000 matches similar to: "before before and after after"
2007 Apr 11
10
DRYer controller specs
So, I''ve been following the recommendations for controller specs here:
http://blog.davidchelimsky.net/articles/2006/11/09/tutorial-rspec-stubs-and-mocks
Most notably: a single expectation per specify block; the setup block
contains only stubs; mock expectations each get their own specify
block. (I''m still using 0.8, so I haven''t gotten the describe/it
goodness yet.)
I
2007 Oct 22
13
An error on edge at -r 2767
Morning,
Having done an svn up this morning all my specs are broken with the
following:
SQLite3::SQLException in ServiceConfig with minimum set of valid parameters
should return nil for the service path''
SQL logic error or missing database
C:/development/sandbox/prototypes/user_admin_client/config/../vendor/plugins/rspec_on_rails/lib/spec/rails/dsl/behaviour/rails_example.rb:17:in
2007 May 28
1
Rails matcher render_template is wrong when using GetText, looking for flexible solution
I have a problem with a mismatch between RSpec Rails and the actual
behavior when using GetText, and would be glad for suggestions how to
best solve this.
When using GetText a failure is reported for the following simplified
specification:
describe SamplesController, "when requesting /samples" do
it "should render index " do
get ''index''
2007 May 24
25
Specs for ApplicationController, where to put them?
The Rails ApplicationController (app/controllers/application.rb)
serves as an abstract superclass for all other controllers in a Rails
application and is a good place to put methods and filters which you
want all of your controllers to use. In my case I''m using it to
provide methods such as "current_user" and "logged_in?" etc.
By default, RSpec
2007 May 31
28
Another attempt for a succinct model validation DSL
On 5/28/07, David Chelimsky <dchelimsky at gmail.com> wrote:
> The behaviour you''re trying to describe is that the User should
> require that passwords bear certain qualities - in this case a length
> between 5 and 40. So you need to ask yourself how the User should
> behave when this requirement is violated, and then specify that it
> behaves that way.
>
>
2008 Dec 02
11
Any plans for Before-feature or Before-all steps in Cucumber?
Hi
The code I''m working on now is a server daemon that talks to Twitter,
an RSS feed, and some web pages. I''ve got mock implementations of
Twitter and the web stuff, which I start and stop with
daemon_controller[1]. I do all the setup in a Before block, but this
makes the feature runs agonisingly slow due to the time waiting for
everything to restart. I''m
2007 Apr 25
9
Running specs for a plugin - undefined method ''define'' for object
I''m trying to write specs for a plugin I''m developing named audit_fu, and
I''m running into a problem which I can''t get past it. I''ve got the same
specs setup in the main rails app, and everything works fine there, it''s
just running the plugin specs that I''m having a problem with. My setup is:
- edge rails
- edge rspec (in
2007 Oct 14
40
Step matchers
I think we all know that the readability of steps isn''t great right
now, and in fact there''s a very recent thread that discusses just
that. It was that recent thread that prompted me to explore this a
bit.
The basic idea is that you define step matchers, which have a regex,
and then you match step names against that regex. Kind of tough for
me to explain so I''ll just
2007 Oct 17
16
rspec causing validates_presence_of to validate twice?
I had posted this on the regular Rails list, but upon trying this in
script/console, it seems like the behavior only exists when running rspec.
I''m getting some weird behavior in one of my models. I have a model
defined something like this
class User < ActiveRecord::Base
attr_accessor :password
validates_presence_of :password
end
If I validate the model without specifying a
2007 Nov 09
9
fixture_file_upload and edge rspec?
Hi all,
I had some specs that were using fixture_file_upload that were
passing just fine. Then I froze edge rails to get some 2.0
functionality, then a I upgraded to trunk rspec to deal with
uninitialized constant ActionView::Helpers::JavaScriptMacrosHelper
After a couple other of tribulations, I have now gotten down to just
a couple of not passing specs, all using the fixture_file_upload.
2007 Jun 19
5
Problems translating should_render from 0.8.2 to 1.0.5
<font size="2">I''m working on a large Rails site and we want to move from RSpec 0.8.2 to the latest and greatest. So we ran the translator and yet we''re having a lot of trouble translating should_render.<br><br>I found this on the web:<br><br>We will NOT be supporting the following in the new syntax:<br>
2007 Oct 04
1
PUT- or POST-ing xml
I''d like to write a test of a REST service wherein XML is submitted as the
request entity.
In Test::Unit on Rails, this seems to be possible in an integration test,
but not in a functional test. RSpec uses the Rails functional test
framework, as far as I can tell, so it suffers the same result; it tries to
symbolize the keys of the ''parameters'' hash, except the
2007 Apr 30
7
Migrating spec_helper with modifications
Hello,
After moving into the HEAD of rspec, I am greeted with a mountain of errors,
which I expected, due to my specs not being migrated.
I use hpricot for a lot of my view tests, as it is extremely simple to
traverse the DOM with it. I used to include HpricotSpecHelper in
spec_helper.rb, like so:
require ''hpricot_spec_helper''
module Spec
module Rails
module Runner
2007 Aug 24
26
testing behaviour or testing code?
hypothetical question for all you BDD experts:
I want to make sure that a :list action always returns widgets in
alphabetical order. There''s at least 2 ways of doing this:
it "should fetch items in alphabetical order" do
Widget.should_receive(:find).with(:order => "name ASC")
get :list
end
it "should fetch items in alphabetical order" do
[:red,
2007 Jun 21
3
Sqlite3, in-memory db and rspec_server
Hi everyone.
I can''t get the above(subject line) combination to work. If I use a
standard sqlite3 file db for the test db, and spec_server all the
specs on my models pass. If I use an in-memory db for the test db,
script/spec w/o spec_server, they all pass. But if I use in-memory and
spec_server I get the following error:
1)
ActiveRecord::StatementInvalid in ''User should be
2007 Mar 27
10
sqlite3 and rspec_on_rails tests
As I think I previously mentioned, there is an incompatibility with
rails 1.2.1 and sqlite3 3.3.8.
see: http://weblog.rubyonrails.org/2007/1/29/using-sqlite3-with-rails
and: http://weblog.rubyonrails.org/2007/2/6/rails-1-2-2-sqlite3-gems-
singular-resources
Sqlite is now at 3.3.13.
Because of this, if a developer is trying to create a patch for
rspec_on_rails, he will have one of the
2007 Apr 11
12
redirection doesn''t get detected well?
I''m doing a redirect in one of my controller actions and somehow I can''t
spec it, see this pastie: http://pastie.caboo.se/53120.
When following the link from a browser I''m being redirected to the right
page.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2007 Sep 10
6
RSpec view spec writing problem (unable to generate url_for in RESTful resource link_to)
Thanks, first, to everyone who''s asked and answered questions on this list,
and to the creators of RSpec - it is all very helpful. I''ve searched the
mailing list, and had a couple 2hr googling sessions that didn''t help me
find an answer.
I''ve run into a problem getting my first non-trivial view spec to run. I
get an error when trying to generate a link_to()
2010 Jun 20
10
RSpec 2 view example: render_template
On http://github.com/rspec/rspec-rails under "View specs" there''s an
example
describe "events/index.html.erb" do
it "renders _event partial for each event" do
assign(:events, [stub_model(Event), stub_model(Event)])
render
view.should render_template(:partial => "_event", :count => 2)
end
end
Is this indeed correct? From the
2007 Feb 16
6
some fun functionality for all your specs
I''ve found these two snippets of code useful and would love some feedback.
first, .should_have_valid_associations
usage:
context "A new Product" do
specify "should have valid associations" do
@product.should_have_valid_associations
end
end
code: (thanks to Wilson/Defiler for converting to rspec)
module Spec
module Expectations
module Should