i know integration tests preferred need ran in controller test, i'm testing gem injecting html code in view, xhr can't run in feature spec (if can, please explain me how :) ) so rspec controller tests can assert selector present (with capybara) : response.body.should have_selector('#foobar') has_selector? call all method capybara find selector. what want last child of body , assert id in particular. afaik it's not possible have_selector. what : all('body:first-child').first.id.should == '#foobar' however, capybara dsl, defined (more or less): def all(*args) page.all(*args) end and page empty unless use visit it's integrations specs. how can use capybara all method inside rspec controller test ? i can't test right after googling seems trick def page capybara::node::simple.new(response.body) end source
i have syntax problem in module, fail sql query. i initialize module database in file.js, responds console.log 'connected database', sends data module in database.newdata(data), when enters in runquery nothing happens, no errors or result, nothing! i in runquery if query ok , if this, think happens there error in logic of node, idea connect database , use runquery run query pass. file.js var db = require('./modules/database'); var database = new db(); database.newdata(data); database.js var mysql = require('mysql'), queries = require('./queries'), connection; var db = function(){ var db_config = { host: 'localhost', user: 'diegoug', password: 'qwertyuiop', database: 'test' }; connection = mysql.createconnection(db_config); connection.connect(function(err) { if(err) { console.log('error when connecting database:', err); ...
Comments
Post a Comment