f-matchers 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
+
@@ -1,3 +1,3 @@
1
1
  module FMatchers
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -25,4 +25,9 @@ describe "rspec_f_matchers" do
25
25
  it { should_not prepend_view_path_with('path_2') }
26
26
  end
27
27
 
28
- end
28
+ context "tokenizable" do
29
+ specify { Section.new.should be_tokenizable }
30
+ specify { Document.new.should_not be_tokenizable }
31
+ end
32
+
33
+ end
@@ -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
@@ -1,9 +1,10 @@
1
1
  class Section < ActiveRecord::Base
2
- end
2
+ has_many :tokens
3
+ end
3
4
 
4
5
  class Document < ActiveRecord::Base
5
6
  attr_protected :protect_me
6
7
  has_one :section
7
8
  accepts_nested_attributes_for :section
8
- end
9
+ end
9
10
 
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.7
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: 2012-03-30 00:00:00.000000000Z
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: &70169347574040 !ruby/object:Gem::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: *70169347574040
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: &70169347573600 !ruby/object:Gem::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: *70169347573600
36
- description: Rspec matchers
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.10
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