Skip to content

Instantly share code, notes, and snippets.

View gotva's full-sized avatar

Vasily Gotovko gotva

  • Profitero
  • Minsk, Belarus
View GitHub Profile
@gotva
gotva / project_tree_names.rb
Last active August 29, 2015 14:05
Project tree names
#view
#<h3>Project Tree: <%= project_nested_tree_name(issue.project) %></h3>
# helper
def project_nested_tree_name(project)
if project.parent
nested_parent_names(project).flatten.join(" > ")
else
""
end.html_safe
@gotva
gotva / gitlab_hooks_index.html.haml
Created January 23, 2014 06:04
One of the way to patch hook index page for gitlab
-if @hooks.any?
.ui-box
.title
Web hooks (#{@hooks.count})
%ul.well-list
- @hooks.each do |hook|
- if hook.persisted?
%li
.pull-right
= link_to 'Test Hook', test_project_hook_path(@project, hook), class: "btn btn-small grouped"
require 'simplecov'
SimpleCov.start 'rails'
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rspec'
# "0" period existed before updating ("id"=>"645" - Period.id in database). The record is not destroyed, maybe it is edited
# "1" period is destroyed ("_destroy"=>"1"). Rails knows that Period.id=711 should be destroyed
# "new_1379871085948" new period
"periods_attributes"=>{
"0"=>{"from"=>"0", "to"=>"5", "_destroy"=>"false", "id"=>"645"},
"1"=>{"from"=>"6", "to"=>"7", "_destroy"=>"1", "id"=>"711"},
"new_1379871085948"=>{"from"=>"8", "to"=>"10", "_destroy"=>"false"}}
require 'spec_helper'
describe "User" do
it "should require a phone number" do
user = create(:user).should be_valid
end
it "should require a valid 10 digit phone number" do
user = create(:user).should be_valid
end
def canonical_string params
result = ActiveSupport::OrderedHash.new
params.keys.sort.each do |key, value|
result[key] = value
end
Rack::Utils.build_query(result)
end
Started GET "/users/sign_in" for 93.125.83.150 at 2012-03-09 04:49:37 -0800
Processing by Devise::SessionsController#new as HTML
Rendered devise/_links.erb (1.8ms)
Rendered devise/sessions/_terms_text.html.erb (1.0ms)
Rendered devise/sessions/new.html.erb within layouts/user_sessions (76.0ms)
Completed 500 Internal Server Error in 185ms
OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed):
/usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:799:in `connect'
/usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:799:in `block in connect'