Skip to content

Instantly share code, notes, and snippets.

View bvogel's full-sized avatar

Burkhard Vogel-Kreykenbohm bvogel

View GitHub Profile
@bvogel
bvogel / qr.rb
Last active August 29, 2015 14:22 — forked from gouf/qr.rb
require 'barby'
require 'barby/barcode'
require 'barby/barcode/qr_code'
require 'barby/outputter/png_outputter'
str = 'Hello QrCode!! Using Gem for Barby, Barby-pngOutputter and Chunky-PNG.'
b = Barby::QrCode.new(str, level: :q, size: 10)
File.open('qr.png', 'w') do |f|
f.write b.to_png
#Model
@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
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)