ubiquitous_user 0.4.0 → 0.4.1

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/Rakefile CHANGED
@@ -57,40 +57,3 @@ Rake::RDocTask.new do |rdoc|
57
57
  rdoc.rdoc_files.include('LICENSE')
58
58
  rdoc.rdoc_files.include('lib/**/*.rb')
59
59
  end
60
-
61
- begin
62
- require 'metric_fu'
63
- MetricFu::Configuration.run do |config|
64
- #define which metrics you want to use
65
- # config.metrics = [:churn, :saikuro, :stats, :flog, :flay, :reek, :roodi, :rcov]
66
- config.metrics = [:rcov]
67
- # config.graphs = [:flog, :flay, :reek, :roodi, :rcov]
68
- config.graphs = [:rcov]
69
-
70
- # config.flay = { :dirs_to_flay => ['app', 'lib'] }
71
- # config.flog = { :dirs_to_flog => ['app', 'lib'] }
72
- # config.reek = { :dirs_to_reek => ['app', 'lib'] }
73
- # config.roodi = { :dirs_to_roodi => ['app', 'lib'] }
74
- # config.saikuro = { :output_directory => 'scratch_directory/saikuro',
75
- # :input_directory => ['app', 'lib'],
76
- # :cyclo => "",
77
- # :filter_cyclo => "0",
78
- # :warn_cyclo => "5",
79
- # :error_cyclo => "7",
80
- # :formater => "text"} #this needs to be set to "text"
81
- # config.churn = { :start_date => "1 year ago", :minimum_churn_count => 10}
82
- config.rcov = { :test_files => ['test/**/test_*.rb'],
83
- :rcov_opts => ["--text-report"
84
- #"--sort coverage",
85
- #"--no-html",
86
- # "--text-coverage",
87
- # "--no-color",
88
- # "--profile",
89
- # "--rails",
90
- # "--exclude /gems/,/Library/,spec"
91
- ]
92
- }
93
- end
94
- rescue LoadError
95
- puts "Metric fu not available"
96
- end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
@@ -39,10 +39,12 @@ module UsableHelpers
39
39
 
40
40
  # If the object is new, let's get ready to mark the user as logged in when saving.
41
41
  if @ubiquitous_user.new_record? or @ubiquitous_user.id != session[:user_id]
42
- @ubiquitous_user.instance_variable_set :@ubiquitous_user_controller, self
43
- # TODO: save a previous after_save and call it.
44
- def @ubiquitous_user.after_save
45
- @ubiquitous_user_controller.session[:user_id] = self.id
42
+ controller = self
43
+ # Read more about this technique on http://stackoverflow.com/questions/2495550/define-a-method-that-is-a-closure-in-ruby
44
+ klass = class << @ubiquitous_user; self; end
45
+ klass.send(:define_method, :after_save) do
46
+ super
47
+ controller.session[:user_id] = self.id
46
48
  end
47
49
  end
48
50
 
@@ -50,6 +50,7 @@ class TestUbiquitousUser < Test::Unit::TestCase
50
50
  @user.expects(:new_record?).returns(true)
51
51
  @user.expects(:save!)
52
52
  @user.expects(:id).returns(user_id)
53
+ @user.expects(:after_save)
53
54
 
54
55
  user = @controller.user
55
56
  user.save!
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 0
9
- version: 0.4.0
8
+ - 1
9
+ version: 0.4.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - "J. Pablo Fern\xC3\xA1ndez"
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-22 00:00:00 +01:00
17
+ date: 2010-03-23 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency