Pr0d1r2-active_record_connectionless 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{active_record_connectionless}
8
- s.version = "1.0.0"
8
+ s.version = "1.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Marcin Nowicki"]
12
- s.date = %q{2009-09-15}
12
+ s.date = %q{2009-09-23}
13
13
  s.description = %q{This gem provides connectionless active_record models useful for testing}
14
14
  s.email = %q{pr0d1r2@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -16,4 +16,11 @@ ActiveRecord::Base.class_eval do
16
16
  validate ? valid? : true
17
17
  end
18
18
 
19
+ def self.emulate_attribute(name)
20
+ attr_accessor name
21
+ define_method("#{name}_before_type_cast") do
22
+ self.name
23
+ end
24
+ end
25
+
19
26
  end
@@ -18,4 +18,18 @@ describe "ActiveRecordConnectionless" do
18
18
  }.should_not raise_error(ActiveRecord::ConnectionNotEstablished)
19
19
  end
20
20
 
21
+ describe 'emulate_attribute' do
22
+ it 'should provide emulate_attribute method that create emulated activerecord attribute' do
23
+ ActiveRecordConnectionless.should_receive(:attr_accessor).with(:name)
24
+ ActiveRecordConnectionless.should_receive(:define_method).with("name_before_type_cast")
25
+ ActiveRecordConnectionless.emulate_attribute(:name)
26
+ end
27
+
28
+ it 'should create an method which points to original attribute' do
29
+ ActiveRecordConnectionless.emulate_attribute(:name)
30
+ active_record_connectionless = ActiveRecordConnectionless.new(:name => 'name')
31
+ active_record_connectionless.name_before_type_cast.should == 'name'
32
+ end
33
+ end
34
+
21
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Pr0d1r2-active_record_connectionless
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcin Nowicki
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-15 00:00:00 -07:00
12
+ date: 2009-09-23 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency