riot-mongoid 1.1.3 → 1.1.4

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/README.md CHANGED
@@ -16,7 +16,8 @@ Riot assertions for Mongoid
16
16
  # association assertions
17
17
  asserts_topic.has_association :belongs_to_related, :account
18
18
  asserts_topic.has_association :has_many_related, :comments
19
-
19
+ asserts_topic.has_association :embedded_in, :person, :inverse_of => :address
20
+
20
21
  # validation assertions
21
22
  asserts_topic.has_validation :validates_presence_of, :caption
22
23
 
data/Rakefile CHANGED
@@ -1,24 +1,8 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
+ require 'mg'
3
4
 
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "riot-mongoid"
8
- gem.summary = %Q{Riot assertions for Mongoid}
9
- gem.description = %Q{A collection of assertion macros for testing Mongoid with Riot}
10
- gem.email = "gabriel.gironda@gmail.com"
11
- gem.homepage = "http://github.com/gabrielg/riot-mongoid"
12
- gem.authors = ["gabrielg"]
13
- gem.add_development_dependency "riot", ">= 0"
14
- gem.add_development_dependency "yard", ">= 0"
15
- gem.add_dependency "mongoid", ">=1.2.7"
16
- gem.add_dependency "riot", ">=0.10.12"
17
- end
18
- Jeweler::GemcutterTasks.new
19
- rescue LoadError
20
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
21
- end
5
+ MG.new(File.join(File.dirname(__FILE__),"riot-mongoid.gemspec"))
22
6
 
23
7
  require 'rake/testtask'
24
8
  Rake::TestTask.new(:test) do |test|
@@ -40,8 +24,6 @@ rescue LoadError
40
24
  end
41
25
  end
42
26
 
43
- task :test => :check_dependencies
44
-
45
27
  task :default => :test
46
28
 
47
29
  begin
@@ -11,7 +11,7 @@ module RiotMongoid
11
11
  elsif assoc.nil? || assoc.macro != assoc_type.to_sym
12
12
  fail("expected #{model} to have association #{assoc_name} of type #{assoc_type}")
13
13
  else
14
- options_valid = options.all? { |key,value| assoc.send(key) == value }
14
+ options_valid = options.all? { |key,value| assoc.options.instance_variable_get("@attributes")[key] == value }
15
15
  options_valid ? pass("#{model} has '#{assoc_type}' association '#{assoc_name}' with options #{options.inspect}") :
16
16
  fail("expected model to have options #{options.inspect} on association #{assoc_name}")
17
17
  end
@@ -5,69 +5,21 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{riot-mongoid}
8
- s.version = "1.1.3"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.version = "1.1.4"
9
+ s.required_rubygems_version = ">= 1.3.6"
11
10
  s.authors = ["gabrielg"]
12
- s.date = %q{2010-06-10}
11
+ s.date = Time.now.strftime("%Y-%m-%d")
13
12
  s.description = %q{A collection of assertion macros for testing Mongoid with Riot}
14
13
  s.email = %q{gabriel.gironda@gmail.com}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.md"
