spec/expressive_spec.rb in expressive-0.0.6 vs spec/expressive_spec.rb in expressive-0.0.7
- old
+ new
@@ -85,9 +85,37 @@
it { Expressive.run('(or nil_value true)', @scope).should eql true }
it { Expressive.run('(or nil_value false)', @scope).should eql false }
end
end
+ describe "understands the modification of scope" do
+ it "using single set commands" do
+ @scope['vsi'] = 'oldvalue'
+ Expressive.run('(set vsi "vsi1234")', @scope).should eql "vsi1234"
+ @scope['vsi'].should eql 'vsi1234'
+ end
+
+ it "using multiple set commands" do
+ Expressive.run('(and (set vsi "vsi1234") (set vso "vso1234"))', @scope).should eql true
+ @scope['vsi'].should eql 'vsi1234'
+ @scope['vso'].should eql 'vso1234'
+ end
+ end
+
+ describe "understands date parsing" do
+ it "will return the current date" do
+ now = Date.today.to_time.utc
+ Timecop.freeze(now) do
+ Expressive.run('(date)').should eql now
+ end
+ end
+
+ it "will return a date parsed from text" do
+ date = Date.new(2012, 11, 22).to_time.utc
+ Expressive.run('(date(22/11/2012))').should eql date
+ end
+ end
+
describe "understands web-hook statements" do
context "put" do
it_should_behave_like "a webhook", :put
it "should put the cope parameters if given" do
@scope['ohai'] = "world"