Displaying 20 results from an estimated 30 matches for "rspec_scaffold".
2007 Aug 16
17
undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
...'' for [RSpec example]:#<Class:0x25550a8>
with my view specs after upgrading to 1.0.8. Is anyone else seeing this?
To isolate the message I did the following setup:
- create new rails project (with edge)
- installed rspec and rspec_on_rails
- ran rake spec
- ran script/generate rspec_scaffold products
- tried to run a builtin view spec
Zach
2007 Nov 02
5
RSpec, RESTful nested routes and :path_prefix
Dear list,
In the app we are making we have a rout something like this:
map.resources :projects do |projects|
projects.resources :pages, :controller
=>"Wiki::Pages", :path_prefix => "/projects/:project_id/
wiki", :name_prefix => "project_wiki_"
end
But I can''t get RSpec(I''m very new to it) to accept this. It keeps
throwing errors:
2008 Jun 12
1
map.resources :foo_items, :as => :foo confusing my controller specs
I have following resource defined in my config/routes.rb (the model
name is contrived)
map.resources :foo_items, :as => :foo
that I originally generated with rspec_scaffold:
ruby script/generate rspec_scaffold foo_item
but when I use the :as attribute in resources to make the URI path be
''/foo'' instead of ''/foo_items'' the default/generated controller specs
for AdAssetsController become broken e.g.
it "should be successfu...
2008 Oct 09
1
About received unexpected message :code with (no args)
I use rspec_scaffold to generate a part of examples as below:
it "should expose a newly created awarding_body as @awarding_body" do
AwardingBody.should_receive(:new).with({''these'' =>
''params''}).and_return(mock_awarding_body(:save => true))
post :creat...
2007 Jul 26
2
rspec_resource error
...mmands using the "current release install instructions"
here [1]. However,
there doesn''t seem to be any mention of the rspec_resource generator?.
When I run script/generate I get the following:
Installed Generators
Plugins: authenticated, rspec, rspec_controller, rspec_model,
rspec_scaffold
Builtin: controller, integration_test, mailer, migration, model, observer,
plugin, resource, scaffold, scaffold_resource, session_migration,
web_service
Could anyone spread any light as to why rspec_resource isn''t being
installed? Sorry for the simple question but I can''t see...
2007 Dec 18
2
rpec_scaffold and nested resources
I''ve got a love-hate relationship with script/generate rspec_scaffold
If you are using non-nested controllers/resources it''s great. I love
the spec skeletons it generates.
But I find myself doing this, where Y is and existing set of
model/controller ... representing a resource:
1) script/generate rspec_scaffold x ....
At this point rake spec passes.
2)...
2007 Dec 16
3
how do I spec my Rails routes?
Once again, here''s something I haven''t figured out. Apologies if this
is too newb-ish, but, how do I spec my routes using RSpec-Rails?
In particular, I''ve got a catch-all route that needs to catch a wide
variety of URLs:
map.document ''*url'', :controller => ''documents'', :action => ''show''
Is there a way to
2009 Jun 13
2
removing Mocha; 'spec spec' fails but the specific model file passes
I happened to mix ryan bates'' authentication scaffold with
rspec_scaffold on a demo project.
and ran into the problem of mixing mock frameworks...ryan uses mocha.
So, as a learning experience, I choose to redo ryan''s tests without
mocha but ran into a strange problem with tests of the User model.
With debugging you can see....
If you run just the user_spec.rb...
2008 Jul 05
5
Does RSpec work nicely with UUID primary keys?
I have my application happily generating UUID primary keys using the
uuidtools gem.
But the auto-generated specifications created by "script/generate
rspec_scaffold...", etc, assume that one is using a sequential integer
primary key.
For those who have hit this same issue, is it just a matter of rewriting
the auto-generated specifications to take this into account, or does one
have to dig into the code of rspec because this assumptions is hardwired
in?...
2008 Dec 17
1
My first rspec reports "undefined method `key?' for #<String:0x46b1df0>"
...ethod `key?'' for #<String:0x46b1df0>
<-----------------------------------------------------------------------------------------------------------------------------------------
My environment:
OS:Windows
Rails:2.2.2
RSpec:1.1.11
rspec-rails:1.1.11
IDE:Netbeans6.5
Ruby:1.8.6
I use rspec_scaffold to generate these codes,and really confused about
this problems.
Hope for your suggestion!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to ruby...
2009 Jan 16
3
rspec model testing - test on user defined validation- How do I test that the create failed.
I''m new to rspec and looking for way to test a validation I added to a model.
The test checks to see that if field1 has a value then field2 must be nil
and vice versa.
-------------------------------
When I did the rspec_scaffold it generated one test which worked
before :each do
@valid_attributes = {
:field1 = "value for field1"
:field2 = "value for field2"
}
MyTest.create!(@valid_attributes)
end
it "should create a new instance given valid attributes" do
MyTest.create!(@vali...
2008 Jan 23
2
integrate_views is not executing my views
...episodes/71)
...but I can''t get it to work: the view code in not executed
I looked everywhere but I can''t understand what I am doing wrong.
Here is what I did:
I created a new application from scratch (Rails 2.0.2), added rspec and
rspec_on_rails plugins, and run
script/generate rspec_scaffold User name:string
This is my users_controller spec:
describe UsersController do
fixtures :users
integrate_views
describe "handling GET /users" do
it "should be successful" do
get :index
response.should be_success
end
end
end
I then added something...
2008 Jan 26
0
RSpec and resource_controller plugin
...jamesgolick.com/resource_controller after spending another
stretch of boredom making the changes to nest yet another rails
resource controller. I''d actually slowed down this time to think
about what I was doing in hopes of automating the task.
I''ve tended to use script/generate rspec_scaffold to get the skeleton
set of specs along with the model, migration, controller views, etc.
I''ve been a bit ambivalent about this, for one thing if feels a little
un-bdd to have the specs generated, but on the other hand the code
tends to be so pro-forma (at least to start out) and the gener...
2008 Sep 12
1
restful_authentication rspec failures "Mysql::Error: Incorrect datetime value:"
...s/
rspec
git submodule add git://github.com/dchelimsky/rspec-rails.git vendor/
plugins/rspec-rails
git submodule add git://github.com/technoweenie/restful-authentication.git
vendor/plugins/restful_authentication
git submodule init
git submodule update
ruby script/generate rspec
ruby script/generate rspec_scaffold blog title:string content:text
rake db:migrate
rake spec # 37 examples, 0 failures
git add .
git commit -a -m "blog with passing rspec tests"
ruby ./script/generate authenticated User Sessions
rake db:migrate # 288 examples, 193 failures
1)
ActiveRecord::StatementInvalid in ''S...
2007 Nov 09
26
RSpec on Rails 2.0
I have a project on edge rails that I''m trying to convert from Test:Unit
to rspec. I have the rspec gem version 2338, the rspec and
rsepc_on_rails version 2831 in vendor/plugins, and rails version 8117 in
vendor/rails.
I''ve been able to get a few specs passing, have gotten the specs running
from autotest, and am able to do "rake spec:doc" and get the basic
command
2007 Jul 26
5
Coding standards and whitespace
...upport/spec/spec_mate_spec.rb
rspec_on_rails/generators/rspec/templates/script/spec_server
rspec_on_rails/generators/rspec_controller/templates/helper_spec.rb
rspec_on_rails/generators/rspec_controller/templates/view_spec.rb
rspec_on_rails/generators/rspec_controller/USAGE
rspec_on_rails/generators/rspec_scaffold/rspec_scaffold_generator.rb
rspec_on_rails/generators/rspec_scaffold/templates/controller_spec.rb
rspec_on_rails/generators/rspec_scaffold/templates/edit_erb_spec.rb
rspec_on_rails/generators/rspec_scaffold/templates/index_erb_spec.rb
rspec_on_rails/generators/rspec_scaffold/templates/new_erb_spec....
2008 Aug 11
1
Confused about square bracket usage.
I ran script/generate rspec_scaffold page title:string body:text and
have been reading on the generated code in my spare time in an attempt
to fully understand rspec. It mostly makes a lot of sense except for
the square brackets in the snippet below. To my best understanding,
[mock_page] would be an array containing mock_page. That al...
2009 Apr 30
1
rake spec - no output
...? Here is what I did:
rails rspec-test
cd rspec-test
test.rb: config.gem "rspec", :lib => false, :version => ">= 1.2.0"
test.rb: config.gem "rspec-rails", :lib => false, :version => ">= 1.2.0"
ruby script/generate rspec
ruby script/generate rspec_scaffold Movie title:string number:integer
rake db:create:all
rake db:migrate
remove --colour in spec.opts
rake spec
This should return a bunch of passed tests, but doesn''t.
Environment:
Ubuntu 9.04
Rails 2.3.2
ruby 1.9.1p0
rspec 1.2.4 as gem
rspec-rails 1.2 4 as gem
rake spec --trace
(in /home/...
2008 Jan 16
2
rspec_on_rails_matchers
...s never seem to be called.
I created a new Rails 2.0.2 app, installed RSpec and rspec_on_rails
1.1.2, then installed the rspec_on_rails_matchers... FYI, I am using
ruby 1.8.5 (2006-12-04 patchlevel 2).
I then created some simple scaffolding to have some view specs to play with:
./script/generate rspec_scaffold Animal kingdom:string name:string
Then running rake db:migrate, rake db:test:prepare, and rake spec will
give me all green. I then added the rspec_on_rails_matchers to my view
spec.. so I had this:
http://pastie.caboo.se/139655
I then removed one of my fields from my actual form to break the s...
2007 Oct 16
3
generate script_controller not creating test code
For some reason when I ran it this time it decided not to create any
view or controller tests. I had already created the corresponding model
with the rpsec_model script before trying to create the controller. I
am not sure if there is something that I did incorrectly or not.
Does anyone know why this is happening?
Thanks
--
Posted via http://www.ruby-forum.com/.