rails_best_practices 1.13.0 → 1.13.1

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc CHANGED
@@ -1,2 +1,2 @@
1
1
  rvm_gemset_create_on_use_flag=1
2
- rvm gemset use ruby-1.9.3@rails_best_practices
2
+ rvm gemset use rails_best_practices
@@ -15,11 +15,11 @@ module RailsBestPractices
15
15
  # Check all "save" calls to check the return value is used by a node we have visited.
16
16
  class CheckSaveReturnValueReview < Review
17
17
  include Classable
18
- interesting_nodes :call, :command_call, :method_add_arg, :if, :ifop, :unless, :assign, :binary
18
+ interesting_nodes :call, :command_call, :method_add_arg, :if, :ifop, :elsif, :unless, :assign, :binary
19
19
  interesting_files ALL_FILES
20
20
  url "http://rails-bestpractices.com/posts/703-check-the-return-value-of-save-otherwise-use-save"
21
21
 
22
- add_callback :start_if, :start_ifop, :start_unless do |node|
22
+ add_callback :start_if, :start_ifop, :start_elsif, :start_unless do |node|
23
23
  @used_return_value_of = node.conditional_statement.all_conditions
24
24
  end
25
25
 
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module RailsBestPractices
3
- VERSION = "1.13.0"
3
+ VERSION = "1.13.1"
4
4
  end
@@ -50,6 +50,25 @@ module RailsBestPractices
50
50
  runner.should have(0).errors
51
51
  end
52
52
 
53
+ it "should allow save return value used in elsif" do
54
+ content =<<-EOF
55
+ def my_method
56
+ post = Posts.new do |p|
57
+ p.title = "foo"
58
+ end
59
+ if current_user
60
+ "YES"
61
+ elsif post.save
62
+ "OK"
63
+ else
64
+ raise "could not save"
65
+ end
66
+ end
67
+ EOF
68
+ runner.review('app/helpers/posts_helper.rb', content)
69
+ runner.should have(0).errors
70
+ end
71
+
53
72
  it "should allow save return value used in unless" do
54
73
  content =<<-EOF
55
74
  def my_method
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_best_practices
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.13.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-23 00:00:00.000000000 Z
12
+ date: 2012-12-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: code_analyzer
@@ -386,7 +386,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
386
386
  version: '0'
387
387
  segments:
388
388
  - 0
389
- hash: 2112599322304454342
389
+ hash: 4362184298328338159
390
390
  required_rubygems_version: !ruby/object:Gem::Requirement
391
391
  none: false
392
392
  requirements: