Sha256: ec95790fb519e048423e4be00e68478b497d06f9a64dd65530e05af9ca6ad46f
Contents?: true
Size: 1.59 KB
Versions: 4
Compression:
Stored size: 1.59 KB
Contents
require "spec_helper" describe Crush::Engine do class Stripper < Crush::Engine def evaluate(*args) case options[:direction] when :left data.lstrip when :right data.rstrip else data.strip end end end describe ".compress" do it "compresses the given data" do Stripper.compress(" data ").should == "data" end it "accepts options" do Stripper.compress(" data ", :direction => :left).should == "data " Stripper.compress(" data ", :direction => :right).should == " data" end it "is aliased as `compile`" do Stripper.compile(" data ").should == "data" end end describe "#initialize" do it "does not raise errors without a file or block" do expect { Stripper.new }.to_not raise_error(ArgumentError) end end describe "#compress" do it "compresses the given data" do Stripper.new.compress(" data ").should == "data" end it "uses options set when initializing" do Stripper.new(:direction => :left).compress(" data ").should == "data " Stripper.new(:direction => :right).compress(" data ").should == " data" end it "is aliased as `compile`" do Stripper.new.compile(" data ").should == "data" end it "can be used without an argument" do Stripper.new { " data " }.compress.should == "data" end end describe "#render" do it "throws an error if used without data" do expect { Stripper.new.render }.to raise_error(ArgumentError) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
crush-0.3.3 | spec/crush/engine_spec.rb |
crush-0.3.2 | spec/crush/engine_spec.rb |
crush-0.3.1 | spec/crush/engine_spec.rb |
crush-0.3.0 | spec/crush/engine_spec.rb |