Given address ids 1,2,3, we would want a single query to returns rows for every combination of directions, ie:
1,2
1,3
2,1
2,3
3,1
3,2
| it "maintains acceptable performance for the index action", skip_db_cleaner: true do # for some reason skip_db_cleaner: true when running the whole test suite wasn't being inherited, so I had to dup it :( . When running the describe, it was being inherited by the 'it' blocks, and once you run it and try to run the whole suite again, it starts passing. | |
| expect { get :index, params: params, format: :json }.to meet_performance_threshold(4.0) | |
| .sample(5) | |
| .under_standard_deviations(2) | |
| # Also see rspec-benchmark. This matcher is like perform_under but it removes results outside a defined standard deviation range reduce high variance. | |
| RSpec::Matchers.define :meet_performance_threshold do |threshold_seconds| | |
| chain :sample do |sample_size| | |
| @with_sample_size = sample_size | |
| end |
Given address ids 1,2,3, we would want a single query to returns rows for every combination of directions, ie:
1,2
1,3
2,1
2,3
3,1
3,2
| var Mocha = require('mocha'), | |
| fs = require('fs'), | |
| _ = require('underscore'); | |
| var mocha = new Mocha({reporter: 'spec', ui: 'bdd'}); | |
| mocha.addPath = function(dir){ | |
| fs.readdirSync(dir).filter(function(file){ | |
| var fileArray = file.split('.'); | |
| Rails => Geddy | |
| **Models** | |
| User.new(params) => User.create(params); | |
| ----- | |
| User.create(params) => var u = User.create(params); | |
| // saves the user then calls the callback function | |
| u.save(function (err, data) { // do things }); | |
| ----- |
| RSpec::Matchers.define :encrypt do |attribute| | |
| encrypted_attribute = ('encrypted_' + attribute.to_s) | |
| match do |model| | |
| model.respond_to?(attribute) && model.respond_to?(encrypted_attribute.intern) && model.class.column_names.include?(encrypted_attribute) | |
| end | |
| failure_message_for_should do |model| | |
| unless model.class.column_names.include?(encrypted_attribute) |