f-matchers 0.0.3

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/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in fractal-matchers.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,18 @@
1
+ ## RSpec matchers
2
+
3
+ ### Active Record
4
+
5
+ #### accept_nested_attributes_for
6
+
7
+ class Section < ActiveRecord::Base
8
+ end
9
+
10
+ class Document < ActiveRecord::Base
11
+ has_one :section
12
+ accepts_nested_attributes_for :section
13
+ end
14
+ # test that Document accept_nested_attributes_for(:section)
15
+ it ....
16
+ Document.should accept_nested_attributes_for(:section)
17
+
18
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "f-matchers/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "f-matchers"
7
+ s.version = FMatchers::VERSION
8
+ s.authors = ["Andrea Campolonghi"]
9
+ s.email = ["acampolonghi@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Rspec matchers}
12
+ s.description = %q{Rspec matchers}
13
+
14
+ s.rubyforge_project = "f-matchers"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ s.add_runtime_dependency "rspec"
23
+ s.add_development_dependency "activerecord"
24
+ end
@@ -0,0 +1,6 @@
1
+ # return true is the model accept nested attributes for the passed attribute
2
+ RSpec::Matchers.define :accept_nested_attributes_for do |attribute|
3
+ match do |model|
4
+ model.nested_attributes_options.include? attribute
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module FMatchers
2
+ VERSION = "0.0.3"
3
+ end
data/lib/f-matchers.rb ADDED
@@ -0,0 +1,4 @@
1
+ require "f-matchers/version"
2
+ if defined?(RSpec)
3
+ require "f-matchers/rspec_matchers"
4
+ end
@@ -0,0 +1,18 @@
1
+ require "spec_helper"
2
+ require "support/rspec_f_matchers"
3
+
4
+ describe "rspec_f_matchers" do
5
+
6
+ context "accept_nested_attributes_for" do
7
+
8
+ it "should be true if model accept_nested_attributes_for the passed attribute" do
9
+ Document.should accept_nested_attributes_for(:section)
10
+ end
11
+
12
+ it "should be false if model accept_nested_attributes_for the passed attribute" do
13
+ Document.should_not accept_nested_attributes_for(:users)
14
+ end
15
+
16
+ end
17
+
18
+ end
@@ -0,0 +1,13 @@
1
+ require "f-matchers"
2
+
3
+ # This file was generated by the `rspec --init` command. Conventionally, all
4
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
5
+ # Require this file using `require "spec_helper.rb"` to ensure that it is only
6
+ # loaded once.
7
+ #
8
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
9
+ RSpec.configure do |config|
10
+ config.treat_symbols_as_metadata_keys_with_true_values = true
11
+ config.run_all_when_everything_filtered = true
12
+ config.filter_run :focus
13
+ end
@@ -0,0 +1,10 @@
1
+ require "active_record"
2
+
3
+ class Section < ActiveRecord::Base
4
+ end
5
+
6
+ class Document < ActiveRecord::Base
7
+ has_one :section
8
+ accepts_nested_attributes_for :section
9
+ end
10
+
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: f-matchers
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Andrea Campolonghi
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-02-07 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &70191054675800 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70191054675800
25
+ - !ruby/object:Gem::Dependency
26
+ name: activerecord
27
+ requirement: &70191054675140 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70191054675140
36
+ description: Rspec matchers
37
+ email:
38
+ - acampolonghi@gmail.com
39
+ executables: []
40
+ extensions: []
41
+ extra_rdoc_files: []
42
+ files:
43
+ - .gitignore
44
+ - .rspec
45
+ - Gemfile
46
+ - README.md
47
+ - Rakefile
48
+ - f-matchers.gemspec
49
+ - lib/f-matchers.rb
50
+ - lib/f-matchers/rspec_matchers.rb
51
+ - lib/f-matchers/version.rb
52
+ - spec/rspec_matchers_spec.rb
53
+ - spec/spec_helper.rb
54
+ - spec/support/rspec_f_matchers.rb
55
+ homepage: ''
56
+ licenses: []
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ requirements: []
74
+ rubyforge_project: f-matchers
75
+ rubygems_version: 1.8.10
76
+ signing_key:
77
+ specification_version: 3
78
+ summary: Rspec matchers
79
+ test_files:
80
+ - spec/rspec_matchers_spec.rb
81
+ - spec/spec_helper.rb
82
+ - spec/support/rspec_f_matchers.rb
83
+ has_rdoc: