shoulda-matchers 2.8.0.rc2 → 2.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32080268ac2a3012ac2aa244c3ac77423ed70476
4
- data.tar.gz: 4ceeb77988ab6611c4d969a1c4e8c4a05c9cbca4
3
+ metadata.gz: e8d1979af1b53164efe4a312705f9879f599b123
4
+ data.tar.gz: 4f95461b3a1327e5ccf9d233f466cab9ff0e41d0
5
5
  SHA512:
6
- metadata.gz: b96f693aec168e4fa7e19991b0b0e8622b2e568d6ae052f8c2ad109b80f6e3b04ad354cf80db62378ccd7f77618f7eb1df1354195e12adcb473e1b2ba8d45403
7
- data.tar.gz: c2c33d4404bd7dfa62f3fb72fa7f1a554cf414bcea7204fd691659dc55c4b82a86be6af059b58e7954194a7a348de37a2f0dadf23d9fb62f3503a0ed233a53db
6
+ metadata.gz: 9ce8af4fa7d9b70636ee576221f15646621900908f9e351a9cff54de47514e4f01242b4d7ce5340e8dc0c053341e82e9c90afe991d55a1b35af74853a0a2d0f8
7
+ data.tar.gz: 1c8fb02675836314efc0c43c3054b16a02b6b56d36070472f1780a3b677de74f47281c01290902f5c81bc8051ed06982e17ddaf159ed44c3098470882130125b
data/.gitignore CHANGED
@@ -1,13 +1,11 @@
1
- *.rbc
2
- *.swo
3
- *.swp
4
1
  .bundle
5
2
  .gh-pages
6
- .svn/
3
+ .thoughtbot-gh-pages
4
+ .mcmire-gh-pages
7
5
  .yardoc
8
6
  coverage
7
+ build
9
8
  doc
10
9
  pkg
