Displaying 20 results from an estimated 4000 matches similar to: "Rails sessions in plain text stories"
2007 Nov 26
8
Renaming RailsExample to RailsExampleGroup
Fyi, I made the following renames:
* RailsExample -> RailsExampleGroup
* FunctionalExample -> FunctionalExampleGroup
* ControllerExample -> ControllerExampleGroup
* ViewExample -> ViewExampleGroup
* HelperExample -> HelperExampleGroup
* ModelExample -> ModelExampleGroup
This was done to keep the naming consistent with ExampleGroup.
2007 Nov 20
1
How to represent Story of Life grid in Then clause
In this story from Dan''s Game of Life:
Scenario: the grid has three cells
Given 3 x 3 grid
When I create a cell at 0, 0
And I create a cell at 0, 1
And I create a cell at 2, 2
Then the grid should look like:
XX.
...
..X
How do you set up matchers for the grid at the end. Are all the
indented lines after a Then passed to the Then matcher as separate
2007 Dec 13
8
stub with assigns?
is there a way to stub a method that sets an instance variable, so
the stub sets it too?
def find_foo
@foo = Foo.find(params[:id]
end
...
controller.stub!(:find_foo).and_assigns(:foo, "123")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20071213/2042719f/attachment.html
2010 Nov 28
2
Dynamic find_by method returning nil in a class method
I have a user Model with a class method that I am using to do some
authentication
basically something like this
class User < ActiveRecord::Base
attr_accessor :password
attr_accessible :first_name, :last_name,
:email, :birth_date, :sex,
:password, :password_confirmation
email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :first_name,
2007 Dec 11
14
Attachment-fu + Story Runner
Hi all,
I''m trying to run a Story Runner integration test that uploads a file
through Attachment-fu.
I''ve tried various ways of specifying the file data, from custom mocks:
class MockFile < Struct.new
(:original_filename, :read, :content_type); end
fdata = MockFile.new "test_upload.txt", "Test Upload", "text/plain"
to
2007 Dec 04
12
params not available for controller specs?
Hi, all,
I''m trying to write a spec for a controller method that starts out:
def download
@orders = Order.find( params[:ids] )
...
and started writing a spec that set params[:ids] to a mock. I was surprised to discover that controller specs (at least in RSpec 1.0.8) don''t offer the use of the params object (per
2011 Sep 22
2
find_by_email dynamic method returning new
Hello everyone,
I have a rails app which uses email as login name. At some point, I
have to search the user, in the User model by email. For some reason,
the method User.find_by_email(email) returns nil, even though the user
is in the database.
The same applies for any find_by_* method that searches by any
database column. I was able to find the user using the User.find
Does anyone have an idea
2011 May 06
3
Why returns nil?
Hi everyone, I''d like some help to understand this method:
def self.authenticate(email, submitted_password)
user = find_by_email(email)
return nil if user.nil?
return user if user.has_password?(submitted_password)
# Don''t understand why it doesn''t return user instead of nil
# since ''user = find_by_email(email)'' was the last
2008 Mar 13
3
Stories (well, integration tests) which aren''t plain text
Hi,
Having just played with getting my first plain text story working, I
like how it all fits together. It worked out nicely.
However, I don''t feel our project needs to have stories as plain text,
in fact it''s a slight hindrance for us. Is there any sensible
mechanism for doing integration testing using rspec without plain text
stories?
Thanks,
Rob
2007 Dec 13
16
"Tricks" for testing after_create callback???
I''ve got a model Message, which needs to send an email using action
mailer after it''s first saved in the database.
I want to pass the model to the mailer which then uses methods on the
message model to render the email.
So the natural way to do this is in an after_create callback on the
Message model.
But I can''t see an easy way to test this. Here''s my spec
2012 Sep 20
4
access controller's object attributes in view page
Hi,
I am new to ROR and learning it. In my controller I have an admins
record and I am passing that admin object to the admin''s view page to
get the name of the admin. But when I try to access the name it is
showing error as "undefined method `name'' for :current_admin:Symbol"..
Please help..
Please find my code below
Sessions Controller
def create
2008 Jan 16
1
session data and user stories
hello there,
i have been trying my hand at this rbehave material, specifically in terms
of integration testing a rails application, and i am curious about the most
friendly way to deal with session data.
currently, the only way i have found to simulate a session is to open a
session and refer to everything afterward via the @session variable stored
after open_session. it seems to be workable,
2008 Jan 08
47
specs on private methods
How does a person test private methods?
Is there a way to declare them as private, but retain any tests that
were written during the initial development?
Thanks.
--
Posted via http://www.ruby-forum.com/.
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 Oct 17
9
plain text stories: motivation number 27
This is mostly theoretical, but ...
I''m starting to use lighthouse (http://llighthouseapp.com) for my
projects at work. I''m organizing iterations as milestones and stories
as tickets tagged to a milestone.
Lighthouse offers an API so that you can write access the data in your
account and write apps to process that data.
I think you see where this is going.
It seems to me that
2007 Nov 28
6
Broken edge
Hi all,
Not sure if I''m the only one with this problem...
We''re on edge for both rails and rspec, and i just did an update...
Some apparently innocuous rails stuff was updated, and then half my
specs broke due to an error in rspec_on_rails:
ArgumentError in ''UserController without logged in user should show
the index page''
wrong number of arguments (2
2007 Dec 01
5
specifying an HTTP status code
Hi all,
I''m just starting to work w/ RSpec, so I hope this question isn''t too
obvious or missing the point somehow: Is there a way in RSpec to
specify that a controller action should use a specific HTTP status
code? Specifically I want to test for the usage of 301 as opposed to
302, for a permanent redirection.
response.should be_redirect
looks like it calls
2008 Mar 11
6
Story testing views in isolation
Hi,
I''ve been investigating plain text stories, and I had a quick question. How
would I go about creating story tests for views in isolation, instead of the
full stack? I had hoped to be able to do a straight render ''/'', but it says
it can''t find the method.
The reason that I want to do this is that I want to give our
designer/business people a way to write
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.
2006 Mar 14
4
Two Customer Types - Best Design Principle?
Hi all,
I''ll do my best to explain this... I have the possibility to have two
customer types in my system:
1. A "mailing list" type: new records are saved when user enters email
address in the mailing list subscription form.
2. A "full" type: new records are saved when the user buys something and
provides all their billing/shipping details, etc.
Model:
-