remarkable_activerecord 3.0.9 → 3.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/remarkable_activerecord/describe.rb +3 -3
- data/spec/describe_spec.rb +7 -0
- metadata +3 -3
@@ -54,20 +54,20 @@ module Remarkable
|
|
54
54
|
pieces = []
|
55
55
|
attributes.each do |key, value|
|
56
56
|
translated_key = if described_class.respond_to?(:human_attribute_name)
|
57
|
-
described_class.human_attribute_name(key, :locale => Remarkable.locale)
|
57
|
+
described_class.human_attribute_name(key.to_s, :locale => Remarkable.locale)
|
58
58
|
else
|
59
59
|
key.to_s.humanize
|
60
60
|
end
|
61
61
|
|
62
62
|
pieces << Remarkable.t("remarkable.active_record.describe.each",
|
63
63
|
:default => "{{key}} is {{value}}",
|
64
|
-
:key =>
|
64
|
+
:key => translated_key.downcase, :value => value.inspect)
|
65
65
|
end
|
66
66
|
|
67
67
|
description << pieces.join(connector)
|
68
68
|
args.unshift(description)
|
69
69
|
|
70
|
-
# Creates an example group,
|
70
|
+
# Creates an example group, set the subject and eval the given block.
|
71
71
|
#
|
72
72
|
example_group = super(*args) do
|
73
73
|
write_inheritable_hash(:default_subject_attributes, attributes)
|
data/spec/describe_spec.rb
CHANGED
@@ -30,6 +30,13 @@ describe Post do
|
|
30
30
|
self.class.description.should == "MyPost when published is true"
|
31
31
|
end
|
32
32
|
|
33
|
+
it "should call human name attribute on the described class" do
|
34
|
+
Post.should_receive(:human_attribute_name).with("comments_count", :locale => :en).and_return("__COMMENTS__COUNT__")
|
35
|
+
self.class.describe(:comments_count => 5) do
|
36
|
+
self.description.should == 'MyPost when published is true and __comments__count__ is 5'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
33
40
|
describe :public => false do
|
34
41
|
it "should nest subject attributes" do
|
35
42
|
subject.published.should be_true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remarkable_activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Brando
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2009-04-
|
14
|
+
date: 2009-04-27 00:00:00 +02:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
requirements:
|
23
23
|
- - ">="
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version: 3.0.
|
25
|
+
version: 3.0.10
|
26
26
|
version:
|
27
27
|
description: "Remarkable ActiveRecord: collection of matchers and macros with I18n for ActiveRecord"
|
28
28
|
email:
|