On Wed, Feb 17, 2010 at 12:47 PM, Ed Howland <ed.howl...@gmail.com> wrote: > 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:
have_tag is on its way to its death. It won't exist in rspec-rails-2, though I hesitate to deprecate it in rspec-rails-1.x since many folks won't be able to upgrade directly anyhow. I'd recommend using webrat's have_selector instead. > > 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 <patrick99...@gmail.com> 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 >> rspec-users@rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users