Thanks for the advice, Webrat's have_select or does work with any object that responds to :body. so I've now got it working with Steven Parkes's Env.js port to Johnson w/TraceMonkey.
RSpec on Javascript w/o a browser. Sweet. Cheers, Ed Ed Howland http://greenprogrammer.wordpress.com http://twitter.com/ed_howland On Wed, Feb 17, 2010 at 8:56 PM, Ed Howland <[email protected]> wrote: > Thanks, David. > > I hope that is less/non dependent on Rails/ActiveSupport. It seems to > depend on Nokogiri, and hopefully uses some duck-typeable response > object. I guess they use response_body. > > I've concocted a strange brew of RSpec, Johnson and envjs. It can already > execute normal Javascript methods, jQuery, and AJAX calls. The only > missing piece is the assert_select-like framework: > > it "should make an ajax call and format some content" do > click_async "a#edit" > response.should have_selector('div') # this last part, I need > end > > I don't know if anyone else is working on this front, but it is > getting us closer to having a pure Ruby/non-browser spec framework > > Cheers, > Ed > > Ed Howland > http://greenprogrammer.wordpress.com > http://twitter.com/ed_howland > > > > On Wed, Feb 17, 2010 at 3:38 PM, David Chelimsky <[email protected]> wrote: >> On Wed, Feb 17, 2010 at 12:47 PM, Ed Howland <[email protected]> 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 <[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 >>> >> _______________________________________________ >> 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
