f-matchers 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/f-matchers/rspec_matchers.rb +13 -0
- data/lib/f-matchers/version.rb +1 -1
- data/spec/rspec_matchers_spec.rb +18 -8
- metadata +6 -6
@@ -20,3 +20,16 @@ RSpec::Matchers.define :protect_attribute do |attribute|
|
|
20
20
|
"#{subject.class} should not protect attribute #{attribute.inspect}"
|
21
21
|
end
|
22
22
|
end
|
23
|
+
|
24
|
+
# spec for prepend_view_path
|
25
|
+
RSpec::Matchers.define :prepend_view_path_with do |attribute|
|
26
|
+
match do |model|
|
27
|
+
model.send(:view_paths).first == attribute
|
28
|
+
end
|
29
|
+
failure_message_for_should do
|
30
|
+
"#{subject} should prepend view path with #{attribute}"
|
31
|
+
end
|
32
|
+
failure_message_for_should_not do
|
33
|
+
"#{subject} should not prepend view path with #{attribute}"
|
34
|
+
end
|
35
|
+
end
|
data/lib/f-matchers/version.rb
CHANGED
data/spec/rspec_matchers_spec.rb
CHANGED
@@ -1,17 +1,27 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe "rspec_f_matchers" do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
context "accept_nested_attributes_for" do
|
4
|
+
|
5
|
+
context "accept_nested_attributes_for" do
|
6
|
+
subject { Document }
|
8
7
|
it { should accept_nested_attributes_for(:section) }
|
9
8
|
it { should_not accept_nested_attributes_for(:users) }
|
10
|
-
end
|
9
|
+
end
|
11
10
|
|
12
|
-
context "protect_attribute" do
|
11
|
+
context "protect_attribute" do
|
12
|
+
subject { Document }
|
13
13
|
it { should protect_attribute(:protect_me) }
|
14
14
|
it { should_not protect_attribute(:do_not_protect_me) }
|
15
|
-
end
|
16
|
-
|
15
|
+
end
|
16
|
+
|
17
|
+
context "prepend_view_path_with" do
|
18
|
+
before do
|
19
|
+
@receiver = Object.new
|
20
|
+
@receiver.stub(:view_paths){ ['path_1'] }
|
21
|
+
end
|
22
|
+
subject{ @receiver }
|
23
|
+
it { should prepend_view_path_with('path_1') }
|
24
|
+
it { should_not prepend_view_path_with('path_2') }
|
25
|
+
end
|
26
|
+
|
17
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: f-matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-29 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70323269392480 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70323269392480
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activerecord
|
27
|
-
requirement: &
|
27
|
+
requirement: &70323269392040 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70323269392040
|
36
36
|
description: Rspec matchers
|
37
37
|
email:
|
38
38
|
- acampolonghi@gmail.com
|