Displaying 20 results from an estimated 5000 matches similar to: "error_on is deprecated?"
2009 Mar 23
5
Rspec weird behaviour
Hi,
I recently migrated from classic rails testing to Rspec, so I am
pretty new to the framework and still learning. I am getting weird
errors on an ActiveRecord model test, here is the basic class model
definition:
class Size < ActiveRecord::Base
has_many :quantities, :dependent => :destroy
validates_presence_of :name
validates_uniqueness_of :name, :case_sensitive => false
end
2008 Mar 18
6
Problem with mocking a simple has_many relationship
Hi there all. Sorry if the question sounds silly but i''m rather new at
the ''mocking'' stuff... So here is my problem (code helps more than
talking):
the model:
class Item < ActiveRecord::Base
...
has_many :images, :dependent => :destroy
...
protected
def validate
errors.add(:images, "cannot be empty") if self.images.count
end
end
the
2009 Mar 23
3
Spec::Rails, "model.should have(1).error_on(:attribute)" passes when?
Spec::Rails people,
I''m curious about:
- model.should have(1).error_on(:attribute)
displayed in the URL below:
http://rspec.rubyforge.org/rspec-rails/1.2.2/classes/Spec/Rails/Extensions/ActiveRecord/InstanceMethods.html
The Rspec peepcode screencast suggests that
model.should have(1).error_on(:attribute)
should pass if
model.send(:attribute)
returns nil
For me, I get an exception
2011 Feb 25
7
Rspec2 for rails 2.3.8?
Hi experts,
I picked up a copy of the rspec book and wrote some tests in spec/lib
and spec/models for my Rails 2.3.8 code.
I was using rspec 2.5.1, rspec-core 2.5.0, rspec-expectations 2.5.0 et.
al.
But I realised that the rspec-rails version I am using is meant for
Rails3.
Which version of rspec-rails should I use for Rails 2.3.8?
Best,
Radhesh
--
Posted via http://www.ruby-forum.com/.
2007 May 03
1
unexpected failures with --reverse
I''m having trouble figuring out why one of my specs passes when run
without --reverse and then fails with --reverse. What am I missing?
I''m using the plugin versions of both rspec and rspec_on_rails 0.9.2.
Here is the offending spec (Bill is an ActiveRecord model in a Rails app):
----------
describe Bill, " when valid" do
def valid_bill_attributes
{ :uuid =>
2007 May 27
12
Checking for Range
how would you check for a range using rspec?
person.password.range.should == Range.new(5..40) <- this doesn''t work
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070527/4d8cb007/attachment-0001.html
2009 Mar 23
0
Spec::Rails, "model.should have(1).error_on(:attribute)" passes when?
Spec::Rails people,
I''m curious about:
- model.should have(1).error_on(:attribute)
displayed in the URL below:
http://rspec.rubyforge.org/rspec-rails/1.2.2/classes/Spec/Rails/Exten...
The Rspec peepcode screencast suggests that
model.should have(1).error_on(:attribute)
should pass if
model.send(:attribute)
returns nil
For me, I get an exception from the rspec script.
My work-around is
2007 May 09
4
UI testing framework? (w/o selenium)
Hey all,
I am currently working on coming up w/ an easy to use, developer-centric web
testing framework to test a J2EE app with. (I have 3 rails apps in
production, love rspec, and am currently at a java shop).
I''ve looked at selenium, and it just doesn''t seem like it is ready for prime
time, and the target audience is developers. So, having said that, does
the rspec
2006 Dec 20
16
Edge RSpec on Rails...what did I forget?
Started a new Rails project, and installed RSpec and the Rails plugin
vendor/plugins/rspec (svn://rubyforge.org/var/svn/rspec/trunk/rspec) - 1332
vendor/plugins/rspec_on_rails
(svn://rubyforge.org/var/svn/rspec/trunk/rspec_on_rails/vendor/plugins/rspec_on_rails)
- 1332
Generated the rspec file, created a model...the spec runs fine if I do
ruby spec/models/foo_spec.rb. Running rake though gives
2007 Mar 14
5
What''s the new syntax for predicates?
@settings.should allow_publish_ip("127.0.0.1") fails with
undefined method `allow_publish_ip'' for #<#<Class:0x2f8fd48>:0x2f5a968>
@settings.should_allow_publish_ip("127.0.0.1") works fine
This is rspec 0.8.2.
http://rspec.rubyforge.org/documentation/expectations.html says that
matching arbitrary predicates is deprecated and to see
2007 Nov 12
15
it "should [action] ..." vs it with an active voice
I''d like to start gathering information/debating on the
advantages/disadvantages of using it "should ..." vs other techniques.
Dan North explained why we should use should:
http://dannorth.net/introducing-bdd/
I used to use it "should ..." for the projects I was on, until I was
challenged by a fellow developer who started using it with an active
voice.
For example
2006 Nov 03
10
[PLUGIN] rspec_resource_generator - RESTful scaffold generator with RSpec specifications
rspec_resource_generator
========================
By Pat Maddox
Use this generator to generate RESTful scaffolding with RSpec specifications.
Syntax is exactly the same as the scaffold_resource generator:
./script/generate rspec_resource ModelName [field:type field:type]
When you run this generator, it will create a migration, model, and
model spec file. In addition, it gives you a RESTful
2007 Jan 01
3
Another "how do I spec this?"
I wanted to add a convenience method on my User class to see if he was
already signed up for a tournament. Here''s my spec
context "A User signed up for one tournament" do
setup do
@t1 = Tournament.new
@t1.save false
@t2 = Tournament.new
@t2.save false
@user = User.new
@user.save false
@user.registrations << Registration.new(:tournament =>
2006 Jul 22
12
Community request - can someone show me REST?
I mentioned this in another thread, but I''ve got a formal request now.
After reading tons of stuff about REST, I don''t really get it. I
need to see an example.
I''d like someone to write up an example blog app with these requirements
- RESTful using the simply_restful plugin (or edge rails)
- allows posting of comments to articles
- has categories for posts
No need
2007 Feb 07
5
Mocking ActiveResource
I want to use ActiveResource in my app. Instead of hitting server
though, I want it to load from a file when I call find. Any clue how
I do that?
Pat
2005 Dec 12
9
Webrick is being stupid...no info on a brand new project
I created a project, made a migration, generated scaffolding...start
up webrick and I get nothing. To simplify things, I just started
another project and generated a controller, still getting nothing.
The index page loads fine, but nothing beyond that. If I go to
anything that should give me a 404, the page is just blank. The
Webrick console just says a 500 (nothing explaining why), and
2006 Jun 07
6
I want to stick my models in a module
I''ve got enough models now that I''d like to separate them into
modules. For example, I have the class Player that I want to stick in
the Trainer module. I''ve changed the definition to
class Trainer::Player
I''ve created a models/trainer dir, test/unit/trainer, and
test/fixtures/trainer. Change the PlayerTest class to be
Trainer::PlayerTest. I get the
2007 May 21
4
Just upgraded to 1.0.0, should render_text isn''t working for me
I finally got around to upgrading from 0.8.2 (!!). I had a spec which
looked like
specify "should render abc123" do
controller.should_render :text => "abc123"
get :key
end
With 1.0.0, the new spec is
it "should render abc123" do
get :key
response.should render_text("abc123")
end
However it doesn''t work, giving me the error:
undefined
2007 Sep 04
7
Rake tasks getting in the way of edge (uses gem instead)
So I''d been running gem releases of rspec for the past several months,
and I installed edge rspec so that I can use Story Runner.
I''m running into a problem because I''ve got a couple rake tasks that
reference "spec/rake/raketask". If I try to run "rake spec" then it
pulls in the gem version instead of the plugin version. rake blows up
saying that
2007 Apr 09
7
RCov results seem to include the spec files
I saw the RCov page at http://rspec.rubyforge.org/tools/rcov.html and
decided to add it to my project. My rakefile looks like this:
require "rake"
require "spec/rake/spectask"
desc "Run all specs with RCov"
Spec::Rake::SpecTask.new("spec:rcov") do |t|
t.spec_files = FileList["spec/**/*_spec.rb"]
t.rcov = true
end
When I run rake spec:rcov,