Displaying 20 results from an estimated 110 matches similar to: "rspec assert inclusion in.."
2011 Sep 07
4
rspec testing inheritance
Hello,
Is there any way to test model inheritance in spec?
something like..
it { ChildModel.should < ParentModel }
thanks.
2008 Aug 25
21
How much test data to use in specs
I''m not sure how much test data I should be using in my specs. I''m
writing specs for the Property model in my Rails app. Its "address"
attribute is going to be validated with this regex:
/\A\d+[a-z]? [-'', a-z]{2,128}\Z/i
At the moment, my plan is to spec out the following possibilities. A
property is invalid if its address:
1) doesn''t begin with
2009 May 24
11
Class method not being stubbed
Hi guys. I''m setting an expectation on a class method. For some
reason, the method isn''t being stubbed, and the expectation isn''t
seeing the call.
In KeywordListsController#create, I call the private method
#create_keywords_and_associate, which calls AdSenseHeavenParser#parse
.
Thus, some of my specs set an expectation on AdSenseHeavenParser#parse
. However, that
2006 Feb 09
1
Alternative take on Selenium in Rails
Hey there,
There''s been a bit of work going on with Selenium and Rails recently, so
I thought I may as well share what I came up with. Check out my blog
post at http://blog.viney.net.nz/articles/2006/02/09/selenium-testing,
grab the plugin and give it a whirl (be sure to read the README!).
Basically, my approach was to make it possible to write Selenium tests
in the same way that
2008 Oct 20
5
RSpec-Rails bug with to_xml?
Hello, everyone. I''ve been lurking here for a while, but this is my first post.
I think I''ve run into a RSpec bug in a Rails project I''m working on. I
was working on a few REST controllers, and started getting failures on
a specific spec that verified whether a certain action returned XML
output. I spent quite a lot of time checking my code to see if it was
something I
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
2011 Aug 28
1
troubles running rspec..
developing a 3.1 app. trying to run spec on and get this error:
bundle exec rake spec
*****************************************************************
DEPRECATION WARNING: you are using a deprecated constant that will
be removed from a future version of RSpec.
/home/slava/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/
runtime.rb:68:in `require''
* Rspec is deprecated.
*
2011 Mar 06
2
render_views and render_to_string
Hey guys. One of my controller actions uses #render_to_string to send back a
JSON response.
When I try to spec this, Ruby raises a NoMethodError, saying that
#render_to_string doesn''t exist in my controller action.
Here''s the controller action, spec, and output:
http://pastie.org/1640962
Any idea what I''m doing wrong? Thanks,
Nick
-------------- next part
2011 Jan 04
2
Looking for a gem which uses rspec for testing and tests need to deal with database
Let''s say that I develop a gem which adds a new method to
ActiveRecord . Now I want to test this method using rspec. I am able
to get started but not sure where to put the database.yml for testing
purpose.
I was wondering if there is a gem out there which uses rspec for
testing and has to interact to database for testing.
Thanks
2008 Oct 31
2
Stubbing #javascript_include_tag in a helper spec
When writing specs for a helper method, how do you set an expectation
for #javascript_include_tag ?
describe NeighbourhoodsHelper do
describe ''#initialise_map'' do
it ''should include the "foo" JS file'' do
# expectation here
helper.foobar
end
end
end
I''ve tried replacing "# expectation here" with the
2007 May 21
7
How do I stop a column being updated by model.save?
One of my models has a column that is updated very frequently from a
separate process, so it is important that when a record is saved in
rails, this column should be left alone. In the update method of the
controller I have:
@record = MyModel.find(params[:id])
@record.update_attributes(params[:my_model])
params[:my_model] doesn''t have a reference to the column I''m talking
2006 May 26
9
What syntax is this? belongs_to :Person
so when I''m reading the pick axe book second edition I don''t see
anything like the syntax you see people using in rails code.
Specifically when you see.
belongs_to :Person
has_many :Phones
etc
these are methods on ActiveRecord right?
Why is this invocation syntax never described in the Pick Axe book?
I do see things like attr_reader :some_attribute etc but you
2009 Sep 06
1
How many attributes are there of a variable?
Hi,
According to the example below this email, attr(x,"names") is the same
as names(x). I am wondering how many attributes there are of a given
variable. How to find out what they are? Can I always use
some_attribute(x) instead of attr(x, "some_attribute")?
Regards,
Peng
> x=c(1,2,3)
> attr(x,"names")=c("a","b","c")
> x
a b c
2006 Jan 10
5
IP Address
There''s got to be a simple answer: how do you get the IP address of a
visitor in Ruby? Any help would be appreciated!
--
Posted via http://www.ruby-forum.com/.
2013 Mar 26
6
[LLVMdev] Feedback required on proper dllexport/import implementation
Hello,
while improving and extending support for dllexport/import I have
noticed that the current way these are implemented is problematic and I
would like some input on how to proceed.
Currently dllexport/dllimport is treated as linkage type. This conflicts
with inlined functions because there is no linkage for the combination
of both. On first though, combining both doesn't make sense, but
2005 Apr 23
7
Validation question
Hi all,
Is there a way to invoke validations at times other than save, create
and update? I know that I can do this by writing my own validation
checks using errors.add_[blah], but I''d like to leverage the existing
validation code.
What I have is two sets of fields in a record, set A and set B. Both
sets must be validated on record create. However, the trouble is that
after
2013 Apr 23
0
[LLVMdev] Feedback required on proper dllexport/import implementation
Hi Nico, Reid, and Anton,
I missed the discussion when I implemented dllexport/dllimport for our local tree. I
essentially implemented your approach#1. I was trying to avoid the various
external_linkage + some_attribute approaches because it seems that external_linkage
would imply the external linkage without the dllimport/dllexport semantics, and there
may be existing compiler codes that rely on
2009 Jan 02
0
[LLVMdev] TableGen crash
TableGen crashes while building llvm when it tries to generate
/llvm/tools/llvmc/plugins/Base/AutoGenerated.inc from
/llvm/tools/llvmc/plugins/Base/Base.td
As a result AutoGenerated.inc is full of garbage and it's not possible
to proceed any further.
I've debugged TableGen and found out that it dies somewhere in
EmitForwardOptionPropertyHandlingCode().
I've modified
2007 Apr 11
2
Patch for ini plugin
Hi,
recently I took a look at ini to find a bug which made it crash at
startup. While fixing the bug I realized I could do some improvements
to the option reading code (espacally the action part).
So I went on and here we are.
This patch should make ini more robust, clean it up and fix also some
more crashes I had here.
Additionaly, I have a attached a second patch from Maniac which should
fix
2008 Jan 11
1
Remote form for, Form.serialize and parameter arrays
Whenever I use regular form for and have an attribute list containing
an array all goes fine and it results in parameters like:
{"some_attributes"=>[{"title"=>"first_title", "text" => "text1"},
{"title"=>"second_title", "text"=>"text2"}]}
However whenever I submit the same form with