11
- tags
12
- test/*/log/*.log
10
+ source
13
11
  tmp
@@ -1,4 +1,11 @@
1
1
  language: ruby
2
+ sudo: false
3
+ script: "bundle exec rake"
4
+
5
+ branches:
6
+ except:
7
+ - site
8
+ - gh-pages
2
9
 
3
10
  rvm:
4
11
  - 1.9.2
@@ -9,10 +16,6 @@ gemfile:
9
16
  - gemfiles/3.1.gemfile
10
17
  - gemfiles/3.2.gemfile
11
18
 
12
- sudo: false
13
-
14
- script: "bundle exec rake"
15
-
16
19
  matrix:
17
20
  allow_failures:
18
21
  - rvm: rbx-19mode
data/NEWS.md CHANGED
@@ -1,28 +1,4 @@
1
- # 2.8.0.rc2
2
-
3
- ### Bug fixes
4
-
5
- * Fix `allow_value`, `validate_numericality_of` and `validate_inclusion_of` so
6
- that they handle RangeErrors emitted from ActiveRecord 4.2. These exceptions
7
- arise whenever we attempt to set an attribute using a value that lies outside
8
- the range of the column (assuming the column is an integer). RangeError is now
9
- treated specially, failing the test instead of bubbling up as an error.
10
- ([#634], [#637], [#642])
11
-
12
- ### Features
13
-
14
- * Update `dependent` qualifier on association matchers to support `:destroy`,
15
- `:delete`, `:nullify`, `:restrict`, `:restrict_with_exception`, and
16
- `:restrict_with_error`. You can also pass `true` or `false` to assert that
17
- the association has (or has not) been declared with *any* dependent option.
18
- ([#631])
19
-
20
- [#631]: https://github.com/thoughtbot/shoulda-matchers/pull/631
21
- [#634]: https://github.com/thoughtbot/shoulda-matchers/pull/634
22
- [#637]: https://github.com/thoughtbot/shoulda-matchers/pull/637
23
- [#642]: https://github.com/thoughtbot/shoulda-matchers/pull/642
24
-
25
- # 2.8.0.rc1
1
+ # 2.8.0
26
2
 
27
3
  ### Deprecations
28
4
 
@@ -73,6 +49,13 @@
73
49
  notation (e.g. `posts#show`), route parameters such as `id` do not need to be
74
50
  specified as a string but may be specified as a number as well. ([#602])
75
51
 
52
+ * Fix `allow_value`, `validate_numericality_of` and `validate_inclusion_of` so
53
+ that they handle RangeErrors emitted from ActiveRecord 4.2. These exceptions
54
+ arise whenever we attempt to set an attribute using a value that lies outside
55
+ the range of the column (assuming the column is an integer). RangeError is now
56
+ treated specially, failing the test instead of bubbling up as an error.
57
+ ([#634], [#637], [#642])
58
+
76
59
  ### Features
77
60
 
78
61
  * Add ability to test `:primary_key` option on associations. ([#597])
@@ -94,6 +77,12 @@
94
77
  * Add support for Rails 4.2, especially fixing `serialize` matcher to remove
95
78
  warning about `serialized_attributes` being deprecated. ([#627])
96
79
 
80
+ * Update `dependent` qualifier on association matchers to support `:destroy`,
81
+ `:delete`, `:nullify`, `:restrict`, `:restrict_with_exception`, and
82
+ `:restrict_with_error`. You can also pass `true` or `false` to assert that
83
+ the association has (or has not) been declared with *any* dependent option.
84
+ ([#631])
85
+
97
86
  ### Improvements
98
87
 
99
88
  * Tweak `allow_value` failure message so that it reads a bit nicer when listing
@@ -111,6 +100,10 @@
111
100
  [#543]: https://github.com/thoughtbot/shoulda-matchers/pull/543
112
101
  [#622]: https://github.com/thoughtbot/shoulda-matchers/pull/622
113
102
  [#627]: https://github.com/thoughtbot/shoulda-matchers/pull/627
103
+ [#631]: https://github.com/thoughtbot/shoulda-matchers/pull/631
104
+ [#634]: https://github.com/thoughtbot/shoulda-matchers/pull/634
105
+ [#637]: https://github.com/thoughtbot/shoulda-matchers/pull/637
106
+ [#642]: https://github.com/thoughtbot/shoulda-matchers/pull/642
114
107
 
115
108
  # 2.7.0
116
109
 
data/README.md CHANGED
@@ -183,7 +183,7 @@ and may be redistributed under the terms specified in the
183
183
  [travis-badge]: http://img.shields.io/travis/thoughtbot/shoulda-matchers/master.svg
184
184
  [travis]: http://travis-ci.org/thoughtbot/shoulda-matchers
185
185
  [downloads-badge]: http://img.shields.io/gem/dtv/shoulda-matchers.svg
186
- [rubydocs]: http://thoughtbot.github.io/shoulda-matchers
186
+ [rubydocs]: http://matchers.shoulda.io/docs
187
187
  [community]: http://thoughtbot.com/community
188
188
  [contributors]: https://github.com/thoughtbot/shoulda-matchers/contributors
189
189
  [shoulda]: http://github.com/thoughtbot/shoulda
data/Rakefile CHANGED
@@ -2,10 +2,7 @@ require 'bundler/setup'
2
2
  require 'bundler/gem_tasks'
3
3
  require 'rspec/core/rake_task'
4
4
  require 'appraisal'
5
- require 'erb'
6
- require_relative 'lib/shoulda/matchers/version'
7
-
8
- CURRENT_VERSION = Shoulda::Matchers::VERSION
5
+ require_relative 'tasks/documentation'
9
6
 
10
7
  RSpec::Core::RakeTask.new('spec:unit') do |t|
11
8
  t.ruby_opts = '-w -r ./spec/report_warnings'
@@ -34,106 +31,6 @@ task :appraise do
34
31
  exec 'appraisal install && appraisal rake'
35
32
  end
36
33
 
37
- GH_PAGES_DIR = '.gh-pages'
38
-
39
- namespace :docs do
40
- file GH_PAGES_DIR do
41
- sh "git clone git@github.com:thoughtbot/shoulda-matchers.git #{GH_PAGES_DIR} --branch gh-pages"
42
- end
43
-
44
- task :setup => GH_PAGES_DIR do
45
- within_gh_pages do
46
- sh 'git fetch origin'
47
- sh 'git reset --hard origin/gh-pages'
48
- end
49
- end
50
-
51
- desc 'Generate docs for a particular version'
52
- task :generate, [:version, :latest_version] => :setup do |t, args|
53
- generate_docs(args.version, latest_version: latest_version)
54
- end
55
-
56
- desc 'Generate docs for a particular version and push them to GitHub'
57
- task :publish, [:version, :latest_version] => :setup do |t, args|
58
- generate_docs(args.version, latest_version: latest_version)
59
- publish_docs(args.version, latest_version: latest_version)
60
- end
61
-
62
- desc "Generate docs for version #{CURRENT_VERSION} and push them to GitHub"
63
- task :publish_latest => :setup do
64
- version = Gem::Version.new(CURRENT_VERSION)
65
-
66
- unless version.prerelease?
67
- latest_version = version.to_s
68
- end
69
-
70
- generate_docs(CURRENT_VERSION, latest_version: latest_version)
71
- publish_docs(CURRENT_VERSION, latest_version: latest_version)
72
- end
73
-
74
- def rewrite_index_to_inject_version(ref, version)
75
- within_gh_pages do
76
- filename = "#{ref}/index.html"
77
- content = File.read(filename)
78
- content.sub!(%r{<h1>shoulda-matchers.+</h1>}, "<h1>shoulda-matchers (#{version})</h1>")
79
- File.open(filename, 'w') {|f| f.write(content) }
80
- end
81
- end
82
-
83
- def generate_docs(version, options = {})
84
- ref = determine_ref_from(version)
85
-
86
- sh "rm -rf #{GH_PAGES_DIR}/#{ref}"
87
- sh "bundle exec yard -o #{GH_PAGES_DIR}/#{ref}"
88
-
89
- rewrite_index_to_inject_version(ref, version)
90
-
91
- within_gh_pages do
92
- sh "git add #{ref}"
93
- end
94
-
95
- if options[:latest_version]
96
- generate_file_that_redirects_to_latest_version(options[:latest_version])
97
- end
98
- end
99
-
100
- def publish_docs(version, options = {})
101
- message = build_commit_message(version)
102
-
103
- within_gh_pages do
104
- sh 'git clean -f'
105
- sh "git commit -m '#{message}'"
106
- sh 'git push'
107
- end
108
- end
109
-
110
- def generate_file_that_redirects_to_latest_version(version)
111
- ref = determine_ref_from(version)
112
- locals = { ref: ref }
113
-
114
- erb = ERB.new(File.read('doc_config/gh-pages/index.html.erb'))
115
-
116
- within_gh_pages do
117
- File.open('index.html', 'w') { |f| f.write(erb.result(binding)) }
118
- sh 'git add index.html'
119
- end
120
- end
121
-
122
- def determine_ref_from(version)
123
- if version =~ /^\d+\.\d+\.\d+/
124
- 'v' + version
125
- else
126
- version
127
- end
128
- end
129
-
130
- def build_commit_message(version)
131
- "Regenerated docs for version #{version}"
132
- end
133
-
134
- def within_gh_pages(&block)
135
- Dir.chdir(GH_PAGES_DIR, &block)
136
- end
137
- end
34
+ Shoulda::Matchers::DocumentationTasks.create
138
35
 
139
36
  task release: 'docs:publish_latest'
@@ -2,7 +2,7 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>shoulda-matchers Documentation - latest</title>
5
- <meta http-equiv="refresh" content="0;URL=http://thoughtbot.github.io/shoulda-matchers/<%= locals[:ref] %>">
5
+ <meta http-equiv="refresh" content="0;URL=<%= locals[:ref] %>">
6
6
  </head>
7
7
  <body>
8
8
  </body>
@@ -1,6 +1,6 @@
1
1
  module Shoulda
2
2
  module Matchers
3
3
  # @private
4
- VERSION = '2.8.0.rc2'.freeze
4
+ VERSION = '2.8.0'.freeze
5
5
  end
6
6
  end
@@ -0,0 +1,171 @@
1
+ require_relative '../lib/shoulda/matchers/version'
2
+ require 'erb'
3
+
4
+ module Shoulda
5
+ module Matchers
6
+ module DocumentationTasks
7
+ extend Rake::DSL
8
+
9
+ def self.create
10
+ publisher = DocumentationPublisher.new
11
+
12
+ namespace :docs do
13
+ file DocumentationPublisher.gh_pages_dir do
14
+ publisher.create_reference_to_gh_pages_branch
15
+ end
16
+
17
+ file DocumentationPublisher.docs_dir => DocumentationPublisher.gh_pages_dir
18
+
19
+ task :setup => DocumentationPublisher.docs_dir do
20
+ publisher.reset_repo_directory
21
+ end
22
+
23
+ desc 'Generate docs for a particular version'
24
+ task :generate, [:version, :latest_version] => :setup do |t, args|
25
+ unless args.version
26
+ raise ArgumentError, "Missing version"
27
+ end
28
+
29
+ unless args.latest_version
30
+ raise ArgumentError, "Missing latest_version"
31
+ end
32
+
33
+ publisher.generate_docs_for(args.version, latest_version: args.latest_version)
34
+ end
35
+
36
+ desc 'Generate docs for a particular version and push them to GitHub'
37
+ task :publish, [:version, :latest_version] => :setup do |t, args|
38
+ unless args.version
39
+ raise ArgumentError, "Missing version"
40
+ end
41
+
42
+ unless args.latest_version
43
+ raise ArgumentError, "Missing latest_version"
44
+ end
45
+
46
+ publisher.generate_docs_for(args.version, latest_version: args.latest_version)
47
+ publisher.publish_docs_for(args.version, latest_version: args.latest_version)
48
+ end
49
+
50
+ desc "Generate docs for version #{DocumentationPublisher.current_version} and push them to GitHub"
51
+ task :publish_latest => :setup do
52
+ publisher.publish_latest_version
53
+ end
54
+ end
55
+ end
56
+ end
57
+
58
+ class DocumentationPublisher
59
+ CURRENT_VERSION = Shoulda::Matchers::VERSION
60
+ GITHUB_USERNAME = 'thoughtbot'
61
+ # GITHUB_USERNAME = 'mcmire'
62
+ GH_PAGES_DIR = ".#{GITHUB_USERNAME}-gh-pages"
63
+ DOCS_DIR = "#{GH_PAGES_DIR}/docs"
64
+
65
+ def self.current_version
66
+ CURRENT_VERSION
67
+ end
68
+
69
+ def self.gh_pages_dir
70
+ GH_PAGES_DIR
71
+ end
72
+
73
+ def self.docs_dir
74
+ DOCS_DIR
75
+ end
76
+
77
+ def create_reference_to_gh_pages_branch
78
+ system "git clone git@github.com:#{GITHUB_USERNAME}/shoulda-matchers.git #{GH_PAGES_DIR} --branch gh-pages"
79
+ end
80
+
81
+ def reset_repo_directory
82
+ within_gh_pages_dir do
83
+ system 'git fetch origin'
84
+ system 'git reset --hard origin/gh-pages'
85
+ end
86
+ end
87
+
88
+ def generate_docs_for(version, options = {})
89
+ ref = determine_ref_from(version)
90
+
91
+ system "rm -rf #{DOCS_DIR}/#{ref}"
92
+ system "bundle exec yard -o #{DOCS_DIR}/#{ref}"
93
+
94
+ add_version_to_index_page_for(ref, version)
95
+
96
+ within_docs_dir do
97
+ system "git add #{ref}"
98
+ end
99
+
100
+ if options[:latest_version]
101
+ generate_file_that_redirects_to_latest_version(options[:latest_version])
102
+ end
103
+ end
104
+
105
+ def publish_docs_for(version, options = {})
106
+ message = build_commit_message(version)
107
+
108
+ within_gh_pages_dir do
109
+ system 'git clean -f'
110
+ system "git commit -m '#{message}'"
111
+ system 'git push origin gh-pages'
112
+ end
113
+ end
114
+
115
+ def publish_latest_version
116
+ version = Gem::Version.new(CURRENT_VERSION)
117
+ options = {}
118
+
119
+ unless version.prerelease?
120
+ options[:latest_version] = version.to_s
121
+ end
122
+
123
+ generate_docs_for(CURRENT_VERSION, options)
124
+ publish_docs_for(CURRENT_VERSION, options)
125
+ end
126
+
127
+ private
128
+
129
+ def add_version_to_index_page_for(ref, version)
130
+ within_docs_dir do
131
+ filename = "#{ref}/index.html"
132
+ content = File.read(filename)
133
+ content.sub!(%r{<h1>shoulda-matchers.+</h1>}, "<h1>shoulda-matchers (#{version})</h1>")
134
+ File.open(filename, 'w') {|f| f.write(content) }
135
+ end
136
+ end
137
+
138
+ def generate_file_that_redirects_to_latest_version(version)
139
+ ref = determine_ref_from(version)
140
+ locals = { ref: ref, github_username: GITHUB_USERNAME }
141
+
142
+ erb = ERB.new(File.read('doc_config/gh-pages/index.html.erb'))
143
+
144
+ within_docs_dir do
145
+ File.open('index.html', 'w') { |f| f.write(erb.result(binding)) }
146
+ system 'git add index.html'
147
+ end
148
+ end
149
+
150
+ def determine_ref_from(version)
151
+ if version =~ /^\d+\.\d+\.\d+/
152
+ 'v' + version
153
+ else
154
+ version
155
+ end
156
+ end
157
+
158
+ def build_commit_message(version)
159
+ "Regenerated docs for version #{version}"
160
+ end
161
+
162
+ def within_gh_pages_dir(&block)
163
+ Dir.chdir(GH_PAGES_DIR, &block)
164
+ end
165
+
166
+ def within_docs_dir(&block)
167
+ Dir.chdir(DOCS_DIR, &block)
168
+ end
169
+ end
170
+ end
171
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shoulda-matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.0.rc2
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tammer Saleh
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2015-01-23 00:00:00.000000000 Z
17
+ date: 2015-01-30 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: activesupport
@@ -287,6 +287,7 @@ files:
287
287
  - spec/warnings_spy/partitioner.rb
288
288
  - spec/warnings_spy/reader.rb
289
289
  - spec/warnings_spy/reporter.rb
290
+ - tasks/documentation.rb
290
291
  homepage: http://thoughtbot.com/community/
291
292
  licenses:
292
293
  - MIT
@@ -302,9 +303,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
302
303
  version: 1.9.2
303
304
  required_rubygems_version: !ruby/object:Gem::Requirement
304
305
  requirements:
305
- - - ">"
306
+ - - ">="
306
307
  - !ruby/object:Gem::Version
307
- version: 1.3.1
308
+ version: '0'
308
309
  requirements: []
309
310
  rubyforge_project:
310
311
  rubygems_version: 2.2.2