spec/expressive_spec.rb in expressive-0.0.14 vs spec/expressive_spec.rb in expressive-0.0.15

- old
+ new

@@ -142,10 +142,22 @@ @scope["owned_by_id"].should eql @user2.id @scope["owned_by_type"].should eql "RSpec::Mocks::Mock" end end + describe "understands time ranges" do + before do + @now = Time.now + Time.stub!(:now).and_return(@now) + end + + it { Expressive.run("($days_ago 28)").should eql (@now - 28 * 86400) } + it { Expressive.run("($hours_ago 7)").should eql (@now - 7 * 3600) } + it { Expressive.run("($minutes_ago 12)").should eql (@now - 12 * 60) } + end + + describe "understands using lookup functions" do it "should perform the lookup function (add account and reverse login)" do @scope.add_lookup_function("account_reverse_login", account: "ea") do |options, login| "#{options[:account]}-#{login.reverse}" end @@ -157,10 +169,9 @@ [related_type, query_specs.length, last] end Expressive.run('(lookup related_count "matters" (1 2 3) 10)', @scope).should eql ['matters', 3, 10] end - end describe "understands web-hook statements" do context "put" do it_should_behave_like "a webhook", :put