Skip to content

Instantly share code, notes, and snippets.

View slavaZim's full-sized avatar

Slava slavaZim

View GitHub Profile
them0nk / rspec_rails_cheetsheet.rb
Created March 23, 2012 03:39
Rspec Rails cheatsheet (include capybara matchers)
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
response.should render_template(:index)
response.should redirect_to(movies_path)
dstagner / gist:193207fed46acf5b5bae
Last active September 23, 2023 18:19
Ruby ISO8601 time in milliseconds

So you want to generate ISO8601 formatted timestamps in Ruby, but need resolution finer than a second?

First, make sure to require 'time' in order to get ISO8601 formatting. But that gets you this:

2.1.0 :001 > require 'time'
 => true 
2.1.0 :002 >
 => "2015-11-12T04:46:43Z" 


[1] Кострикин А.И. Введение в алгебру, 1977, Наука.

[2] Кострикин А.И. Введение в алгебру, ч. I,II, 2000, Физматлит.

[3] Курош А.Г. Курс высшей алгебры, 1975, Наука.

[4] Винберг Э.Б. Курс алгебры, 1999, 2001, Факториал

bbonamin / drag_drop.rb
Created July 17, 2012 14:18
Capybara drag and drop
shared_examples_for "driver with javascript support" do
before { @driver.visit('/with_js') }
describe '#find' do
it "should find dynamically changed nodes" do
@driver.find('//p').first.text.should == 'I changed it'
describe '#drag_to' do