Hi,
I'm trying to write an example that uses response.should have_tag('div')
outside of a Rails view test. I read somewhere that as long as you
have an instance variable named @response and it respondes to .body
with some HTML, it should work, but I get this failure:
undefined method `assert_select' for #<ActiveSupport::TestCase::Subclass_1:0x103
Also, has anyone cooked this up to work with Sinatra, or are you
restricted to using Rails? Seems that some Nokogiri wiz could work up
a substitute for ActiveSupport.
Thanks,
Ed
Ed Howland
http://greenprogrammer.wordpress.com
http://twitter.com/ed_howland
On Tue, Feb 16, 2010 at 6:42 PM, patrick99e99 <[email protected]> wrote:
> I am new to BDD, so am not quite sure how I am supposed to write a
> test like this.. I get:
> "ActiveRecord::RecordInvalid in 'User should fail when passwords do
> not match'
> Validation failed: Password doesn't match confirmation"
>
> If anyone can guide me in the right direction, I'd appreciate it..
>
> -patrick
>
> require 'spec_helper'
>
> describe User do
>
> before(:each) do
> @valid_attributes = {
> :login => 'test_name',
> :password => 'password',
> :password_confirmation => 'password'
> }
>
> �...@invalid_attributes = @valid_attributes.merge(:password =>
> 'not_the_same_password')
> end
>
> it "should create a valid user" do
> User.create!(@valid_attributes).should be_true
> end
>
> it "should fail when passwords do not match" do
> User.create!(@invalid_attributes).should be_false
> end
>
> end
>
>
> _______________________________________________
> rspec-users mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users