Skip to content

Instantly share code, notes, and snippets.

View abotalov's full-sized avatar

Andrei Botalov abotalov

View GitHub Profile
@abotalov
abotalov / autoreply_to_mail.feature
Created March 3, 2012 22:14
Send mail features
Feature: Autoreply to mail
In order to say that I'm not able to respond to emails
I want to be able to setup autoreply
Background:
Given I am logged in
And another user exists
Scenario: System sends autoreply when autoreply is enabled
Given I have autoreply enabled
@abotalov
abotalov / user.rb
Created March 28, 2012 20:51
Your code
class User
attr_accessor :name, :password
def initialize new = {}
hash = {:name => "name", :password => "password"}
hash.merge! new
hash.each {|name, value| instance_variable_set("@#{name}", value)}
end
@abotalov
abotalov / email.rb
Created March 30, 2012 18:11
How to make this code DRY?
class Email
attr_accessor :recipients, :subject, :body
def initialize(options = {})
hash = {recipients: %w(localpart@site.com), subject: 'Subject', body: 'Body'}
hash.merge!(options)
hash.each {|name, value| instance_variable_set("@#{name}", value)}
end
@abotalov
abotalov / env.rb
Created April 1, 2012 11:20
говнокод
require 'capybara/cucumber'
require 'rspec'
require_relative 'user'
scheme = 'https'
$domain_name = 'testwww.confidesk.com'
$user = User.new(username: 'user31', password: 'user31')
$user2 = User.new(username: 'user41', password: 'user41')
@abotalov
abotalov / signup.feature
Created July 13, 2012 00:01
Google signup
Feature: Signup
In order to get access to protected sections of the site
As a user
I want to be able to sign up
Scenario: Signup with valid data
When I signup with valid data
Then I become signuped
Scenario: Signup with empty required field
@abotalov
abotalov / output.txt
Created August 2, 2012 18:27
Output of Capybara.methods.sort
[:!, :!=, :!~, :<, :<=, :<=>, :==, :===, :=~, :>, :>=, :__id__, :__send__, :acts_like?, :add_selector,
:alias_attribute, :alias_method_chain, :all, :ancestors, :anonymous?, :app, :app=, :app_host, :app_host=, :as_json, :asset_root, :asset_root=, :attac
h_file, :autoload, :autoload?, :automatic_reload, :automatic_reload=, :blank?, :body, :capture, :check, :choose, :class, :class_eval, :class_exec, :cl
ass_variable_defined?, :class_variable_get, :class_variable_set, :class_variables, :click_button, :click_link, :click_link_or_button, :click_on, :clon
e, :configure, :const_defined?, :const_get, :const_missing, :const_set, :constants, :cucumber_instance_exec, :current_driver, :current_driver=, :curre
nt_host, :current_path, :current_session, :current_url, :default_driver, :default_driver=, :default_host, :default_host=, :default_selector, :default_
selector=, :default_wait_time, :default_wait_time=, :define_singleton_method, :delegate, :deprecate, :display, :drivers, :dup, :duplicable?, :enable_w
arnings, :enum_
@abotalov
abotalov / gist:3255493
Created August 4, 2012 07:31
Fix broken link
There are a lot of posts at SO that have link http://particletree.com/features/rediscovering-the-button-element/. (https://www.google.com/search?q=site%3Astackoverflow.com%2Fquestions+http%3A%2F%2Fparticletree.com%2Ffeatures%2Frediscovering-the-button-element%2F).
Link is obsolete so it should be fixed to http://web.archive.org/web/20110721191046/http://particletree.com/features/rediscovering-the-button-element/
But number of such posts is quite large so I think fixing all of them myself can be considered unfair. I think all those links should be edited automatically NOT by the user of site, e.g. by Community user.
@abotalov
abotalov / Command
Created August 7, 2012 18:18
Error while fetching git file using Bundler
bundle
@abotalov
abotalov / WEB-INFlayoutsdefault.jsp
Created August 10, 2012 13:04
My non-working Tiles 3 app
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<!DOCTYPE html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
@abotalov
abotalov / stacktrace
Created August 10, 2012 13:11
Stack Trace when running app from https://gist.github.com/3314068
Aug 10, 2012 8:28:50 AM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.tiles.access.TilesAccess.getContainer(TilesAccess.java:124)
at org.apache.tiles.access.TilesAccess.getContainer(TilesAccess.java:107)
at org.apache.tiles.access.TilesAccess.getCurrentContainer(TilesAccess.java:174)
at org.apache.tiles.template.InsertDefinitionModel.execute(InsertDefinitionModel.java:95)
at org.apache.tiles.jsp.taglib.InsertDefinitionTag.doTag(InsertDefinitionTag.java:254)
at org.apache.jsp.WEB_002dINF.products_jsp._jspx_meth_tiles_005finsertDefinition_005f0(products_jsp.java:89)
at org.apache.jsp.WEB_002dINF.products_jsp._jspService(products_jsp.java:64)