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
Hi all,
Below is my model action.
def activate!
self.update_attribute(:active, true)
end
here is spec/models/user_spec.rb
describe User do
before(:each) do
@user=User.new(:email=>'k...@gmail.com',:password='1234',)
end
This is my spec.
it "should activate the user" do
@user.a
Kaleem Ullah wrote:
Scott Taylor wrote:
You could benefit from a factory / data builder. See
FixtureReplacement, Fixjour, Factory girl, one of the many others out
there which would build this stuff *once* for you.
I am in need of such data builders.
I recently thumped the square peg of
Scott Taylor wrote:
> On Feb 11, 2009, at 8:51 AM, Kaleem Ullah wrote:
>
>>@user=User.new
>>@user.active= '1'
>>@user.reset_password_token= ''
>> end
>
> You could benefit from a factory / data builder. See
> FixtureReplacement, Fixjour, Factory girl, one of the many others out
> th
Nick Hoffman wrote:
> To spec your #activate! , why not do something like this?:
>
> it 'should activate the user' do
>@user.active.should be_false
>@user.activate!
>@user.active.should be_true
> end
>
>
Thanks for your reply Hoffman :)
I did the same but it gives error like "#230
James Byrne wrote:
> I recently installed nakajima-acts_as_fu (0.0.3) gem. This provides a
> rather painless way of specifying ActiveRecord model schemata on the fly
> in your specifications. You might find it helpful to look into this.
>
> You will discover that some people favour mocks and
Scott Taylor wrote:
> On Feb 11, 2009, at 8:51 AM, Kaleem Ullah wrote:
>
>>@user=User.new
>>@user.active= '1'
>>@user.reset_password_token= ''
>> end
>
> You could benefit from a factory / data builder. See
> FixtureReplacement, Fixjour, Factory girl, one of the many others out
> th
On Feb 11, 2009, at 8:51 AM, Kaleem Ullah wrote:
Hi,
I am quite new to Rspec. I want to use Rspec to test my existing
Code. I
start from Models (Unit Testing). Here i want your help on a issue.
Here is model/user_spec.rb
describe User do
before(:each) do
@user=User.new
@user.id='2
On 11/02/2009, at 8:51 AM, Kaleem Ullah wrote:
Hi,
I am quite new to Rspec. I want to use Rspec to test my existing
Code. I
start from Models (Unit Testing). Here i want your help on a issue.
Here is model/user_spec.rb
describe User do
before(:each) do
@user=User.new
@user.id='2'