spec/keytar_spec.rb in keytar-1.5.1 vs spec/keytar_spec.rb in keytar-1.5.2
- old
+ new
@@ -31,10 +31,11 @@
class BarBaz < ActiveRecord::Base
end
describe Keytar do
+
describe 'class and instance interference' do
it 'should not happen' do
bar = Bar.create(:name => "whatever")
orig_key = Bar.awesome_key(bar.id)
bar.awesome_key(bar.id)
@@ -42,9 +43,23 @@
second_key.should eq(orig_key)
end
end
describe 'define_key' do
+
+ it 'lets us not change key case when :key_case => :none is passed' do
+ Foo.define_key(:cached_instance_method, :key_case => nil)
+ @foo = Foo.new
+ key = @foo.cached_instance_method_key("NotUpCaseOrDownCase")
+ key.should eq("Foos:cached_instance_method:NotUpCaseOrDownCase")
+ end
+
+ it 'lets us not change key case when :key_case => nil is passed' do
+ Foo.define_key(:cached_instance_method, :key_case => nil)
+ @foo = Foo.new
+ key = @foo.cached_instance_method_key("NotUpCaseOrDownCase")
+ key.should eq("Foos:cached_instance_method:NotUpCaseOrDownCase")
+ end
it 'allows us to pre-define instance methods' do
Foo.define_key(:cached_instance_method, :delimiter => "|", :version => "3")
@foo = Foo.new
@foo.respond_to?(:cached_instance_method_key).should be_true
\ No newline at end of file