riot_rails 0.0.4 → 0.0.5
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/VERSION +1 -1
- data/lib/riot/active_record/assertion_macros.rb +3 -0
- data/riot_rails.gemspec +4 -3
- data/test/active_record/validates_uniqueness_of_test.rb +1 -1
- data/test/teststrap.rb +13 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
@@ -63,6 +63,9 @@ module Riot
|
|
63
63
|
fail("topic is not a new record when testing uniqueness of #{attribute}")
|
64
64
|
else
|
65
65
|
copied_model = actual_record.class.new
|
66
|
+
actual_record.attributes.each do |dup_attribute, dup_value|
|
67
|
+
actual_record.write_attribute(dup_attribute, dup_value)
|
68
|
+
end
|
66
69
|
copied_value = actual_record.read_attribute(attribute)
|
67
70
|
msg = "expected to fail because #{attribute.inspect} is not unique"
|
68
71
|
error_from_writing_value(copied_model, attribute, copied_value) || fail(msg)
|
data/riot_rails.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{riot_rails}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Justin 'Gus' Knowlden"]
|
@@ -82,3 +82,4 @@ Gem::Specification.new do |s|
|
|
82
82
|
s.add_dependency(%q<activerecord>, [">= 2.3.2"])
|
83
83
|
end
|
84
84
|
end
|
85
|
+
|
@@ -3,7 +3,7 @@ require 'teststrap'
|
|
3
3
|
context "validates_uniqueness_of" do
|
4
4
|
|
5
5
|
setup_and_run_context("without a persisted record", 0, 1, 0) do |test_ctx|
|
6
|
-
test_ctx.setup { Room.new(:email => "foo@bar.baz") }
|
6
|
+
test_ctx.setup { Room.new(:email => "foo@bar.baz", :foo => "what") }
|
7
7
|
test_ctx.topic.validates_uniqueness_of :email
|
8
8
|
end
|
9
9
|
|
data/test/teststrap.rb
CHANGED
@@ -2,9 +2,20 @@ require 'rubygems'
|
|
2
2
|
require 'active_record'
|
3
3
|
require 'action_controller'
|
4
4
|
|
5
|
+
class NilIO
|
6
|
+
def write(*args); end
|
7
|
+
def close(*args); end
|
8
|
+
def puts(*args); end
|
9
|
+
def path; nil; end
|
10
|
+
def fsync; 0; end
|
11
|
+
def to_s; "hello"; end
|
12
|
+
def sync; true; end
|
13
|
+
def sync=(arg); arg; end
|
14
|
+
end
|
15
|
+
|
5
16
|
def shhh(&block)
|
6
17
|
orig_out = $stdout
|
7
|
-
$stdout =
|
18
|
+
$stdout = NilIO.new
|
8
19
|
yield
|
9
20
|
$stdout = orig_out
|
10
21
|
end
|
@@ -22,6 +33,7 @@ shhh do
|
|
22
33
|
load(File.join(RAILS_ROOT, "db", "schema.rb"))
|
23
34
|
end
|
24
35
|
|
36
|
+
ActiveRecord::Base.logger = Logger.new(NilIO.new)
|
25
37
|
ActionController::Base.view_paths = [File.join(RAILS_ROOT, 'app', 'views')]
|
26
38
|
|
27
39
|
#
|