Displaying 20 results from an estimated 3000 matches similar to: "Scaffolding Specs"
2007 Sep 16
12
rspec_todo -- spec''ing backwards
While the spirit of BDD is to spec first and code second, many of us
have legacy code. Worse, some of us have legacy code without very
good coverage. Recognizing that *I* have such code, I created a
script that grinds through your .rb files and creates placeholder
specs for each public method.
While it is more sensible to spec behavior of code function than of
individual methods, this
2007 Jun 09
11
authentication, controller specs. I think I''m missing something simple ....
Hi all,
I feel like I''m missing something really easy and I''m just not seeing
it.
I''m using the restful_authentication plugin and have a User model. Uesr
has_many :things and Thing belongs_to :user.
That''s it.
I did a "script/generate rspec_scaffold thing" to generate all the
necessary bits. The "rake db:migrate" to create the db.
At
2007 Jan 05
4
How To Spec Controllers with Finders
Given this code (which renders rjs), I''m faced with the fixture-
driven way of spec-ing or mocking. How the heck to you mock this so
the code at line (2) and (4) work right? I''m still struggling with
mocks but it seems like this can be done. Forgive the naivety of this
question.
1. def change_quantity
2. @line_item = LineItem.find_by_id(params[:id])
3. unless
2005 Dec 18
2
Rake Test Output Prettifier
Watching the test results scroll by, it occurred to me that there must
be an easier way than either letting it go or capturing it to a log file
to mess with in TextMate.
Here''s my first stab at an HTMLifier for test output. Just download,
unzip, chmod +x, and you can:
rake | ./prake.rb
Which, if you are on a Mac, should bring up a Safari window with a
summary of the problems at the
2006 May 23
3
image_tag problem
Hiall,
I want to make an image_tag from within a controller in order to be
able to present a link (with a status image) in a view. Here is my
controller method (in file webca_controller.rb, hence WebcaController)
def untouched_status_image_tag
image_tag("open", { :alt => "Offen", :title => "Offen", :size =>
"12x12", :class =>
2006 Jul 03
5
Ferret on 64 bit Red Hat
Can anyone verify that Ferret should work correctly on 64 bit Red Hat ES
4?
The test suite gets the following segfault:
........................../unit/../unit/analysis/../../unit/index/../../unit/store/../../unit/search/tc_filter.rb:20:
[BUG] Segmentation fault
ruby 1.8.4 (2005-12-24) [x86_64-linux]
This is with version "ferret-0.9.4" on an AMD Dual Opteron 270.
--
Posted via
2009 Feb 24
5
undefined method `model' for ContactController:Class
Hi ,
I''m getting "undefined method `model'' for ContactController:Class"
Basically this is my first RoR application.
Can you please somebody help to resolve this.
Steps I have followed,
1)ruby script/generate model contact
2)ruby script/generate controller contact
3) vim app/controllers/contact_controller.rb
class ContactController < ApplicationController
model
2006 Jul 02
5
"the number of parameters does not match the number of substitutions" error
All of a sudden, I''m getting this error:
1) Error:
test_index(AccountControllerTest):
RuntimeError: The number of parameters does not match the number of
substitutions.
/home/joe/projects/tanga/trunk/config/../vendor/rails/actionpack/lib/action_controller/assertions.rb:92:in
`assert_redirected_to''
2008 May 04
1
scaffolding with namespace
Hi,
is there a way to scaffold with namespace?
I''d like to generate a Posts model with namespace admin. But using
script/generate scaffold admin/post title:string
the migration would generate a table "admin_posts".
So I did now
script/generate scaffold post title:string
moved the controller, views manually to admin/... and had to change each
link manually from (e.g.)
2007 Mar 20
1
Passing Arguments to before_filter
I want to put a before_filter in application.rb, as follows:
before_filter :do_something, :except_controller => [:admin]
def do_something(options)
options.stringify_keys!
unless options[:except_controller].include?(controller_name)
# do something useful
end
end
Where I''m blocking is on how to get the ''options'' data in the do_something
method. I think I
2006 May 03
5
Multiple Scaffolds
I''d like to create scaffolds for each of the tables in my database, but
would like to access them below the path: localhost:3000/admin
For example localhost:3000/admin/table1
localhost:3000/admin/table2
Where table1 and table2 would be the controller names respectively,
calling their own list.rhtml, show.rhtml, edit.rhtml, etc..
Any recommendations on how/where to
2005 Nov 30
2
Missing scaffold features
Hello everyone,
First off, I''m trying to generate a discussion here, not provoke an
argument or get people upset. Please bear this in mind if/as you read
on...
To my mind, there''s 3 missing features from scaffolds that would make
them a whole lot more useful. These are:
- auto-generation of a drop-down list for inputting/updating
has_many/belongs_to relationships between
2006 Apr 16
0
scaffolding issue - new action defaults to list action
I''m creating a photo blog with ror. The front end has gone great, so
now I''m working on the back end, and was playing with scaffolding.
I generated these scaffolds:
ruby script/generate scaffold Photo admin/photo
ruby script/generate scaffold Camera admin/camera
Then, in my routes, I added this line:
map.connect ''/admin'',
2006 Feb 27
1
Functional test problem with environments variables
Hi guys,
i have been experiencing this problem once i put in some constant
declarations in /config/environments/development.rb. I declared it very
normally like this :
USER_DETAILS = {
:name => ''abc'',
:password => ''123''}
it works in the controller and when i run the application, i managed to
get the values out from the development.rb by using some
2007 Mar 19
3
Assert_select
Hi all
This is my first post here. I ave been using Rails for a couple of
months, and am starting to put together a test suite. But I''m having a
problem with assert_select in my functional tests.
According to the documentation, it should be fine with two arguments -
a CSS selector and a string to test it against. But no matter what I
do I keep getting the exception:
wrong number of
2007 Jun 24
6
mocking errors
What is the correct way to mock out the errors on a Rails model?
I''m assuming i need to say
@mock_thing = mock_model(Thing)
@mock_thing_errors = mock("errors")
@mock_thing_errors.should_receive(:full_messages).and_return("An error")
@mock_thing.should_receive(:errors).and_return(@mock_thing_errors)
Just wanted to check the best practice on this kind of thing and how
2007 Jan 09
9
Date Approximation in Specs
The floating-point expectations allow for an error tolerance. Is
there any similar facility for dates? For example, say I have a
custom class that handles date/time spans and I want to spec it:
context "A DateRange span" do
specify "should know when a week ago is :)" do
d = DateRange.new
d.last_week.should_be_close_to(1.week.ago, 24*60*60)
end
end
The idea
2006 Jul 16
2
Can scaffold do tall tables instead of wide?
I''m trying to get data in rows instead of columns by default.
The default scaffold behavior is to create an initial table layout with
column headers along the top. In some cases this creates really wide
tables which require horizontal scrolling. Is there a parameter I can
use with scaffolding or a hack to get the header cells along the left
side of the table instead?
I''m
2006 May 19
4
Lookup tables and scaffolding
It occurs to me as a missing feature that there''s no way to indicate a lookup
table relationship (as opposed to other sorts of foreign key relationships)
in Rails and that the scaffolding generator could recognise this lookup and
render a drop-down list automagically for the lookup table.
Say you have an Address and a State, and the State is a lookup table. In
addresses you have
2006 Jun 26
5
Multiple choice questions scaffold?
Hello all,
I''m in my second day of working through the various Ruby on Rails
tutorials, I''m already hugely impressed by the potential speed of
developing database driven sites, especially via the use of scaffolds.
Which brings me on to my first question (apologies if it''s a simple one,
but like I said it is only my second day!)
I am aiming to develop an application