f-matchers 0.0.7 → 0.0.8
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/f-matchers.gemspec +3 -2
- data/lib/f-matchers/rspec_matchers.rb +10 -2
- data/lib/f-matchers/version.rb +1 -1
- data/spec/rspec_matchers_spec.rb +6 -1
- data/spec/spec_helper.rb +3 -0
- data/spec/support/models.rb +3 -2
- metadata +35 -9
data/f-matchers.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.authors = ["Andrea Campolonghi"]
|
9
9
|
s.email = ["acampolonghi@gmail.com"]
|
10
10
|
s.homepage = ""
|
11
|
-
s.summary = %q{Rspec matchers}
|
12
|
-
s.description = %q{Rspec matchers}
|
11
|
+
s.summary = %q{Rspec matchers to be shared and reused}
|
12
|
+
s.description = %q{Rspec matchers to be shared and reused}
|
13
13
|
|
14
14
|
s.rubyforge_project = "f-matchers"
|
15
15
|
|
@@ -21,4 +21,5 @@ Gem::Specification.new do |s|
|
|
21
21
|
# specify any dependencies here; for example:
|
22
22
|
s.add_runtime_dependency "rspec"
|
23
23
|
s.add_development_dependency "activerecord"
|
24
|
+
s.add_development_dependency "sqlite3"
|
24
25
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# return true is the model accept nested attributes for the passed attribute
|
2
2
|
RSpec::Matchers.define :accept_nested_attributes_for do |attribute|
|
3
3
|
match do |model|
|
4
|
-
klazz = model.respond_to?(:new) ? model : model.class
|
4
|
+
klazz = model.respond_to?(:new) ? model : model.class
|
5
5
|
klazz.nested_attributes_options.include? attribute
|
6
6
|
end
|
7
7
|
end
|
@@ -9,7 +9,7 @@ end
|
|
9
9
|
# spec for attr_protected declarations
|
10
10
|
RSpec::Matchers.define :protect_attribute do |attribute|
|
11
11
|
match do |model|
|
12
|
-
klazz = model.respond_to?(:new) ? model : model.class
|
12
|
+
klazz = model.respond_to?(:new) ? model : model.class
|
13
13
|
protected = klazz.protected_attributes
|
14
14
|
protected.include? attribute if protected
|
15
15
|
end
|
@@ -33,3 +33,11 @@ RSpec::Matchers.define :prepend_view_path_with do |attribute|
|
|
33
33
|
"#{subject} should not prepend view path with #{attribute}"
|
34
34
|
end
|
35
35
|
end
|
36
|
+
|
37
|
+
# Return true is the model is usign the 'tokens' or respond to :tokens
|
38
|
+
RSpec::Matchers.define :be_tokenizable do |attribute|
|
39
|
+
match do |klazz|
|
40
|
+
klazz.respond_to?(:tokens)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
data/lib/f-matchers/version.rb
CHANGED
data/spec/rspec_matchers_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -6,6 +6,9 @@ ActiveRecord::Base.establish_connection :adapter => "sqlite3", :database => "db
|
|
6
6
|
ActiveRecord::Base.connection.create_table(:documents,:force => true) do |t|
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
|
+
ActiveRecord::Base.connection.create_table(:sections,:force => true) do |t|
|
10
|
+
t.timestamps
|
11
|
+
end
|
9
12
|
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
|
10
13
|
|
11
14
|
# This file was generated by the `rspec --init` command. Conventionally, all
|
data/spec/support/models.rb
CHANGED
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.8
|
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:
|
12
|
+
date: 2013-05-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: activerecord
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,8 +37,29 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: sqlite3
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: Rspec matchers to be shared and reused
|
37
63
|
email:
|
38
64
|
- acampolonghi@gmail.com
|
39
65
|
executables: []
|
@@ -72,10 +98,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
98
|
version: '0'
|
73
99
|
requirements: []
|
74
100
|
rubyforge_project: f-matchers
|
75
|
-
rubygems_version: 1.8.
|
101
|
+
rubygems_version: 1.8.24
|
76
102
|
signing_key:
|
77
103
|
specification_version: 3
|
78
|
-
summary: Rspec matchers
|
104
|
+
summary: Rspec matchers to be shared and reused
|
79
105
|
test_files:
|
80
106
|
- spec/rspec_matchers_spec.rb
|
81
107
|
- spec/spec_helper.rb
|