hello there,
how do you tipically spec private methods? The thing is Ï have something
like this:
def some_method
complex_method + other_complex_methods
end
private
def complex_method...
def other_complex_methods ...
and the two complex methods can get really tricky to get right, I would like
hello
2009/10/14 Ashley Moran
> On 14 Oct 2009, at 20:49, Scott Taylor wrote:
>
>> On Oct 14, 2009, at 3:36 PM, Joaquin Rivera Padron wrote:
>>
>> private
>>> def complex_method...
>>> def other_complex_methods ...
>>>
>>> and the two
hi
2010/1/14 John Polling
> Phillip Koebbe wrote:
>
> > Hi John. Maybe this will help:
> >
> > http://www.pragprog.com/titles/achbd/the-rspec-book
> >
> > It's a good book. But when you get to the part about Webrat and
> > Selenium, just know that there are other options if you need them.
>
> Al
hey there
there's also http://bddcasts.com with railscasts like bdd screencasts
haven't check it much myself, but might deserve a look
hth,
joaquin
2010/1/14 Ashley Moran
>
> On Jan 14, 2010, at 1:17 pm, John Polling wrote:
>
> > I think this is the part that I'm confusing myself with as most
those who knows more say the idea is to keep in the example only what is
important for the example (but they surely say it even better than me) which
is what you are doing +1,
greetings,
joaquin
2010/2/18 Matt Wynne
>
> On 18 Feb 2010, at 16:25, m...@franklakatos.com wrote:
>
> I know we are s
hi there,
well I'm not a meister myself, but spec-ing something you don't know the
outside result is a bit hard for me.
I normally work in two modes:
* hacking mode: that's when I'm trying to "see" if I can do something, if
the result will run, getting to know the problem and such. In these mode I
hi there,
I have a Rails model A, that has_one model B, model A have a method called
save_nested_b that:
* context 'invalid B params'
** context 'no nested B exists' => do nothing
** context 'nested B exists' => remove it
* context 'valid B params'
** context 'no nested B exists' => create it
the valid ones
greetings,
joaquin
2010/3/15 David Chelimsky
> On Fri, Mar 12, 2010 at 7:45 AM, Joaquin Rivera Padron
> wrote:
> > hi there,
> > I have a Rails model A, that has_one model B, model A have a method
> called
> > save_nested_b that:
> > * context
maybe then check http://github.com/cavalle/steak
joaquin
2010/4/29 Martin DeMello
> On Tue, Apr 27, 2010 at 3:32 PM, Matt Wynne wrote:
> >
> > Should be fine, though you might find cucumber/aruba a nice combination
> for
> > this too.
>
> Cucumber seems to make things a lot more verbose :( Ver
hi there,
we all know good principles of OOP and P in general. But I found today that
would be good to know which links (e.g [1] [2])books|reads would you
recommend on the topic
greetings,
joaquin
[1] http://c2.com/cgi/wiki?PrinciplesOfObjectOrientedDesign
[2] http://www.industriallogic.com/paper
hi,
at work we use TestUnit, and I miss there a lot the shared_examples from
RSpec, do you know if is there something alike for TestUnit?
I know this might be a bit OT but I thought you probably might know :-)
tia,
joaquin
--
para.pent.es vamos a volar, let's go flying
least-significant-bit.com
> You ask how to implement such a step?
yes
> I've done this by using Hpricot - fetching the item-lines from the result
into
> an array and checking this for the right order.
thanks Peter, seems I will give that a try, though I like you do not like
very much
joaquin
__
hi there,
I would like to assure in my scenario that the list shown is in the correct
order (e.g. ASC or DESC).
I can spec that but I feel it would be more client-oriented if I could do it
in the feature... any ideas?
thanks,
joahking
___
rspec-users ma
> Matt Wynne:
> How about something more like
>
>Given there are two items in a list: "Zulu and Abba"
>And I have sorted the list alphabetically
>Then "Abba" should appear before "Zulu"
>
> Then /"(.*)" should appear before "(.*)"/ do |first_example,
> second_example|
>response.bod
hey there,
I've come back to one Rails 2.1.0 project and notice that using
ruby script/generate rspec (or the cucumber one)
produces this warning:
Warning: Gem::SourceIndex#search support for Regexp patterns is deprecated
the generators work anyway and this warning is not seeing on rails
2.1.[g
ooops, The files generated with rails 2.1.0 with
ruby script/generate cucumber
are not good actually. When running features nothing got printed in
console.
I solved it by _sort of_ following one of your tips at lighthouse:
* switch project to rails 2.1.2
* generated the cucumber files again
*
hello there,
Sometimes I find easier to browse my specs directly on the browser to have
an overall idea of the logic.
To do it I have put up a simple rack app to:
- browse the contents of /spec directory on rails root
- run each spec and view the html formatted output (it does spec FILE -f h)
It
hello there,
I've added support to browse/run cucumber features to the app, check it out
in gist:
http://gist.github.com/43149
right now you can:
browse your spec/ and features/ directory
run specs and feature files living there.
it is only a .rb script to put into spec (or features) directory
I
hey fernando,
maybe you want to take a look at
http://www.patmaddox.com/blog/2009/1/15/how-i-test-controllers-2009-remix
and give Cucumber a try regarding controllers spec-ing
hth,
joaquin
___
rspec-users mailing list
rspec-users@rubyforge.org
http://ruby
hey there,
I've been playing with Scenario Outline according to cucumber wiki. I have
paste the tests made in http://gist.github.com/59920
the short answers:
http://wiki.github.com/aslakhellesoy/cucumber/scenario-outlines seems
inaccurate, Examples should be More Examples. Should I edit the wiki f
2009/2/7 Nick Hoffman
> When writing Cucumber stories and features for controllers, should you
> cover every edge case? For example, should you write stories that feed bad
> or missing data to your controllers, or should that be left to RSpec?
> -Nick
the missing data case should be left for a
hey thanks joseph,
I tried this out:
$ ruby script/plugin install git://github.com/dchelimsky/rspec.git -r 'tag
1.1.12'
$ ruby script/plugin install git://github.com/dchelimsky/rspec-rails.git -r
'tag 1.1.12'
now Webrat finds correctly rspec-rails. Before it was a system gem and so it
failed, and
kaleem,
method new does not run your model validations, neither does your provided
activate! implementation.
but save indeed does.
my guess is your mixing several contexts (cases, situations) in your single
spec. Try decoupling all with more granular examples and you'll get to save
shore :-)
cheers
hey there,
I've been using Cucumber + Webrat for a while. The time has come to spec Js
and Ajax, so I've been playing around with celerity features (with culerity
until now).
1. How usefull would be to have a common API between Webrat and Celerity?
I found usefull to translate webrat steps painle
hey Ben,
thanks for your answers,
I'll give kamal work a try and have a look at the points you are pointing
about webrat.
I've been playing with culerity for two days and it does not sound difficult
to accomplish this we are talking.
But I was talking from the culerity part (haven't look too much
hey there,
the short version:
right now Cucumber provides hooks Before and After to be run around every
step, I have notice some use case where BeforeAll and AfterAll hooks would
be useful.
are ther plans that they be provided? what you think would be the best place
to do it (mother_step.rb)? any i
cool thanks,
joaquin
2009/2/15 Ben Mabey
> Zach Dennis wrote:
>
>> On Sun, Feb 15, 2009 at 2:21 PM, Joaquin Rivera Padron
>> wrote:
>>
>>
>>> hey there,
>>> the short version:
>>> right now Cucumber provides hooks Before and After to
hey Kaleem,
I am myself no expert on w$ but the line throwing the error is
def self.run_server
IO.popen("jruby #{__FILE__}", 'r+')
end
are you able to run popen calls in w$ ? try your irb and see, if not maybe
there's some w$ expert who can help
hope that helps
joaquin
hey there,
I have Cucumber running Webrat and Celerity (using culerity) together, check
it out in the sample project:
http://github.com/joahking/cukes/tree/masters
It's a first try, but it runs. I get them by following a feature directory
structure similar to the suggested in
http://wiki.github.co
cool, I'll give that a try in short
thanks
joaquin
2009/2/22, aslak hellesoy :
> On Sun, Feb 22, 2009 at 1:42 PM, Joaquin Rivera Padron
> wrote:
>> hey Kaleem,
>> I am myself no expert on w$ but the line throwing the error is
>> def self.run_server
>>
>
> Full release notes are available at
> http://github.com/aslakhellesoy/cucumber/blob/d0555e4ca8a133f020efefd5a755da04bde3f57d/History.txt
>
> (::) Aslak (::)
wow! amazing how much the cukes have accomplished,
keep on the good work
cheers,
joaquin
--
www.least-significant-bit.com
__
by the way, cool presentation at mountain west :-)
congrats
2009/4/7 Scott Taylor
>
> On Apr 7, 2009, at 5:19 PM, aslak hellesoy wrote:
>
> Ben Mabey has accepted my invitation to be on the core Cucumber team.
>> Ben has been a long time contributor to Cucumber's ecosystem and knows it
>> insi
hey there,
this here may be a little too general, and maybe is only a though sharing,
but would be nice to hear what you think.
What is your opinion about expectation steps that negates another
expectation step?
for example: let's say I have a step that specs something:
Then /^I should see the p
at the moment I do it this way, hiding the complexity out of the steps:
Then /^I should see the people search form$/ do
people_search_form_exists
end
Then /^I should not see the people search form$/ do
people_search_form_exists "not"
end
and then the method:
def people_search_form_exists ne
hey there,
maybe you should take a look at solutions that fake your database in memory
for such cases, saving your time doing all that stubbing and mocking, I
don't remember right now but I think I saw some projects for such approach,
maybe someone knows better than I do :-)
hth
joaquin
__
thanks matt,
yes, the regexp in the step matcher is a good one to dry it up
So I end up with this one:
Then /^I (should|should not) see the people search form$/ do |maybe|
people_search_form_should_exist maybe == "should"
end
and the method:
def people_search_form_should_exist it_should_exist
wow! even shorter :-)
2009/4/16 Matt Wynne
>
> On 16 Apr 2009, at 14:06, Joaquin Rivera Padron wrote:
>
> thanks matt,
>> yes, the regexp in the step matcher is a good one to dry it up
>>
>> So I end up with this one:
>>
>> Then /^I (should|should n
well, that was the vague idea I had when asking at first, but I don't think
every multi-should or should_not step can be in general negated,
by the way, Lenny's one have come to be my preferred solution
joaquin
___
rspec-users mailing list
rspec-users@r
ok, let's say:
Then /should see "(.+)"/ do |text|
# a binary step, easily negable
end
Then /I deny some steps/ do
# really not so readable
Not Then "should see \"your are not log in\""
Then "some other step that holds"
# another way of saying it bad
But Not Then "should receive inf
>
> Frankly, I don't think I'll ever implement a cute feature in Cucumber that
>> allows you to have out of the box negation. It would be ugly no matter how
>> it's done, and it would only save you a line or 2 of code.
>>
>
> fwiw, +1 on that. refactor to a descriptive method and get used to
> ref
hi there,
In a step I need to assert (don't know hoe to translate this into "should"
terms) state before keep going, example:
Given "I have signed up as tom who is an admin" do |user, role| do
# call some steps to create user tom
end
___
rspec-users
>
> hi there,
> In a step I need to assert (don't know hoe to translate this into "should"
> terms) state before keep going, example:
>
> Given "I have signed up as tom who is an admin" do |user, role| do
> # call some steps to create user tom
>
> end
>
oops, sorry that was gone unfinished!
G
hey ben, thanks,
your solution works :-)
luckily(!) a typo make get me to some prettier way (doing what webrat does),
first namescoping the matchers:
module MyCustom do
module Matchers do
Spec::Matchers.define :have_rol do |role|
match do |user|
user.roles.collect{ |r| r.na
>
> Spec::Runner.configure do |config|
> # rspec should support :type => [:controller, :helper, :view] - but until
> it does ...
> config.include(Webrat::Matchers, :type => :controller)
> config.include(Webrat::Matchers, :type => :helper)
> config.include(Webrat::Matchers, :type => :view)
>
hey scott,
thanks for your answer, but I still don't seem to get the 'contextual' part
of the validations
I am missing something? (it's maybe thay I should get some sleep)
cheers,
joaquin
___
rspec-users mailing list
rspec-users@rubyforge.org
http://ruby
hey there,
I have a question that may be raised from some misunderstanding of my
current problem. But the answer might well serve me for other things.
The issue is I would like to be able to metaprogramatically (this may be a
bad chosen word) generate spec examples to check a model is valid again
hey guys,
now I got it! the thing I was not seeing was the instance.should
validate_... validation evaluation, I end up doing this:
- create the object with desired state,
- then iterating over all its attributes and
-- validating required ones
-- and not_validating not required ones.
The key is
hello there,
what is the best (or any) way of mocking the running of shell commands?
e.g.
code like the following:
%{ ls }
spec:
it "should list the directory contents"
shell = mock(Object) # %{} lives in Kernel module and its sugar for `
end
___
r
%{} lives in Kernel module and its sugar for `
shell.should_receive(:`).with(:ls)
end
sorry about latter one, thanks in advance
joaquin
2008/9/12 Joaquin Rivera Padron <[EMAIL PROTECTED]>
> hello there,
> what is the best (or any) way of mocking the running of shell commands?
&g
thanks,
I'll give that a try
joaquin
2008/9/12 Matt Wynne <[EMAIL PROTECTED]>
> On 12 Sep 2008, at 14:12, Joaquin Rivera Padron wrote:
>
> what is the best (or any) way of mocking the running of shell commands?
>
> e.g.
> code like the following:
>
> de
hi,
this did the trick:
class Shell
def self.sh command
%{ command }
end
end
then I am able to:
it "should be mock alright" do
end
2008/9/13 Scott Taylor <[EMAIL PROTECTED]>
>
> On Sep 12, 2008, at 9:29 AM, Matt Wynne wrote:
>
> On 12 Sep 20
mails all of a sudden)
thanks guys
joaquin
2008/9/13 Joaquin Rivera Padron <[EMAIL PROTECTED]>
> hi,
> this did the trick:
>
> class Shell
> def self.sh command
> %{ command }
> end
> end
>
> then I am able to:
>
> it "should be mo
cool, thanks
2008/9/13 Matt Wynne <[EMAIL PROTECTED]>
> On 13 Sep 2008, at 13:42, Joaquin Rivera Padron wrote:
>
> hi,
> this did the trick:
>
> class Shell
> def self.sh command
> %{ command }
> end
> end
>
> then I am a
hi there,
I've been spec-ing classes in my lib/ directory, but until now only get spec
to run using:
script/spec spec/lib/
is there a way to make autotest load specs for this directory too?
thanks in advance,
joaquin
___
rspec-users mailing list
rspec-
hey Mark you're right,
all of a sudden I notice that specs in lib/spec do really get runned by
autotest...
I'll try to repeat the case in another project, I guess maybe only after
autotest reruns *all* the specs (it does so from time to time) is that *new*
directories inside spec/ get runned, or
oopps, here:
all of a sudden I notice that specs in* lib/spec* do really get runned by
autotest...
i meant:
all of a sudden I notice that specs in *spec/lib* do really get runned by
autotest...
thx
joaquin
2008/9/18 Joaquin Rivera Padron <[EMAIL PROTECTED]>
> hey Mark you're right
hi there,
you might wanna be insterest in this talk on Stories DD by webrat maintainer
at GoRuCo 2008 http://goruco2008.confreaks.com/01_helmkamp.html
there he hightlights the workflow like this:
1. Write scenario (yellow color)
2. Write steps matchers (red color)
3. Write code (green color)
4. re
57 matches
Mail list logo