This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test1_spec.rb - run this using "rspec test1_spec.rb" | |
require 'rspec' | |
class Test1 | |
def initialize | |
sayhi | |
end | |
def sayhi | |
puts "HI" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can become a registered Vim user by sending at least 10 euro. This works | |
similar to sponsoring Vim, see |sponsor| above. Registration was made | |
possible for the situation where your boss or bookkeeper may be willing to | |
register software, but does not like the terms "sponsoring" and "donation". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c | |
d | |
e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test2_spec.rb - call using 'rspec test2_spec.rb' | |
require 'rspec' | |
class Test2 | |
attr_accessor :msg | |
def initialize | |
@msg = sayhi | |
end | |
def sayhi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test2_spec.rb - call using 'rspec test2_spec.rb' | |
require 'rspec' | |
require 'mocha' | |
RSpec::configure do |config| | |
config.mock_with :mocha | |
end | |
class Test2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run_in_background(&block) | |
Process.fork do | |
Process.fork do | |
puts "Launching Background Process" | |
Daemons.call &block | |
puts "Background Process has been Launched" | |
end | |
exit | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
# ----- Devise ----- | |
# Include default devise modules. Others available are: | |
# :token_authenticatable, :confirmable, :lockable and :timeoutable | |
devise :database_authenticatable, :registerable, | |
:recoverable, :rememberable, :trackable #, :validatable | |
# Setup accessible (or protected) attributes for your model | |
attr_accessible :email, :password, :password_confirmation, :remember_me |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe User do | |
describe "Object Attributes" do | |
before(:each) { @obj = User.new } | |
specify { @obj.should respond_to(:first_name) } | |
specify { @obj.should respond_to(:last_name) } | |
specify { @obj.should respond_to(:login) } | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'parslet' | |
class Address < Parslet::Parser | |
# Single character rules | |
rule(:comma) { str(',') >> space? } | |
rule(:space) { match('\s').repeat } | |
rule(:space?) { space.maybe } | |
rule(:newline) { str("\n").repeat } | |
rule(:digit) { match('[0-9]') } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'parslet' | |
class Address < Parslet::Parser | |
# Single character rules | |
rule(:comma) { str(',') >> space? } | |
rule(:space) { match('\s').repeat } | |
rule(:space?) { space.maybe } | |
rule(:newline) { str("\n").repeat } | |
rule(:digit) { match('[0-9]') } |