Displaying 20 results from an estimated 4000 matches similar to: "Patch idea for rspec_on_rails"
2007 Mar 29
21
a better "should have valid associations"
This is pretty much the same as last time around, if you recall.
Thanks to Wilson for converting to the new form. I''ve added a few
lines. Basically, it iterates over your model associations and does
two things.
- First, just try to call the association. Usually fixes speeling
erors or other such silliness.
- Second, try to find a record with an :include on the association.
This
2007 Oct 20
14
Problems with form_for and partials
i''m having problem with a form_for situation where i''m trying to DRY
out the repeated parts of my forms and put them in common/form and
render the form elements via another partial in controller_name/_form.
Here''s the first form
# app/views/common/form
<% form_for ... do |f| -%>
<%= render :partial => "params[:controller]/form", :object => f
2008 Jan 10
21
Shoulda
Hey, we''re currently using shoulda (http://dev.thoughtbot.com/
shoulda/) on a project and I saw some things that would be really nice
to see in rspec, namely the should_ methods, and especially the
should_be_restful method. Do these go against the rspec goals at
all? Or could an ambitious programmer go to town implementing these
for rspec_on_rails?
Nathan Sutton
fowlduck at
2007 Dec 03
7
RSpec Project
Hey does anyone know of a good open source Rails project that uses
RSpec? I''d like to check out some real world code that''s drinking the
RSpec BDD koolaid.
Thanks.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To
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.
>
>
2007 May 05
10
have_one and have_present
>Comment By: Luis Lavena (luislavena)
> Date: 2007-05-04 23:37
> describe "An Asset" do
> before(:each) do
> @asset = Asset.new
> end
>
> it { @asset.should have_one(:attachment) }
> it { @asset.should have_present(:something) }
> end
Food for thought on these. I like have_one a lot. It speaks to me as a
Rails developer and I think it speaks to
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 May 04
2
Custom Matcher and NAME NOT GENERATED annoyance
Hello RSpec users,
Have been using RSpec since 0.8.2 (not too long ago, I must say). and
been creating my custom matchers since was defined as "good practice".
Also, auto-generated names for the examples is very helpful, I''m
trying to take advantage of it.
Since I often prior code/define all the "examples", I have created a
few matchers to fulfill associations and
2011 Sep 14
1
rspec and should have_many through
Hi,
Anyone can help me with rspec shoulda validations please.
I can''t get the syntax right for these validations. Please correct me
it { should have_one :tradable, :through => :trade_order}
it { should belong_to :source, :polymorphic => true }
it { should have_many :transfers, :as => :source }
this is for Rspec 2, rails 3.1,
gem "rspec-rails"
gem
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
2008 Aug 21
1
rescue_from failing to rescue [from]
Having some weird failures of rescue_from in all my specs. They still
rescue in actual usage, just not in my specs. Made a pastie of the code:
http://pastie.org/257399 This is with latest [as of 1:00 PM Eastern time
zone] rspec/rspec-rails/edge. Thanks in advance for any replies on this.
RSL
--
Posted via http://www.ruby-forum.com/.
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 19
5
Stories and Pending Actions
I can''t get my plain text stories to show pending actions like the
example addition plain text story. Any tips? (See below)
http://pastie.caboo.se/119627
Nathan Sutton
fowlduck at gmail.com
rspec edge revision 2910
rspec_on_rails edge revision 2909
rails edge revision 8167
2007 Oct 12
3
Strange mock_model behaviour with ActiveResource model
Hi,
I have two models in an app that inherit from ActiveResource::Base.
The scaffold controller tests for one of the models works fine, but
the other one dies when calling mock_model in the "handling GET
/fa_codes" spec:
Specifically, the call to mock model here:
before do
@fa_code = mock_model(FaCode)
FaCode.stub!(:find).and_return([@fa_code])
end
generates this failure:
2008 Aug 31
9
assigning collection values and exceptions
hi everyone,
I''ve this code in my Report model:
has_many :report_reasons, :validate => true
has_many :reasons, :through => :report_reasons #, :uniq => true
# :accessible => true
def reason_attributes=(reason_attributes)
reasons.clear
reason_attributes.uniq.each do |reason|
reasons << Reason.find_or_create_by_content(reason)
end
end
2007 Oct 31
6
Autotest busted with Rspec/Rails trunk
Just upgraded to latest rails and rspec builds and my autotest doesnt
work
undefined method `before'' for Spec::Rails::DSL::RailsExample:Class
(NoMethodError)
Here''s the full trace:
http://pastie.caboo.se/112754
Any ideas?
--
Posted via http://www.ruby-forum.com/.
2007 Jun 12
3
rspec 1.0.x and liquid?
Is anyone else using liquid with the > 1 rspec? This seems to fail:
it ''should render show'' do
response.should render_template(''buyers/show'')
get :show, :id => 1
end
with an error like
1)
NoMethodError in ''/buyer GET should render show''
You have a nil object when you didn''t expect it!
The error occurred
2012 Mar 13
4
minitest validations - is there a cleaner way?
i am trying out minitest, but need some advice on a clean way to test
validations.
I setup my testing to use minitest by following the following railscast
plus i added miniskirt for Factories.
http://railscasts.com/episodes/327-minitest-with-rails
everything works well, but there has to be a cleaner way of testing failed
validations. would i be better off using something besides
2007 May 05
4
autogenerated it (was ''Custom Matcher and NAME NOT GENERATED annoyance'')
> On 5/5/07, Luis Lavena <luislavena at gmail.com> wrote:
> > describe "A User (in general)" do
> > before(:each) do
> > @user = User.new
> > end
> >
> > it { @user.should have_many(:contest_public_votes) }
> > it { @user.should have_many(:design_industry_user_interests) }
> > it { @user.should
2007 Sep 05
6
Caveman Questions
Hello!
I''m just a caveman with some caveman questions.
I''ve been parsing Rspec for quite a while, and I''m writing my first series
of specs. My initial impressions are "Verbose, but understandable. Helpful
and intuitive, but so much to digest." I want to congratulate the folks who
are dedicating a chunk of their lives to writing this, and ask 2 caveman