diff options
| author | Xinhui | 2016-11-09 14:45:18 +0100 | 
|---|---|---|
| committer | Xinhui | 2016-11-09 14:45:18 +0100 | 
| commit | 0dbc80d54b1362c9eb0fc87d8d93f3d60ade68e1 (patch) | |
| tree | f66528f9e25781033b963cdeb2b418a07f3f9d90 /lib/stif | |
| parent | 2ca92317d4dc06992e93b39202fbc3231c8cac4d (diff) | |
| download | chouette-core-0dbc80d54b1362c9eb0fc87d8d93f3d60ade68e1.tar.bz2 | |
Rspec workbench MyWorkbenchScopes
Refs #1787
Diffstat (limited to 'lib/stif')
| -rw-r--r-- | lib/stif/my_workbench_scopes.rb | 32 | 
1 files changed, 17 insertions, 15 deletions
diff --git a/lib/stif/my_workbench_scopes.rb b/lib/stif/my_workbench_scopes.rb index 7e4500a7d..89c4e659c 100644 --- a/lib/stif/my_workbench_scopes.rb +++ b/lib/stif/my_workbench_scopes.rb @@ -1,21 +1,23 @@ -class Stif::MyWorkbenchScopes -  attr_accessor :workbench +module Stif +  class MyWorkbenchScopes +    attr_accessor :workbench -  def initialize(workbench) -    @workbench = workbench -  end +    def initialize(workbench) +      @workbench = workbench +    end -  def line_scope(initial_scope) -    ids = self.parse_functional_scope -    ids ? initial_scope.where(objectid: ids) : initial_scope -  end +    def line_scope(initial_scope) +      ids = self.parse_functional_scope +      ids ? initial_scope.where(objectid: ids) : initial_scope +    end -  def parse_functional_scope -    return false unless @workbench.organisation.sso_attributes -    begin -      JSON.parse @workbench.organisation.sso_attributes['functional_scope'] -    rescue Exception => e -      Rails.logger.error "MyWorkbenchScopes : #{e}" +    def parse_functional_scope +      return false unless @workbench.organisation.sso_attributes +      begin +        JSON.parse @workbench.organisation.sso_attributes['functional_scope'] +      rescue Exception => e +        Rails.logger.error "MyWorkbenchScopes : #{e}" +      end      end    end  end  | 
