Skip to content

Instantly share code, notes, and snippets.

View sebastjan-hribar's full-sized avatar

Sebastjan Hribar sebastjan-hribar

View GitHub Profile
@sebastjan-hribar
sebastjan-hribar / create.rb
Created May 9, 2016 19:00
foreign_key issues with tests
module Web::Controllers::Conferences
class Create
include Web::Action
before :check_for_admin_role
expose :conference
params do
@sebastjan-hribar
sebastjan-hribar / action.rb
Created April 20, 2016 18:34
params validation
module Web::Controllers::Posts
class Update
include Web::Action
before :check_for_admin_role
params do
param :post do
param :title, presence: true
param :body, presence: true
/home/sebastjan/.rvm/gems/ruby-2.2.1/gems/hanami-utils-0.7.1/lib/hanami/utils/class_attribute.rb:67: warning: `*' interpreted as argument prefix
/home/sebastjan/.rvm/gems/ruby-2.2.1/gems/url_mount-0.2.1/lib/url_mount.rb:55: warning: method redefined; discarding old variables
/home/sebastjan/.rvm/gems/ruby-2.2.1/gems/url_mount-0.2.1/lib/url_mount.rb:27: warning: previous definition of variables was here
/home/sebastjan/.rvm/gems/ruby-2.2.1/gems/http_router-0.11.2/lib/http_router/route.rb:10: warning: method redefined; discarding old match_partially
/home/sebastjan/.rvm/gems/ruby-2.2.1/gems/http_router-0.11.2/lib/http_router/route.rb:10: warning: method redefined; discarding old router
/home/sebastjan/.rvm/gems/ruby-2.2.1/gems/http_router-0.11.2/lib/http_router/generator.rb:58: warning: assigned but unused variable - generator
/home/sebastjan/.rvm/gems/ruby-2.2.1/gems/http_router-0.11.2/lib/http_router/route_helper.rb:99: warning: assigned but unused variable - params
/home/sebastjan/.rvm/gems/ruby-2.2.1/gems/h
module Web::Controllers::Parents
class Create
include Web::Action
expose :parent
params do
param :parent do
param :name, presence: true
param :surname, presence: true
source 'https://rubygems.org'
gem 'bundler'
gem 'rake'
gem 'hanami', '0.7.0'
gem 'hanami-model', '~> 0.5'
gem 'thin'
gem 'sqlite3'
gem 'launchy'
gem 'bcrypt'
require 'bcrypt'
class Parent
include Hanami::Entity
attributes :name, :surname, :email, :password,
:password_confirmation, :password_reset_token, :password_reset_sent_at
attr_reader :password_hash, :password_salt
1) Failure:
Web::Controllers::Projects::Show#test_0001_exposes a project [C:/Users/sebastjan/Documents/projekti/lotus/myProject/spec/web/controllers/projects/show_spec.rb:19]:
Expected: {:project=>#<Project:0x5de5668 @name="Test povezave1", @number="123",
@customer="Customer 1", @creation_date="23. 02. 2015", @purchase_order="sl-123",
@deadline="01. 04. 2015", @id=435>}
Actual: {:params=>#<Web::Controllers::Projects::Show::Params:0x5de53f8
@env={:id=>435, "lotus.action"=>#<Web::Controllers::Projects::Show:0x5de54d0 @_env={...},
@headers={"X-Frame-Options"=>"DENY", "Content-Security-Policy"=>"default-src 'none'; script-src 'self';
@sebastjan-hribar
sebastjan-hribar / add_project_spec.rb
Last active September 8, 2015 20:53
lotus template
require 'features_helper'
describe 'Projects' do
after do
ProjectRepository.clear
end
it 'can create a new project' do
visit '/projects/new'
save_and_open_page
require 'camping'
Camping.goes :People
module People::Controllers
class Index < R '/'
def get
render :index
end
end
@sebastjan-hribar
sebastjan-hribar / apps.rb
Last active August 29, 2015 14:22
mount_more_apps
require 'pm'
require 'qm'