18
- ]
19
- s.files = [
20
- ".document",
21
- ".gitignore",
22
- "LICENSE",
23
- "README.md",
24
- "Rakefile",
25
- "VERSION",
26
- "lib/riot-mongoid.rb",
27
- "lib/riot-mongoid/has_association.rb",
28
- "lib/riot-mongoid/has_field.rb",
29
- "lib/riot-mongoid/has_key.rb",
30
- "lib/riot-mongoid/has_validation.rb",
31
- "riot-mongoid.gemspec",
32
- "test/has_association_test.rb",
33
- "test/has_field_test.rb",
34
- "test/has_key_test.rb",
35
- "test/has_validation_test.rb",
36
- "test/teststrap.rb"
37
- ]
14
+ s.extra_rdoc_files = ["README.md"]
15
+ s.files = %w{.document .gitignore LICENSE README.md Rakefile riot-mongoid.gemspec} + Dir.glob("{lib,test}/**/*")
38
16
  s.homepage = %q{http://github.com/gabrielg/riot-mongoid}
39
17
  s.rdoc_options = ["--charset=UTF-8"]
40
18
  s.require_paths = ["lib"]
41
- s.rubygems_version = %q{1.3.6}
42
19
  s.summary = %q{Riot assertions for Mongoid}
43
- s.test_files = [
44
- "test/has_association_test.rb",
45
- "test/has_field_test.rb",
46
- "test/has_key_test.rb",
47
- "test/has_validation_test.rb",
48
- "test/teststrap.rb"
49
- ]
50
-
51
- if s.respond_to? :specification_version then
52
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
53
- s.specification_version = 3
54
-
55
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
56
- s.add_development_dependency(%q<riot>, [">= 0"])
57
- s.add_development_dependency(%q<yard>, [">= 0"])
58
- s.add_runtime_dependency(%q<mongoid>, [">= 1.2.7"])
59
- s.add_runtime_dependency(%q<riot>, [">= 0.10.12"])
60
- else
61
- s.add_dependency(%q<riot>, [">= 0"])
62
- s.add_dependency(%q<yard>, [">= 0"])
63
- s.add_dependency(%q<mongoid>, [">= 1.2.7"])
64
- s.add_dependency(%q<riot>, [">= 0.10.12"])
65
- end
66
- else
67
- s.add_dependency(%q<riot>, [">= 0"])
68
- s.add_dependency(%q<yard>, [">= 0"])
69
- s.add_dependency(%q<mongoid>, [">= 1.2.7"])
70
- s.add_dependency(%q<riot>, [">= 0.10.12"])
71
- end
20
+ s.add_development_dependency(%q<riot>, [">= 0"])
21
+ s.add_development_dependency(%q<yard>, [">= 0"])
22
+ s.add_runtime_dependency(%q<mongoid>, [">= 1.2.7"])
23
+ s.add_runtime_dependency(%q<riot>, [">= 0.10.12"])
72
24
  end
73
25
 
@@ -6,6 +6,7 @@ context "has_association macro" do
6
6
  embeds_many :things
7
7
  embedded_in :another_thing, :inverse_of => :word
8
8
  has_many_related :relations
9
+ has_many_related :reporters, :klass => 'Person'
9
10
  end
10
11
  end
11
12
 
@@ -21,10 +22,14 @@ context "has_association macro" do
21
22
  RiotMongoid::HasAssociationAssertion.new.evaluate(topic, :embedded_in, :another_thing, :inverse_of => :word).last
22
23
  end.matches(/has 'embedded_in' association 'another_thing' with options \{:inverse_of=>:word\}/)
23
24
 
24
- asserts "passes when the association options are specified for a has_many_related" do
25
+ asserts "passes when the no association options are specified for a has_many_related" do
25
26
  RiotMongoid::HasAssociationAssertion.new.evaluate(topic, :has_many_related, :relations).first
26
27
  end.equals(:pass)
27
28
 
29
+ asserts "passes when the association options are specified for a has_many_related" do
30
+ RiotMongoid::HasAssociationAssertion.new.evaluate(topic, :has_many_related, :reporters, :klass => 'Person').first
31
+ end.equals(:pass)
32
+
28
33
  asserts "fails when no association name is specified" do
29
34
  RiotMongoid::HasAssociationAssertion.new.evaluate(topic, :has_many).first
30
35
  end.equals(:fail)
@@ -34,7 +34,7 @@ context "has_validation macro" do
34
34
  end.equals(:fail)
35
35
 
36
36
  asserts "fails when invalid field options are specified" do
37
- RiotMongoid::HasValidationAssertion.new.evaluate(topic, :validates_length_of, :type => Date).first
37
+ RiotMongoid::HasValidationAssertion.new.evaluate(topic, :validates_length_of, :name, :type => Date).first
38
38
  end.equals(:fail)
39
39
 
40
40
  asserts "passes when another validation is specified" do
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riot-mongoid
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 27
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 1
8
- - 3
9
- version: 1.1.3
9
+ - 4
10
+ version: 1.1.4
10
11
  platform: ruby
11
12
  authors:
12
13
  - gabrielg
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-06-10 00:00:00 -05:00
18
+ date: 2010-06-17 00:00:00 -07:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: riot
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 3
27
30
  segments:
28
31
  - 0
29
32
  version: "0"
@@ -33,9 +36,11 @@ dependencies:
33
36
  name: yard
34
37
  prerelease: false
35
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
36
40
  requirements:
37
41
  - - ">="
38
42
  - !ruby/object:Gem::Version
43
+ hash: 3
39
44
  segments:
40
45
  - 0
41
46
  version: "0"
@@ -45,9 +50,11 @@ dependencies:
45
50
  name: mongoid
46
51
  prerelease: false
47
52
  requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
48
54
  requirements:
49
55
  - - ">="
50
56
  - !ruby/object:Gem::Version
57
+ hash: 17
51
58
  segments:
52
59
  - 1
53
60
  - 2
@@ -59,9 +66,11 @@ dependencies:
59
66
  name: riot
60
67
  prerelease: false
61
68
  requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
62
70
  requirements:
63
71
  - - ">="
64
72
  - !ruby/object:Gem::Version
73
+ hash: 47
65
74
  segments:
66
75
  - 0
67
76
  - 10
@@ -76,7 +85,6 @@ executables: []
76
85
  extensions: []
77
86
 
78
87
  extra_rdoc_files:
79
- - LICENSE
80
88
  - README.md
81
89
  files:
82
90
  - .document
@@ -84,13 +92,12 @@ files:
84
92
  - LICENSE
85
93
  - README.md
86
94
  - Rakefile
87
- - VERSION
88
- - lib/riot-mongoid.rb
95
+ - riot-mongoid.gemspec
89
96
  - lib/riot-mongoid/has_association.rb
90
97
  - lib/riot-mongoid/has_field.rb
91
98
  - lib/riot-mongoid/has_key.rb
92
99
  - lib/riot-mongoid/has_validation.rb
93
- - riot-mongoid.gemspec
100
+ - lib/riot-mongoid.rb
94
101
  - test/has_association_test.rb
95
102
  - test/has_field_test.rb
96
103
  - test/has_key_test.rb
@@ -106,29 +113,31 @@ rdoc_options:
106
113
  require_paths:
107
114
  - lib
108
115
  required_ruby_version: !ruby/object:Gem::Requirement
116
+ none: false
109
117
  requirements:
110
118
  - - ">="
111
119
  - !ruby/object:Gem::Version
120
+ hash: 3
112
121
  segments:
113
122
  - 0
114
123
  version: "0"
115
124
  required_rubygems_version: !ruby/object:Gem::Requirement
125
+ none: false
116
126
  requirements:
117
127
  - - ">="
118
128
  - !ruby/object:Gem::Version
129
+ hash: 23
119
130
  segments:
120
- - 0
121
- version: "0"
131
+ - 1
132
+ - 3
133
+ - 6
134
+ version: 1.3.6
122
135
  requirements: []
123
136
 
124
137
  rubyforge_project:
125
- rubygems_version: 1.3.6
138
+ rubygems_version: 1.3.7
126
139
  signing_key:
127
140
  specification_version: 3
128
141
  summary: Riot assertions for Mongoid
129
- test_files:
130
- - test/has_association_test.rb
131
- - test/has_field_test.rb
132
- - test/has_key_test.rb
133
- - test/has_validation_test.rb
134
- - test/teststrap.rb
142
+ test_files: []
143
+
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.1.3