Displaying 20 results from an estimated 9000 matches similar to: "BDDish rspecish question"
2007 Dec 20
3
How-to spec this helper method?...
Hey gang,
I have this dead-simple method defined in a helper:
def add_category_link(name)
link_to_function name do |page|
page.insert_html :bottom, :categories, :partial =>
''category'', :object => Category.new
end
end
Where, and mostly how, would I spec this? I haven''t been able to find
how to stub the rjs in a helper spec, so
2008 Mar 13
22
Specifing methods in a steps_for block
Hey list,
I''m refactoring some much-used functionality into a common_steps step
group. Methods like this are in there:
steps_for :common do
Given "a number of existing $types?" do |type|
@initial_item_count = type.singularize.classify.constantize.count
end
When "the user adds an invalid $type" do |type|
post
2009 Feb 02
5
[Cucumber] Cucumber and acts_as_xapian
Hey list,
Anyone have experience with acts_as_xapian and Cucumber? I''m
struggling with updating xapian''s index, to actually "find" fluff
that has been indexed..
In a scenario, I''m adding a bunch of articles, and in the actual
search step, I run:
When "I search for \"$query\"" do |query|
%x[rake RAILS_ENV=test xapian:update_index]
2009 Jan 17
3
[Cucumber] Struggling with "multiple step definitions"
Hey gang,
I find myself struggling with multiple step definitions in cucumber
all the time. I regularly test the contents of my flash[:notice] in
steps, since I think that''s part of the behaviour of the app. So,
while implementing a new feature, I ran into the following error:
/opt/local/lib/ruby/gems/1.8/gems/cucumber-0.1.15/bin/../lib/cucumber/
step_mother.rb:81:in
2007 Dec 14
9
new home for the rspec website
Hi all,
We''ve moved the rspec website to http://rspec.info. We want
http://rspec.org, of course, but someone is squatting on and has yet
to respond to my email :(
The 1.1.0 docs are there. The 1.0.8 docs are still at
http://rspec.rubyforge.org for the time being. We''ll be archiving them
at the new site soon.
This new site is hosted on our shiny new sponsored slice at Engine
2007 Oct 05
20
RSpec Book(s) on the radar
I just found this one: http://tinyurl.com/3c3mfa
David, are there any other RSpec books in the works?
With Regards,
Cody Skidmore
2009 Feb 28
7
be_valid (validates_format_of ..., :on => :create)
Greetings,
How to write Example which will check if model''s variable''s
format is valid using :on => :create, like this:
class User < ActiveRecord::Base
...
validates_format_of :email, :with => /.../, :on => :create
...
Using following code is not right:
it "should ..." do
@user = users(:example_user)
@user.email =
2008 Jun 04
8
Why has the --color gone from my life?
Hi all,
Running on OSX 10.5.3, Latest Rspec trunk, Rspec rails trunk, latest
autotest gem and rails 2.1
I''ve lost my colour output in autotest.
rake spec gives colour output, but autotest gives me black and white.
It was working a little bit before, I think I upgraded to the latest
versions of everything to get all the textmate snippets talking and being
friendly to one another again
2009 Feb 04
2
Can cucumber/webrat set a value on a hidden field
I am using auto_complete to provide a list of persons from which the
user can select one. On selection from the auto_complete list, a hidden
field is updated with the id of the selected person. This is all wrapped
in a form, that then can be submitted by the user (by clicking the
provided submit button). On submission, the person (based on the id in
the hidden field) is added to a group.
I assume
2006 Aug 12
1
Strategy pattern: comparing Context/Specify to Given/When/Then
Comments and suggestions for improving the specifications are welcome.
Thanks,
Alvin
One example comparing context/specify (CS) with given/when/then (GWT)
with a strategy pattern follows:
Consider a pipeline transporting oil supplied by multiple partners.
The amounts transported on behalf of each partner are recorded as
transactions in a general ledger.
There are multiple approaches to
2006 Oct 15
2
*what* to test?
So I dig rspec and BDD, of course. I thought that Dave''s Google Video
was a great intro () -- even if it was a bit heavy on theory and a bit
loose on the nuts and bolts. But I don''t see anyone sufficiently
answering the big question:
What do you test? How do you define higher level and lower level
behaviors that should have tests written for them?
2008 May 26
7
Mocking Models in Controller Specs...
I find myself doing this kind of thing a lot in Controller Specs:
@vacancy = mock_model(Vacancy)
@vacancy.stub!(:reference)
@vacancy.stub!(:title)
@vacancy.stub!(:created_at)
@vacancy.stub!(:updated_at)
@vacancy.stub!(:body)
@vacancy.stub!(:contract)
@vacancy.stub!(:location)
@vacancy.stub!(:salary)
@vacancy.stub!(:benefits)
2006 Nov 07
7
should_redirect_to in advance - feels unnatural
I can understand that it''s easier for rspec to set up a mock in advance
of the controller call. But it makes it difficult to do something like:
context "The HarkController, given Louie the logged-in user" do
setup do
post :login, :username => ''louie'', :password => ''atest''
end
specify "should redirect Louie to the home
2009 Mar 25
5
[Cucumber] ANN: Cucumber with pure Java
Big news for all Java programmers out there.
Now you can use Cucumber with pure Java!
That''s right, you don''t have to write a single line of Ruby! (1)
All of your step definitions can be written as annotated methods in POJOs
(Plain Old Java Objects).
To get a taste of what this looks like, check out the simple example in the
cucumber_java project on GitHub:
* README for
2009 Apr 27
2
uninitialized constant ActionController running Cucumber features in Aptana/RadRails IDE
I''m just starting on BDD. I installed the gems for webrats and
cucumber.
I also ran the following in the Ruby shell:
>rake gems:install RAILS_EN=test
>script/generate cucumber
These commands seemed to create the expected features and lib folders
in my project.
I''m using the eclipse framework with Aptana and RadRails as my IDE.
However, when I run:
>cucumber features
2008 Nov 21
57
Spec''ing via features
As I work with Rails TestUnit tests I am reconsidering how to use
cucumber features. It seems to me that it might be best to have a
coherent view of how to arrange my test suites before I get much further
into this. Now, so far I have considered three possibilities:
1. Use features exclusively. Create a feature file for each model, one
for each controller and possibly an additional one for
2012 May 22
6
Beginning with BDD: Rspec or Cucumber? What is better documented?
Hey everybody
I''m sorry, I know that this question seems to arise every few moments,
but I
think in my case it''s a bit special (but doesn''t everybody?).
Well, I''m working with RoR on a private level since v1.0, and my
knowledge about both Ruby and Rails are on a basic level (but definitely
does exist), but I''m in no means near being an expert yet.
In
2008 Jan 27
8
Textmate RSpec Bundle ''it'' snippet
It seems to me that the RSpec bundle''s ''it'' snippet is in need of some
love. By default, a newly inserted spec passes. This seems odd as it
is misleading. It also makes it harder find what specs still need to
be completed if you return to an RSpec module after a break.
I propose that the ''it'' snippet is changed to the following:
it
2009 Apr 22
15
Why RSpec?
I like Shoulda. Sometimes I like plain old Test::Unit. Cucumber
gives me a different thought process.
I''d just like to hear some thoughts on why RSpec? What does it buy me
that I can''t get with Shoulda? I just can''t seem to think in RSpec.
Where is there a good example of RSpec tests that will help me grasp
the right path?
Thanks!
--
Amos King
2009 Mar 04
2
Testing my scripts?
Hello RSpec mailing list,
I have a question which I''m sure someone here has a "duh!" answer to. :P
A lot of the Ruby programming I do is around installing servers and
automating various tasks. The pattern I use goes as follows, I''m sure
you''ll see where the gap is.
Write a failing test. Write enough Ruby code to make it pass. Continue
until I have a class (or