walruz-rails 0.0.5 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -62,7 +62,7 @@ module Walruz
62
62
  error_message = "There is neither an instance variable @%s nor a instance method %s on the %s instance context" % [subject, subject, controller.class.name]
63
63
  raise ArgumentError.new(error_message)
64
64
  end
65
- params = controller.send(:current_user).authorize!(action, subject_instance)
65
+ params = Walruz::Manager.authorize!(controller.send(:current_user), action, subject_instance)
66
66
  controller.set_policy_params!(params)
67
67
  end
68
68
  end
@@ -107,4 +107,4 @@ module Walruz
107
107
  end
108
108
 
109
109
  end
110
- end
110
+ end
@@ -1,4 +1,5 @@
1
1
  class WalruzPolicyGenerator < Rails::Generator::NamedBase
2
+ default_options :test => 'rspec'
2
3
 
3
4
  def manifest
4
5
  record do |m|
@@ -7,17 +8,17 @@ class WalruzPolicyGenerator < Rails::Generator::NamedBase
7
8
  m.template 'policy.rb', File.join('lib/walruz/policies', class_path, "#{file_name}.rb")
8
9
 
9
10
 
10
- if options[:test]
11
+ case options[:test]
12
+ when 'rspec'
11
13
  # we generate the rSpec stub
12
14
  m.directory 'spec'
13
15
  m.directory 'spec/policies'
14
16
  m.template 'policy_spec.rb', File.join("spec/policies", "#{file_name}_spec.rb")
15
- else
17
+ when 'testunit'
16
18
  m.directory 'test'
17
19
  m.directory 'test/policies'
18
20
  m.template 'policy_test.rb', File.join("test/policies", "#{file_name}_test.rb")
19
21
  end
20
-
21
22
  end
22
23
  end
23
24
 
@@ -26,11 +27,11 @@ class WalruzPolicyGenerator < Rails::Generator::NamedBase
26
27
  def add_options!(opt)
27
28
  opt.separator ''
28
29
  opt.separator 'Options:'
29
- opt.on('--spec', 'Add an rSpec test to the spec folder (DEFAULT)') { |v| options[:spec] = true }
30
- opt.on('--test', 'Add a Test::Unit file to the test folder') { |v| options[:test] = true }
30
+ opt.on('--spec', 'Add a rSpec file to the spec folder') { options[:test] = 'rspec' }
31
+ opt.on('--test', 'Add a Test::Unit file to the test folder') { options[:test] = 'testunit' }
31
32
  end
32
33
 
33
34
  def banner
34
35
  "Usage: #{$0} walruz_policy [--spec|--test]"
35
36
  end
36
- end
37
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: walruz-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Gonzalez
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-13 00:00:00 -07:00
12
+ date: 2009-08-21 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  requirements: []
134
134
 
135
135
  rubyforge_project: walruz-rails
136
- rubygems_version: 1.3.3
136
+ rubygems_version: 1.3.5
137
137
  signing_key:
138
138
  specification_version: 3
139
139
  summary: Gem for easy integration between walruz and the Ruby on Rails framework