On Mon, Dec 14, 2009 at 3:57 PM, DeNigris Sean wrote:
> If I'm reading the docs right, the current implementation would be:
> my_workspace.should have(1).documents
>
> Would it be hard to have it be: my_workspace.should have(1).document
>
If I'm reading the docs right, the current implementation would be:
my_workspace.should have(1).documents
Would it be hard to have it be: my_workspace.should have(1).document
^
Yup, I did.
Thanks all. (unless anyone has any comments on the constants question I just
asked in a previous post?)
Regards
Matt
2009/12/14 Tom Stuart
> On 14 Dec 2009, at 21:28, Matt Riches wrote:
> > describe Address do
> > #Test Fixture - Before Each test Create a Standard Bread with the
I am still learning, and its been along and frustrating day, but thanks !
Sometimes a fresh (more experienced pair of eyes) can spot the blindingly
obvious :)
ok, one more quick question, and its slightly more general and then Im going
home for the day.
When I run my tests now I get a series of
On 14 Dec 2009, at 21:28, Matt Riches wrote:
> describe Address do
> #Test Fixture - Before Each test Create a Standard Bread with the following
> attributes and properties
> before(:each) do
> @address = {
> :business_name => 'business', :first_line => '10, This Street',
> :second_
This should have been the giveaway
> undefined method 'status' for #<*Hash*...>
In your before you're assigning @address to the parameters, not to a new
address
@address = {:foo => 'bar'}
instead of
@address = Address.new({:foo => 'bar'})
-V
On Mon, Dec 14, 2009 at 3:28 PM, Matt Riches wrote
Fair point, thought you could also assume that the omissions are down to my
newness at RSpec and RoR :-)
The whole of the code is rather large, I am being asked to retrofit rspec
onto the code base as things are changed, so I am only showing what I think
are the relevent things..
Code Section
1
Looks like you forgot to put "do" at the end of your specs. I do that
all the time;
it "should have a status of New Record"
...
Should be
it "should have a status of New Record" do
...
HTH
David
2009/12/14 Tom Stuart :
> On 14 Dec 2009, at 20:36, Matt Riches wrote:
>> 1) Why are my methods u
On 14 Dec 2009, at 20:36, Matt Riches wrote:
> 1) Why are my methods undefined, when they are there (I can create the object
> via script/console and call the status and reset methods and see them work)
> 2) What is the best way of resolving the issue
You'd be much better off using pastie.org to
Within my project, I have a number of models that have additional methods
within them other than those provided by active record.
as an example (to keep it short and sweet)
class foo < ActiveRecod::Base
def status
"New Record"
end
def reset
"Reset"
end
end
in my spec file I have
req
On Mon, Dec 14, 2009 at 3:26 AM, Andrei Erdoss wrote:
> On Mon, Dec 14, 2009 at 9:05 AM, Amit Kulkarni wrote:
>>
>> Thanks David,
>> Now in spec when i write login_as :admin then there must be some method
>> written for login_as?
>> Now if there are before filters in controller then do we need to
On Mon, Dec 14, 2009 at 1:05 AM, Amit Kulkarni wrote:
> Thanks David,
> Now in spec when i write login_as :admin then there must be some method
> written for login_as?
That would be a helper that you write yourself or is provided by the
authentication framework you're using. It lives in the spec
On Sat, Dec 12, 2009 at 1:35 PM, Saverio Miroddi wrote:
> Tom Stuart wrote:
>> On 10 Nov 2009, at 14:08, Saverio Miroddi wrote:
>>> Is there a clean/simple way of stubbing the activerecord find() for a
>>> single instance?
>>
>> MyModel.stub(:find).with(42).and_return(myModel)
>
> Didn't work as e
2009/12/14 Amit Kulkarni
> Thanks David.
> Also i am little bit confused regarding routes.
>
> Consider a routing example
>
> it "should map { :controller => 'channels', :action => 'new' } to
> /channels/new" do
> route_for(:controller => "channels", :action => "new").should ==
> "/channels/new"
You can write a stub method that would return a value such that your object
meets the admin_required_access requirement.
controller.stub(:admin_access_required).and_return(true)
On Mon, Dec 14, 2009 at 9:05 AM, Amit Kulkarni wrote:
> Thanks David,
> Now in spec when i write login_as :admin then
15 matches
Mail list logo