Displaying 20 results from an estimated 30000 matches similar to: "How to write the very first example?"
2007 Sep 20
10
Getting Started with Story Runner
I haven''t found any How To''s to use story runner and I''m not sure how to get
started.
Should I be looking for resources on how to use rbehave?
How do I generate my first Story?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070920/07a80bc7/attachment.html
2007 Aug 26
4
howto regressions on environment.rb in Rails projects
How would one write a spec on environment.rb in a rails app?
I was requiring a gem in environment.rb, but received a
"MissingSourceError". Generally, ruby raises a LoadError when it
can''t find a gem, but rails overrides this to raise a
MissingSourceError (since rails is expecting a required file to be in
lib/...). How would I write a spec to override this behavior,
2008 Mar 04
9
What is your workflow? Or how to use the story runner the right way.
I really would like to know how people are using the Story and Example
runner to write their software.It would be great to get some direction on
it, because I think I''m missing some points.
Taking the outside-in approach in thought:
At first we write a high-level customer-facing story, this story fails.
Then we start using mocks at object level to use them as a design tool,
and so we
2007 Nov 12
15
it "should [action] ..." vs it with an active voice
I''d like to start gathering information/debating on the
advantages/disadvantages of using it "should ..." vs other techniques.
Dan North explained why we should use should:
http://dannorth.net/introducing-bdd/
I used to use it "should ..." for the projects I was on, until I was
challenged by a fellow developer who started using it with an active
voice.
For example
2007 Apr 11
12
redirection doesn''t get detected well?
I''m doing a redirect in one of my controller actions and somehow I can''t
spec it, see this pastie: http://pastie.caboo.se/53120.
When following the link from a browser I''m being redirected to the right
page.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2007 Jul 29
24
View-Driven-Development by Behavior-Driven-Development and RSpec
One of the things that turned me on to BDD and RSpec was speccing
views first, that the desired end would drive the development. In
previous projects while using Test::Unit I would try to make educated
guesses as to what would be needed in the model and controllers to
derive the view without actually writing the view until afterwards.
This is all because testing relied on each previous
2007 Oct 19
27
Assumption tests
Hi all,
I''ve been thinking about the whole validator/relationship speccing
issue, and I came up with a suggestion, which I''d love to get some
feedback on.
The full article is available at http://www.inter-sections.net/
2007/10/19/what-to-test-and-specify-and-where-to-do-it/ , with the
relevant bit being about halfway down, but here''s the gist of it:
1.
2007 Sep 26
10
How do I best setup data for Story Runner?
Just started looking at the Story Runner integration, and am
converting a few Rails integration tests to get a feel for it.
My integration tests relied on fixtures, and since my models have a
significant amount of validation (and hence need valid data unless I
save without validation), this has made setup easy.
With stories however, I''m wondering what the recommended approach is.
2007 Aug 16
3
Mocking a non-existent method
I don''t like this:
i = mock(Integer)
i.should_receive(:asdfasdf).and_return(''foo'')
puts i.asdfasdf
Shouldn''t rspec check to see that :asdfasdf is a valid message to be
sending Integer?
Joe
2008 Mar 11
2
Composed Stories/Scenarios
In using stories, I find myself wanting to build scenarios on top of each other,
For example
I want something like
Scenario: The user logs on
Given a
And b
When c
And d
Then e
And f
Scenario: The user changes his password
Given the user logs on
And g
Then h
In other words, I''d like to write the second scenario starting with
the ''state'' produced by
2007 Aug 24
26
testing behaviour or testing code?
hypothetical question for all you BDD experts:
I want to make sure that a :list action always returns widgets in
alphabetical order. There''s at least 2 ways of doing this:
it "should fetch items in alphabetical order" do
Widget.should_receive(:find).with(:order => "name ASC")
get :list
end
it "should fetch items in alphabetical order" do
[:red,
2008 Jan 28
6
client first, top down, outside in, etc with rails
I''m starting a new project and I want to try writing the client first. I.e. I want to write my ''views'' first and I would like to mock out all the models in such a way that I can run the site and browse it with the mocked out models. Is it easy to use rspec''s mocking for this sort of thing and has anyone done it before? Does anyone know of a tutorial out there
2007 Nov 12
2
Using the mock framework in story runner
Hey all,
What is the easiest way to include rpec''s mocking framework into a story
so I can use it? I want to use it to stub out a Net::HTTP method so I''m
not making API calls every time I run my story. :)
Thanks,
Ben
2007 Dec 06
43
Mocks? Really?
OK, so i''ve played a bit with mocks and mock_models in controller and
view tests and i have a question. Is this statement really correct:
"We highly recommend that you exploit the mock framework here rather
than providing real model objects in order to keep the view specs
isolated from changes to your models."
(http://rspec.rubyforge.org/documentation/rails/writing/views.html
2007 Oct 04
16
Spec/Test Speed
Just wanted to pick some smart people about this topic: What are you
guys doing to increase the speed of your specs?
I''m a big fan of autotest, but right now my current project has 438
specs (for rails). Most of them are in the model, and for all of
them we are hitting the database (they are more functional specs than
unit-tests). The whole suite takes 112 seconds (meaning the
2007 Nov 07
10
Plain Text Story example
Hey all,
Does anyone have an example(s) of the plain text story runner for
rails? I have read David''s blog
(http://blog.davidchelimsky.net/articles/2007/10/22/plain-text-stories-on-rails)
about it but I would like to see some examples with all of the step
matchers included... I couldn''t find any more examples on google
talking about the plain text stories and the example
2008 Jan 11
13
Role of stories vs specs, revisited
A couple months ago I asked how stories and specs might impact each
other. [1] If you look at Dan North''s example of what''s in a story
[2], and you imagine using the spec framework to drive the design, you
can probably imagine a significant bit of overlap in the two. Is that
a bad thing? I''m not sure. It has made me a bit uncomfortable
though, and I''ve
2007 Nov 17
7
Using RSpec to drive the design of a GUI desktop application
Hello everybody,
I''ve been using RSpec as a tool to create web applications for some time
now, in Rails, and using plain Ruby with WEBrick as well. The tool suits my
needs and the story runner is great.
Now there are things that aren''t solvable on the web, you''ll need a _real_
desktop application for those problems.
So I''ve toyed a bit around with various GUI
2007 Aug 31
48
Deprecating the mocking framework?
I saw in one of Dave C.''s comments to a ticket that "our current plan
is to deprecate the mocking framework." I hadn''t heard anything about
that, but then again I haven''t paid super close attention to the list.
Are we planning on dumping the mock framework in favor of using Mocha
(or any other framework one might want to plug in?).
Pat
2007 May 11
2
spec a replace_html with a partial
I wanted to use ARTS to add RJS in a behaviour driven way to my
application, but I''m having some trouble asserting a replace_html with
a partial.
I''ve created a pastie (http://pastie.caboo.se/60694) which contains
the RJS I want to spec, the spec which I already wrote and its failure
message.
I''m currently using RSpec-0.9.2