First, bump your phoenix in mix.exs
:
def deps do
[{:phoenix, "~> 0.14"}, ...
end
Update your phoenix_html
version to 1.1.0
in mix.exs
:
Pry::Commands.block_command 'r' do |*w| | |
run "show-routes" + ( w.present? ? " --grep '#{w.join ' '}'" : "" ) | |
end |
require 'sequel' | |
require 'pg' | |
DB1 = Sequel.connect('postgres://localhost/database_1') | |
DB2 = Sequel.connect('postgres://localhost/database_2') | |
DB1[:people].where(:whatever => "something").each do |person| | |
DB2[:people].insert(:name => person.name) | |
end |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
#!/usr/bin/env ruby | |
spec_hits = [] | |
checks = { | |
'_spec\.rb$' => ['focus:[:space:]*true'], | |
'\.rb$' => ['binding\.pry', 'debugger'] | |
} | |
# Find the names of all the filenames that have been (A)dded (C)opied or (M)odified | |
filenames = `git diff --cached --name-only --diff-filter=ACM`.split("\n") |
# Typically in Rails to use VCR we setup the RSpec config like so: | |
RSpec.configure do |config| | |
config.extend VCR::RSpec::Macros #deprecated | |
end | |
# This gives us access to the use_vcr_cassette method: | |
describe Reviewed::Article do | |
use_vcr_cassette 'article/grill' | |
end | |
require 'active_support/core_ext/array' | |
class FactoryGirl | |
attr_accessor :options | |
def self.create(model, options = {}) | |
new(model, options) | |
end | |
def initialize(model, options) |
% rspec spec.rb --format doc | |
Foo | |
when logged in as a user | |
should == "TEST VALUE" | |
Finished in 0.00047 seconds | |
1 example, 0 failures |
module AuthenticationHelpers | |
def authenticated_as(roles, options=nil) | |
options = instance_eval(&options) if options.is_a? Proc | |
Array(roles).each do |role| | |
context "when logged in as a #{role}" do | |
before(:all) { @user = FactoryGirl.create role, *Array(options) } | |
after(:all) { DatabaseCleaner.clean } | |
before(:each) { sign_in @user } |