gem "capybara", "~> 2.0.1"
gem "database_cleaner", "~> 0.9.1"
# We're using this version until it gets merged in to support Capybara v2
# https://github.com/jonleighton/poltergeist/pull/208
gem "poltergeist", git: "https://github.com/brutuscat/poltergeist.git"
class BobbyTables
attr_accessor :tied_shoes
def tied_shoes?
!!tied_shoes
end
def tie_shoes!
self.tied_shoes = true
+----+-------------+-------+------+------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------+---------+----------------------------------+---------+---------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+------+------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------+---------+----------------------------------+---------+---------------------------------+
| 1 | SIMPLE | users | ALL | NULL
Here's my query: | |
SELECT SQL_BUFFER_RESULT SQL_BIG_RESULT users.id, users.email, | |
COUNT(av.user_id) AS article_views_count, | |
COUNT(af.id) AS article_favorites_count, | |
COUNT(lc.user_id) AS link_clicks_count, | |
COUNT(ai.user_id) AS ad_impressions_count, | |
COUNT(ac.user_id) AS ad_clicks_count | |
FROM users |
class TemporaryTable | |
attr_reader :name_prefix, :attributes | |
def initialize(name_prefix, attributes) | |
@name_prefix = name_prefix | |
@attributes = attributes | |
create_temp_table! | |
end | |
def table_name |
Attempting to find a good way to give a wrapper around AR objects to give them Repository pattern effects.
-
Do validations stay on the ActiveRecord model or do they move to the Repository object?
-
Is delegating attributes / errors / finders to the AR object bad?
For example: UserRepository.new.errors => Calls user.errors ?
-
When calling associations (User => Comments), does the Repository return CommentRepository objects, or Comment objects?
I find that writing features can get really repetitive. So to get rid of writing steps over and over again for multiple models I decided to create a pretty simple solution. It's not big enough to yield a gem so it's here for your use / modification. Comments or questions are welcome, would love to add to this as well.
step 'I modify the :model :attribute with/to :value' do |model_name, attribute, value|
id = "#{model_name}_#{attribute}"
fill_in "#{id}", with: value
export GIT_EDITOR="subl -w" | |
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then | |
c_reset=`tput sgr0` | |
c_user=`tput setaf 6` | |
c_path=`tput setaf 7; tput bold` | |
c_black=`tput setaf 0` | |
c_git_clean=`tput setaf 2` | |
c_git_dirty=`tput setaf 1` | |
else |
<?xml version="1.0" encoding="UTF-8"?> | |
<kml xmlns="http://www.opengis.net/kml/2.2"> | |
<Folder> | |
<name>House of Blues</name> | |
<Placemark> | |
<name>HOB San Diego</name> | |
<description /> | |
<Point> | |
<coordinates>-117.160118,32.716254</coordinates> | |
<description>1055 5th Ave, San Diego, CA 92101, USA</description> |
<?php | |
public function startup(){ | |
App::import('Datasource', 'Mongodb.Mongodb'); | |
$this->mongo = ConnectionManager::getDataSource($this->SearchLog->useDbConfig); | |
} | |
public function main(){ | |
$map = 'function () { emit(this.slug, {count:1}); }'; | |
$reduce = 'function (key, values) { var count = 0; values.forEach(function (v) {count += v.count;}); return count; }'; |