Displaying 20 results from an estimated 400 matches similar to: "File.should be_exist?"
2007 Feb 13
3
"should.be_in [values]" and "each_should_satisfy"
Hi!
I just started using RSpec and have some question that I couldn''t find
answers to.
If I have a result that can have two valid values, is there a better way
of writing
the following assertion?
[value1,value2].should_include actual
Is there a more elegant way of performing should_satisfy on a
collection, for
example I currently use something like collection.each {|x|
2007 Jul 19
1
stopping on first failure
Hi!
Is there an option that I could provide to the spec runner that would
make it stop after it
encounters the first spec that fails?
Esad
2007 Feb 20
1
having should_receive expectation for things that happen in setup
Hi!
The following example doesn''t work for me: http://pastie.caboo.se/41732
However, if the call to msg() happens in the specify block after the
expecation and not in the setup, it will pass.
Why is this? I thought the setup method was there to actually
''construct'' the context and the specifications are some kind of
"postconditions" that only need to be
2006 Mar 01
5
single transaction migrations
Hi!
It seems that migration doesn''t use single transcation to execute the
needed migrations for the database upgrade, so if I have database at
version 5, and I wrote some migrations 6..10, and error occurs while
executing migration 7, the database stays in state 6?
I also think that migration taks could use some more verbosity, for
example if migration fails, there''s no
2007 Apr 04
1
pontential bug in rspec_on_rails and ActiveRecord transactions
Hello rspec-users,
I''ve encountered a strange bug in rspec, but it may be me who is wrong.
I''m running latest version from the trunk (r1678) of both rspec and
rspec_on_rails.
Please consider the following model:
class Url < ActiveRecord::Base
def after_save
Contact.create!(:primary_email => ''user at example.com'')
raise
2006 Feb 17
1
foreign key support in mysql adapter
Hi!
I''m using Migration to define my database schema and these "ALTER TABLE
t ADD FOREIGN KEY..." look really ugly - that''s why I wanted to ask it
would be possible to simply add add_foreign_key method to ActiveRecord?
Are there any reasons this isn''t yet implemented?
Greetings,
Esad
--
Posted via http://www.ruby-forum.com/.
2006 May 08
4
rake db:migrate
Would it make sense for rake db:migrate to support creating databases if
it is not found, with blessing from user to prevent typos, or as an
additional command line switch.
Or am I just being too lazy?
--
Posted via http://www.ruby-forum.com/.
2006 Mar 07
1
decorators for models?
Hi!
I''m thinking of implementing datagrid like functionality for showing
data (models) in grids so that I don''t have to re-invent the
view/controller for each table I need. There are number of parameters
that need to be customizable: column titles, row style depending on the
data (i.e. showing all rows with balance<0 in red), is column sortable,
sort-algorithm etc.
To
2006 May 11
1
rendering in after_filter
Hi!
Is it possible to render the action within the after_filter method, or
is the rendering performed before?
I have something like this:
class FooController
after_filter :send
def a
@content=...
end
def b
@content=..
end
protected
def send
send_data(@content,...)
end
end
However, when calling the action a or b, the @content doesn''t get sent,
but instead
2006 Mar 21
1
including templates/views in plugins
Hi!
I''m writing a datagrid plugin and would like to render the datagrid
using a .rhtml template. However, I''d like to avoid placing this
template in app/views/shared, but it should reside somewhere within
vendor/plugins/datagrid/...
Any ideas?
--
Posted via http://www.ruby-forum.com/.
2007 Apr 17
7
rspec with CI
I am a bit of a rails and rspec noob.
I am trying to use rspec in conjunction with CruiseControlrb.
When I run a cruise build having spec errors, the build does not
indicate a failure. I have tried to track down why this is the case,
and my best guess is that the spec task is kicking off the spec via a
ruby() method in rake, and that ruby method does not propagate my spec
failure back to
2012 Apr 04
5
Simple code dosn't work
I think you have a syntactical error on the line thats throwing the
error, you state:
> j.even?should be true #throws an error on j == 2, j == 4
should this line not read as:
j.even?.should be true
--
Posted via http://www.ruby-forum.com/.
2008 Jun 12
2
Use of ''should'' in another thread
Hi,
I''ve tried to find anything about using ''should'' within a Thread, but
it is a little hard do look up there, so I hope you forgive-me if I am
asking an "old question".
I guess this spec should fail:
describe Thread do
it "must be fine" do
Thread.new { true.should_not be_true } # Why don''t fail?!
end
end
It seems that some
2007 Oct 04
7
Using Predicates to look at an array..
Hi all,
I have an array of shipping_type''s being returned, and I want to see
what is in there. In the past I have done:
shipping_type.include?(Cart::SHIPPING_TYPE_REGULAR).should be_true
This works, but looks really ugly.. It just doesn''t roll of the
tongue very well. I then looked up the use of Predicates, which I
had been using, but hadn''t realized:
2012 Feb 23
2
testing around_save
I''ve just upgraded to Rails 3.2.1 and I can''t get my specs checking
whether or not around_save work anymore.
I simply did something like:
object.should_receive :around_filter_name
object.save.should be_true
(Actually, it was slightly more complex, it''s part of a state machine)
2008 Aug 27
3
array_including()
I found myself having to write this today:
class ArrayMatcher
def initialize(array_to_match)
@array_to_match = array_to_match
end
def ==(other)
ok = true
@array_to_match.each do |item|
ok = ok and other.include?(item)
end
ok
end
end
def array_including(array_to_match)
ArrayMatcher.new(array_to_match)
end
Is there already something in the
2007 Jul 31
11
helper spec not finding rails core helpers
Hi,
My helper specs were going ok until I added a call to a rails
DateHelper method in one of my helpers
http://api.rubyonrails.com/classes/ActionView/Helpers/
DateHelper.html#M000574
The helper runs fine from my view templates, just dies in the spec test.
I boiled my question down to a simple (not too useful) example. I''m
not sure what I''m missing.
#
2012 Sep 15
2
[RSpec Testing] Methods take two arguments
Hello,
Here is my *pdf_helper.rb* => http://pastebin.com/QU1kTKXk. I want to test,
if self.create method can take more than two arguments. But, when I try to
run my test. It showed
*PdfHelper Should have two arguments
Failure/Error:
create_pdf.should_receive(object,template).with(user,file)
NameError:
undefined local variable or method `create_pdf'' for
2007 Sep 04
3
Model Specs: Fixtures vs Mocks + Stubs?
What is the general opinion about fixtures versus mocking and stubbing
in model specs? I heard from agile on IRC that they save the database
testing for integration testing, but I also see that the caboose
sample applicaiton uses fixtures. I also noticed that on the rspec
site, it says "Ironically (for the traditional TDD''er) these are the
only specs that we feel should actually
2011 Mar 03
1
Does RSpec interfere with Pathname#dirname or Pathname#realpath ?
Hi,
I starting a new project, and have run into behavior I cannot
replicate in irb, (i.e. outside of using rspec) when the directory?
returns true, so I thought I''d ask here, in case any one has seen this
badhavior.
ruby-1.9.2-p136
rspec (2.5.0)
rspec-core (2.5.1)
rspec-expectations (2.5.0)
rspec-mocks (2.5.0)
When I try to run this spec:
require Pathname(__FILE__).ascend { |d|