Sha256: bdc8c18e11c9ee267d9a4b5312589d6aaf596b0e7aa4ba01089b7b70d97a3a87
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
require "spec_helper" RSpec.describe FooBar do describe "::datetime_scopes" do let!(:proxy_methods) { DateTimeScopes::DateTimeProxy::PROXY_METHODS } it "defines datetime scopes" do proxy_methods.each do |method_name| expect(FooBar).to respond_to "foo_#{method_name}" end end it "delegates a scope call to a proxy" do proxy_methods.each do |method_name| dbl = double("result") expect_any_instance_of(DateTimeScopes::DateTimeProxy).to receive(method_name).with(1, 2, 3).and_return(dbl) res = FooBar.send("foo_#{method_name}", 1, 2, 3) expect(res).to eq(dbl) end end end describe "::date_scopes" do def proxy_methods DateTimeScopes::DateProxy::PROXY_METHODS end it "defines date scopes" do proxy_methods.each do |method_name| expect(FooBar).to respond_to "bar_#{method_name}" end end it "delegates a scope call to a proxy" do proxy_methods.each do |method_name| dbl = double("result") expect_any_instance_of(DateTimeScopes::DateProxy).to receive(method_name).with(1, 2, 3).and_return(dbl) res = FooBar.send("bar_#{method_name}", 1, 2, 3) expect(res).to eq(dbl) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
datetime-scopes-1.0.0.alpha1 | spec/datetime-scopes/active_record_extension_spec.rb |