Skip to content

Instantly share code, notes, and snippets.

PATH
remote: .
specs:
solidus (2.3.0.alpha)
solidus_api (= 2.3.0.alpha)
solidus_backend (= 2.3.0.alpha)
solidus_core (= 2.3.0.alpha)
solidus_frontend (= 2.3.0.alpha)
solidus_sample (= 2.3.0.alpha)
solidus_api (2.3.0.alpha)
rake build # Build lani-0.0.1.gem into the pkg directory
rake install # Build and install lani-0.0.1.gem into system gems
rake racc:clean # It regenerates the parser.rb file
rake release # Create tag v0.0.1 and build and push lani-0.0.1.gem t...
rake rexical:clean # It regenerates the lexer.rb file
rake test # Run RSpec code examples
require "bundler/gem_tasks"
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:test)
namespace :rexical do
task :clean do
`rm lib/lani/parser/lexer.rb`
end
require "bundler/gem_tasks"
task :clean do
`rm lib/lani/parser/lexer.rb`
end
task :regenerate do
has_rexical = `gem which rexical`
if has_rexical
require 'spec_helper'
describe Lani::Parser, '#parse' do
def parse(tokens)
Lani::Parser.new.parse(tokens)
end
it 'tests for addition' do
expect(parse("2 + 2")).to eq([
4
class Lani::Parser
macro
BLANK [\ \t]+
rule
BLANK # no action
\d+ { [:INTEGER, text.to_i] }
\+ { [:ADD, text] }
inner
# here we put any ruby code we want to extend our lexer with.
# for example, our own tokenize method.
test "should destroy resource if user is admin" do
#given user is admin
u = User.create(:name => "nicole", :email => "nicole@me.com", :admin => true)
resource = Resource.create!(:id => "1", :title => "hi", :link => "http://hallo.com", :summary => "hi")
#when they click 'destroy resource'
delete :destroy, id: @resource.id
#then they destroy the resource
assert resource.link == nil
class ChangeColumn < ActiveRecord::Migration
def change
def up
change_column :resources, :summary, :text
end
def down
change_column :resources, :summary, :string
end
end