Hello,
I am trying to write the specs for controllers that use
InheritedResource.
Can somebody tell me if this is possible?
I have read that I have to use integrated_views, but even in that case
it doesn't work.
I have posted a message in the InheritedResources group and Jose Valim,
has answered,
Hello
I am trying to spec a singleton ruby class,
And I am having a little trouble because my specs are not more isolated,
as I am getting the same instace of the class for all my examples.
How should I do this.?
Which is the correct way of specing a singleton class?
Thanks
Juanma
--
Posted via
2010 at 6:03 AM, Juanma Cervera
> wrote:
>> Hello
>> I am trying to spec a singleton ruby class,
>> And I am having a little trouble because my specs are not more isolated,
>> as I am getting the same instace of the class for all my examples.
>>
>> How sh
Ben Mabey wrote:
> Spec::Runner.configure do |c|
> c.before(:each) do
> ActiveRecord::Base::establish_connection :secondary_db
> DatabaseCleaner.start
> ActiveRecord::Base::establish_connection :primary_db
> end
>
> c.after(:each) do
> ActiveRecord::Base::establish_connection
Hello
How can I test equality with two objects when they include some
attribute that is BigDecimal?
if I make something like this:
it "should ...whatever" do
obj = Factory.create(:my_object)
...
MyObject.first.should == obj
end.
FAILS
This fails because the object expected is different fr
David Chelimsky wrote:
> On Jul 8, 2010, at 5:04 AM, Juanma Cervera wrote:
>
>> end.
>>
>> FAILS
>>
>> This fails because the object expected is different from the object
>> gotten, and the only difference are the BigDecimal attributes, that are
>&
The updated_at has class ActiveSupport::TimeWithZone
v.updated_at.should == f.updated_at fails
v.updated_at.to_datetime.should == f.to_datetime.updated_at fails
v.updated_at.to_s.should == f.updated_at.to_s works
v.updated_at.to_i.should == f.updated_at.to_i works
And adding this method to the m
"input#cliente_telefono[name=?]", "cliente[telefono]")
end
end
end
and throw this error:
undefined local variable or method `controller' for
#
Why?
How can I mock the current_user helper for using in my views?
Thanks
Juanma Cervera
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
del(User, :role => "whatever")
and I could check the role of the user in the view with
current_user.role.
Was it correct or I had to do it in another way?
Thanks
Juanma Cervera
--
Posted via http://www.ruby-forum.com/.
___
rspec-us
Thanks Craig, but I think I don't understand completely.
"current_user" is a helper method provided by the plugin
restful_authentication
to access the @current_user variable as I understand.
It is defined in lib/authenticated_system.rb.
We use this helper to access the current logged-in user in t
I have this statement in the layout of my application (using haml)
- if request.env["HTTP_USER_AGENT"].include?("MSIE")
= stylesheet_link_tag 'blueprint/ie.css'
= stylesheet_link_tag 'confirm_ie.css'
The problem is that request.env["HTTP_USER_AGENT"] is nil when I go to
some page in the feature
Thanks Matt.
I have check the rails api and see that I can pass a hash with the
headers as a parameter with the post command.
post "/session",
{:username => 'matt', :password => 'secret'},
{:HTTP_USER_AGENT => "MSIE"}
and this works for me, by now, I don't know if I will have
Well, Matt was right.
I have not got the solution for my problems.
The problem is that I can't set the headers with click_button or visits.
If anyone knows how to set the request headers with these methods of
webrat, this would be very helpful.
Thank yus
Matt Wynne wrote:
> Cool.
>
> Be aware
Zach Dennis wrote:
> In #rspec the instructions for installing rspec and rspec-rails on a
> Rails project. Specifically talking about the following line from
> http://github.com/dchelimsky/rspec-rails/wikis/home
>
> config.gem "rspec-rails", :lib => "spec"
>
> I think this should be updated to
Hello.
I have a problem trying to use cucumber with webrat.
I thought I could use the gems versions of rspec, rspec-rails, cucumber
and webrat, in fact I think that I could manage to do it two weeks ago,
but now that I updated the versions of the rspec, rspec-rails and
cucumber, I am getting a err
Thanks Mark
That was the problem
Mark Thomson wrote:
> The webrat gem works for me. Do you have "require 'webrat'" in your
> features/steps/env.rb file?
>
> Mark.
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyf
I've gota a question.
Is the beta for the book coming soon before Christmas or
do I better think in something different from Santa Claus?
Oh. Please!!
Juanma
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rub
Hello
I am starting using cucumber with an app using restful_authentication.
I am having an error that is driving me mad.
I am using this step
Given /^que he hecho login en la aplicación$/ do
user = User.create!(
:login => "mi_login",
:name => "mi_nombre",
:email => "mi_lo...
l.
I think this is a bug, but I don't know.
Cheers and many thanks.
Juanma Cervera.
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
.html in /public folder , when I removed
it, I has the same error.
Juanma Cervera
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
Hello
I want to use the cucumber command to run only the feature I am working
on now.
But I have a structure of folders like this:
features/
administracion/
alta_centros.feature
modificacion_centros.feature
step_definitions/
steps_for_centros.rb
...
step_def
Mischa Fierer wrote:
> try:
>
> rake features FEATURE=features/administracion/alta_centros.feature
It works.
Thank you very much
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mail
I am fighting with an error using rspec-on-rails-matchers.
I have a model called "Centro" based in this table
create_table "centros", :force => true do |t|
t.string "nombre"
t.string "cif"
t.string "domicilio"
t.string "codigo_postal"
t.string "poblacion"
t.str
Well, it seems tha the error is indeed in the stubbing of the find
method in the class of the model.
def validate_uniqueness_of(attribute)
return simple_matcher("model to validate the uniqueness of
#{attribute}") do |model|
model.class.stub!(:find).and_return(true)
!model.valid? && mod
David Chelimsky wrote:
> I'm not really sure why this is stubbing find, or why the stub value
> is true instead of a model. Actually, I don't even see how this would
> specify validating uniqueness of the attribute without very specific
> setup:
>
> first = Centro.create(:nombre => "example")
> s
:Matchers
==
How should I require 'activerecord'?
Or how I have to do the setup for testing/specing plugins?
Any URL for that?
Thanks
Juanma Cervera
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
I am having some trouble using step tables.
I am trying with an step similar to the sample step generarated by the
cucumber generator
Then /^I should see the following froobles:$/ do |froobles|
froobles.raw[1..-1].each_with_index do |row, i|
row.each_with_index do |cell, j|
response.s
> ¿Where is the method raw defined?
Sorry this is stupid.
Forget my last question
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
Can somebody confirm that the have_selector method yields to the block?
In all the test I have done it seems it does not work.
I even have try an step like this
when /whatever / do
response.should have_selector("table > tr:nth-child(#{2}) >
td:nth-child(#{1})") { |td|
td.inner_text.should
g the block for the have_selector with
do...end instead of {...}
And it didn't work in these case.
Is this a bug or is it a special feature of this construct.
Juanma Cervera
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mail
'Yes'
Then I see "Ok"
And I go to "/services/1"
Is this ok or I should define the features with only one single
iteration?
Juanma Cervera.
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-us
Thank you David.
All make a lot of sense.
With the urls I only was trying to clarify that the scenario spans
across multiple controllers, but I am making the specs as you recommend.
Juanma
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mai
Jonathan Linowes wrote:
> On Jan 14, 2009, at 11:39 AM, Tom Hoen wrote:
>
>> Posted via http://www.ruby-forum.com/.
>> ___
>> rspec-users mailing list
>> rspec-users@rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>
>
> for example,
Is it possible to mix a normal parameter argument for a step, with
tabular data?
Something like this:
Given there is a country "Spain" with the cities:
|name |
|Madrid|
|Barcelona |
|Valencia |
And this step_definition
Given /^there is a country "Spain" with the cities:$/ do |
manually between two sequential
runs of cucumber.
rake features, make db:test:prepare automatically.
But cucumber no.
Isn't it a bug or it's correct? and I have to delete my data each time
when using cucumber command.
Juanma Cervera
--
Posted
Aslak
The documentation in this wiki is the best I have ever seen, and it's
constantly being improved.
Very good job
and thanks.
Juanma
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge
of the feature.
In that case I have to call manually db:test:prepare to clean up the
database.
But it works like expected when I move the setup to the Scenario.
Juanma Cervera
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing l
For now I am running this command (together)
rake db:test:prepare && cucumber -r features -l es
features/reservas/creacion_reserva.feature
Juanma
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://
I have just gone to "Pragmatic Programmers" and spent my money in the
book I have dreaming for six months. :)
Maybe I'm the first :)
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/ma
Hello
I have seen that some people in this list is using Fixjour as the
replacement of fixtures.
But I can't understand why it is superior or better than other
approaches to the subject like Machinist o FactoryGirl.
What are the problems this library resolve?
Can somebody explain this a little.
T
I'm sorry for the question.
I have just seen that this question is already treated in a very near
thread.
I didn't see it.
Juanma
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/ma
David,
I have an error when trying to run autospec.
It works when I run 'rake spec'
I don know why it is still using the rspec-1.1.12 gem.
/usr/lib/ruby/gems/1.8/gems/dchelimsky-rspec-1.1.99.7/lib/spec/autorun.rb:3:
undefined method `autorun' for Spec::Runner:Module (NoMethodError)
from /usr
Trying the next release of rspec, I have had to make changes in the
existing specs for routing.
I have written an script with sed that makes this automatically (two
files)
spec/upgrade.sed
/route_for/s/id => 1/id => "1"/g
/route_for.*create/s/== \(["'].*["']\)/== {:path => \1, :m
Hello.
I am having strange errors running some specs.
I have just installed the nifty_scaffolds gem from Ryan Bates, and ran
"script/generate nifty_authentication --rspec --haml", I have prepared
the databases, and run the specs, and I have almost all the specs
failing.
The odd thing is that it o
Well
It seems that the problem is not with the view integration but with the
fixtures.
I didn't know if the fixtures loaded in the spec of a controller may
affect the specs of the model, but they indeed do.
I thought each spec runs in its own database transaction and the data
does not affect oth
Hello
I am learning rspec and trying to especify the activerecord validations
of my models.
How would I make a require_uniqueness_of specification for a field.
Can I make this with mocks, without touching the database?
Can somebody point me to some information or plugin for this issue.
Thank you
chers/
¿What do you think of using this plugin?
Juanma Cervera.
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
Hello.
I have some troubles with rails edge and decide to try rspec-1.1.4.
I have installed the plugins downloading the tarballs from github, and I
have this error message when I run autotest.
/home/jmcervera/work/chapado2/vendor/plugins/rspec_on_rails/lib/spec/rails/version.rb:11:
(RuntimeError)
Thanks Pat
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
Hello.
I have lost the coloured output in autotest after updating to rspec
v1.1.4
I was already using the edge version and was ok then, before the last
update.
Anyone knows something about this?
Thank you.
--
Posted via http://www.ruby-forum.com/.
__
David Chelimsky wrote:
> On May 29, 2008, at 1:19 AM, Juanma Cervera wrote:
>
>> Hello.
>>
>> I have lost the coloured output in autotest after updating to rspec
>> v1.1.4
>> I was already using the edge version and was ok then, before the last
>> updat
Excuse me Luis.
These are the versions I am using.
OS: Ubuntu 8.04
Edge Rails revision 888a2927b65889465ce7a1a71e87d37640a2b41b
ZenTest 3.9.2
rspec 1.1.5 a021e7bdc0d65ab40ad4d441ab8844bcd9c12f0c
rspec-rails e52bc93ce598f21da00cd0589cb7cebd2c1c5130
--
Posted via
David Chelimsky wrote:
> On May 29, 2008, at 6:09 AM, Luis Lavena wrote:
>
>> On Thu, May 29, 2008 at 5:19 AM, Juanma Cervera <[EMAIL PROTECTED]
>> forum.com> wrote:
>>> Hello.
>>>
>>> I have lost the coloured output in autotest after updating t
This was an error, but I thought it was corrected by D. Chelimsky.
Check this topic:
http://www.ruby-forum.com/topic/154595
Juanma Cervera
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http
I know that David Chelimsky and Aslak Hellesøy were writing a book about
rspec for the pragmatic programmers.
And I hoped it would be available as a beta book. will it be?
David or Aslak, I would like if you can tell us something about the
book.
When can we expect it to arrive?
Or maybe anyone k
Hello,
I am having trouble to mock the chaining of named_scope in the
controller, also I would like to use will_paginate.
def index
@things = Thing.allowed_for(@current_user).available.paginate :page =>
params[:page]
end
¿How to do it?
Thanks
Juanma Cervera
--
Posted via http://www.r
Maybe "utilization" is not correct an english word.
I'm not sure.
I would change the words in the subject
Juanma Cervera
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyfo
Very clear.
Thank you very much Pat!
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
gainst the database and
think
that this time I have to test only the chaining and not the result.
Juanma Cervera
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
I think you're right Pat.
Thanks for your answer.
Juanma
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
to modify some rakefile?
Thanks.
Juanma Cervera
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
nk "script/cucumber.rake" must be wrong,
and it must be renamed to "script/cucumber", right?
And all works.
aslak hellesoy wrote:
> On Fri, Sep 26, 2008 at 1:19 PM, Juanma Cervera <[EMAIL PROTECTED]>
> wrote:
>
> ruby script/cucumber --help
>
> There you sh
62 matches
Mail list logo