Command Line
pry -r ./config/app_init_file.rb
- load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb
- load your rails into a pry session
Debugger
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
<bean id="entityManagerFactory" | |
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> | |
<property name="dataSource" ref="dataSource"/> | |
<property name="jpaVendorAdapter"> | |
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> | |
<property name="showSql" value="true" /> | |
<property name="databasePlatform" value="${hibernate.databasePlatform}" /> | |
</bean> | |
</property> | |
<property name="jpaProperties"> |
class Display::WidgetsController < ApplicationController | |
def show | |
scss = render_to_string('show', locals: { foo: bar }, formats: :scss) | |
@css = Sass::Engine.new(scss, Compass.sass_engine_options.merge(syntax: :scss)).render | |
end | |
end |
Command Line
pry -r ./config/app_init_file.rb
- load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb
- load your rails into a pry sessionDebugger
module ActiveRecord | |
module RailsAdminEnum | |
def enum(definitions) | |
super | |
definitions.each do |name, values| | |
define_method("#{ name }_enum") { self.class.send(name.to_s.pluralize).to_a } | |
define_method("#{ name }=") do |value| | |
if value.kind_of?(String) and value.to_i.to_s == value |
var expect = require('expect'); | |
describe.only('Sample', function () { | |
beforeEach(function () { | |
this.currentTest.value = 'Winning!'; | |
}); | |
it('Uses current test data', function () { | |
expect(this.test.value).to.equal('Winning!'); |
import uuid from 'node-uuid'; | |
import sinon from 'sinon'; | |
const mockId = '00000000-0000-0000-0000-000000000000'; | |
describe('some test', () => { | |
it('does something', () => { | |
// create stub | |
sinon.stub(uuid, 'v4', function () { | |
return mockId; | |
}); |
#!/bin/bash | |
docker rm --force $(docker ps --all -q) | |
docker rmi --force $(docker images --all -q) |