sheriff 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.pairs +9 -0
- data/Gemfile +4 -5
- data/Gemfile.lock +6 -0
- data/ROADMAP.md +60 -0
- data/VERSION +1 -1
- data/lib/sheriff.rb +1 -0
- data/lib/sheriff/api.rb +8 -20
- data/lib/sheriff/feature_set.rb +38 -0
- data/lib/sheriff/jurisdiction.rb +16 -0
- data/sheriff.gemspec +82 -0
- data/test/sheriff/test_feature_set.rb +75 -0
- metadata +63 -15
- data/ROADMAP.txt +0 -0
- data/test/test_sheriff.rb +0 -38
data/.pairs
ADDED
data/Gemfile
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
# gem "activesupport", ">= 2.3.5"
|
5
2
|
|
6
|
-
|
7
|
-
|
3
|
+
gem 'cancan', '1.5.1'
|
4
|
+
|
8
5
|
group :development do
|
9
6
|
gem "shoulda", ">= 0"
|
10
7
|
gem "bundler", "~> 1.0.0"
|
11
8
|
gem "jeweler", "~> 1.5.2"
|
12
9
|
gem "rcov", ">= 0"
|
10
|
+
gem 'redgreen', '1.2.2'
|
11
|
+
gem 'test-unit', '2.1.2'
|
13
12
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
cancan (1.5.1)
|
4
5
|
git (1.2.5)
|
5
6
|
jeweler (1.5.2)
|
6
7
|
bundler (~> 1.0.0)
|
@@ -8,13 +9,18 @@ GEM
|
|
8
9
|
rake
|
9
10
|
rake (0.8.7)
|
10
11
|
rcov (0.9.9)
|
12
|
+
redgreen (1.2.2)
|
11
13
|
shoulda (2.11.3)
|
14
|
+
test-unit (2.1.2)
|
12
15
|
|
13
16
|
PLATFORMS
|
14
17
|
ruby
|
15
18
|
|
16
19
|
DEPENDENCIES
|
17
20
|
bundler (~> 1.0.0)
|
21
|
+
cancan (= 1.5.1)
|
18
22
|
jeweler (~> 1.5.2)
|
19
23
|
rcov
|
24
|
+
redgreen (= 1.2.2)
|
20
25
|
shoulda
|
26
|
+
test-unit (= 2.1.2)
|
data/ROADMAP.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
TODOS:
|
2
|
+
=============================
|
3
|
+
|
4
|
+
* Make callstack inspection less brittle by checking ancestry, etc.
|
5
|
+
* MOAR CanCan!!1!
|
6
|
+
* Support for different frameworks (refactor as Rack app?):
|
7
|
+
* Rails
|
8
|
+
* Sinatra
|
9
|
+
|
10
|
+
Ideal End-user API:
|
11
|
+
=============================
|
12
|
+
|
13
|
+
# app/controllers/users_controller.rb
|
14
|
+
|
15
|
+
class UsersController < ApplicationController
|
16
|
+
|
17
|
+
def show
|
18
|
+
if FeatureSet(:feature_name).visible?
|
19
|
+
# do something
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
# app/views/users/show.html.haml
|
26
|
+
|
27
|
+
%h2= User #{username}
|
28
|
+
- if FeatureSet(:user_profile_pic).visible?
|
29
|
+
= render :partial => '_profile_pic'
|
30
|
+
|
31
|
+
# config/initializers/features.rb
|
32
|
+
|
33
|
+
FeatureSet.define :user_profile_pic do |f|
|
34
|
+
f.show do
|
35
|
+
current_user? || (%w{test development}.include? Rails.env)
|
36
|
+
end
|
37
|
+
|
38
|
+
f.show 'users#show'
|
39
|
+
f.show 'users#destroy'
|
40
|
+
f.show 'users#create' do
|
41
|
+
current_user?
|
42
|
+
end
|
43
|
+
|
44
|
+
f.hide 'users#index'
|
45
|
+
f.hide 'users#update'
|
46
|
+
f.hide 'users#create' do
|
47
|
+
if current_user?
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
Jurisdiction Object:
|
52
|
+
=============================
|
53
|
+
|
54
|
+
Sheriff::Jurisdiction.new *args # <= accept any arguments that CanCan will understand
|
55
|
+
Sheriff::Jurisdiction.new UsersController # <= ability to execute any public method on UsersController
|
56
|
+
Sheriff::Jurisdiction.new 'UsersController#show' # <= ability to execute show on the UsersController
|
57
|
+
Sheriff::Jurisdiction.new 'users/show' # <= ability to view route 'users/show'
|
58
|
+
Sheriff::Jurisdiction.new users_path # <= ability to view users_path
|
59
|
+
Sheriff::Jurisdiction.new user_path(1) # <= ability to view path for user with id=1
|
60
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/lib/sheriff.rb
CHANGED
data/lib/sheriff/api.rb
CHANGED
@@ -20,29 +20,17 @@ module Sheriff
|
|
20
20
|
base.extend ClassMethods
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
24
|
-
|
25
|
-
Sheriff.defined_feature_sets << Sheriff::FeatureSet.new(feature_set_name)
|
23
|
+
def FeatureSet(feature_set_name)
|
24
|
+
FeatureSet.find feature_set_name
|
26
25
|
end
|
27
26
|
|
28
|
-
def
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
attr_accessor :visible
|
33
|
-
alias :visible? :visible
|
34
|
-
|
35
|
-
def feature_set
|
36
|
-
Sheriff.defined_feature_sets
|
37
|
-
end
|
27
|
+
def feature_set(feature_set_name)
|
28
|
+
context = self
|
38
29
|
|
39
|
-
|
40
|
-
|
30
|
+
fs = FeatureSet.find(feature_set_name).dup
|
31
|
+
fs.context = context
|
32
|
+
fs
|
41
33
|
end
|
42
34
|
end
|
43
35
|
|
44
|
-
|
45
|
-
class ActionController::Base
|
46
|
-
include Sheriff
|
47
|
-
end
|
48
|
-
end
|
36
|
+
include Sheriff
|
data/lib/sheriff/feature_set.rb
CHANGED
@@ -3,10 +3,48 @@ module Sheriff
|
|
3
3
|
class FeatureSet
|
4
4
|
|
5
5
|
attr_reader :name
|
6
|
+
attr_accessor :context
|
7
|
+
|
6
8
|
def initialize(name)
|
7
9
|
@name = name
|
10
|
+
@jurisdiction = Sheriff::Jurisdiction.new()
|
11
|
+
end
|
12
|
+
|
13
|
+
def hide(*args)
|
14
|
+
@jurisdiction.hide *args
|
15
|
+
end
|
16
|
+
|
17
|
+
def show(*args)
|
18
|
+
@jurisdiction.show *args
|
19
|
+
end
|
20
|
+
|
21
|
+
def visible?
|
22
|
+
caller.first.match /`(.+)'$/
|
23
|
+
context_method = $1
|
24
|
+
@jurisdiction.can? context_method.to_sym, @context
|
8
25
|
end
|
9
26
|
|
27
|
+
def self.define(feature_set_name)
|
28
|
+
if self.defined? feature_set_name
|
29
|
+
raise Sheriff::FeatureSet::AlreadyDefinedError.new("Feature Set #{feature_set_name} already defined")
|
30
|
+
end
|
31
|
+
|
32
|
+
new_feature_set = Sheriff::FeatureSet.new(feature_set_name)
|
33
|
+
Sheriff.defined_feature_sets << new_feature_set
|
34
|
+
yield(new_feature_set) if block_given?
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.defined?(feature_set_name)
|
38
|
+
Sheriff.defined_feature_sets.map(&:name).include?(feature_set_name)
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.find(name)
|
42
|
+
Sheriff.defined_feature_sets.select {|fs| fs.name == name}.first
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.all
|
46
|
+
Sheriff.defined_feature_sets
|
47
|
+
end
|
10
48
|
end
|
11
49
|
|
12
50
|
end
|
data/sheriff.gemspec
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{sheriff}
|
8
|
+
s.version = "0.0.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Anthony Navarre", "Jesse Trimble"]
|
12
|
+
s.date = %q{2011-02-13}
|
13
|
+
s.description = %q{Sheriff allows you to define "FeatureSets" and designate
|
14
|
+
under which contexts the FeatureSet should be visible (eg: a specific view or controller)}
|
15
|
+
s.email = %q{me@anthonynavarre.com}
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"LICENSE.txt",
|
18
|
+
"README.rdoc"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".document",
|
22
|
+
".pairs",
|
23
|
+
"CHANGELOG.txt",
|
24
|
+
"Gemfile",
|
25
|
+
"Gemfile.lock",
|
26
|
+
"LICENSE.txt",
|
27
|
+
"README.rdoc",
|
28
|
+
"ROADMAP.md",
|
29
|
+
"Rakefile",
|
30
|
+
"VERSION",
|
31
|
+
"lib/sheriff.rb",
|
32
|
+
"lib/sheriff/api.rb",
|
33
|
+
"lib/sheriff/context.rb",
|
34
|
+
"lib/sheriff/errors.rb",
|
35
|
+
"lib/sheriff/feature_set.rb",
|
36
|
+
"lib/sheriff/jurisdiction.rb",
|
37
|
+
"sheriff.gemspec",
|
38
|
+
"test/helper.rb",
|
39
|
+
"test/sheriff/test_feature_set.rb"
|
40
|
+
]
|
41
|
+
s.homepage = %q{http://github.com/anthonynavarre/sheriff}
|
42
|
+
s.licenses = ["MIT"]
|
43
|
+
s.require_paths = ["lib"]
|
44
|
+
s.rubygems_version = %q{1.3.7}
|
45
|
+
s.summary = %q{Utility for hiding and showing features based on context}
|
46
|
+
s.test_files = [
|
47
|
+
"test/helper.rb",
|
48
|
+
"test/sheriff/test_feature_set.rb"
|
49
|
+
]
|
50
|
+
|
51
|
+
if s.respond_to? :specification_version then
|
52
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
53
|
+
s.specification_version = 3
|
54
|
+
|
55
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
56
|
+
s.add_runtime_dependency(%q<cancan>, ["= 1.5.1"])
|
57
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
58
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
59
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
60
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
61
|
+
s.add_development_dependency(%q<redgreen>, ["= 1.2.2"])
|
62
|
+
s.add_development_dependency(%q<test-unit>, ["= 2.1.2"])
|
63
|
+
else
|
64
|
+
s.add_dependency(%q<cancan>, ["= 1.5.1"])
|
65
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
66
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
67
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
68
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
69
|
+
s.add_dependency(%q<redgreen>, ["= 1.2.2"])
|
70
|
+
s.add_dependency(%q<test-unit>, ["= 2.1.2"])
|
71
|
+
end
|
72
|
+
else
|
73
|
+
s.add_dependency(%q<cancan>, ["= 1.5.1"])
|
74
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
75
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
76
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
77
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
78
|
+
s.add_dependency(%q<redgreen>, ["= 1.2.2"])
|
79
|
+
s.add_dependency(%q<test-unit>, ["= 2.1.2"])
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class Sheriff::FeatureSetTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
context 'delicious bacon-wrapped context of chocolatey goodness' do
|
6
|
+
|
7
|
+
setup do
|
8
|
+
Sheriff.defined_feature_sets.clear
|
9
|
+
end
|
10
|
+
|
11
|
+
should 'have no defined features' do
|
12
|
+
deny FeatureSet.all.any?
|
13
|
+
end
|
14
|
+
|
15
|
+
should 'be able to define a feature' do
|
16
|
+
FeatureSet.define :share
|
17
|
+
assert FeatureSet.all.map(&:name).include? :share
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'with a defined feature' do
|
21
|
+
setup do
|
22
|
+
FeatureSet.define :share
|
23
|
+
end
|
24
|
+
|
25
|
+
should 'know if a feature is already defined' do
|
26
|
+
assert FeatureSet.defined? :share
|
27
|
+
end
|
28
|
+
|
29
|
+
should 'know if a feature is *not* already defined' do
|
30
|
+
deny FeatureSet.defined? :undefined_feature
|
31
|
+
end
|
32
|
+
|
33
|
+
should 'raise when redefining the same feature' do
|
34
|
+
assert_raise Sheriff::FeatureSet::AlreadyDefinedError do
|
35
|
+
FeatureSet.define :share
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
should 'be able to find a feature' do
|
40
|
+
feature = FeatureSet(:share)
|
41
|
+
assert_equal :share, feature.name
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'when executing within a context' do
|
47
|
+
|
48
|
+
setup do
|
49
|
+
class FakeContext
|
50
|
+
# include Sheriff::ContextInitializer
|
51
|
+
|
52
|
+
def show_method
|
53
|
+
feature_set(:fake_feature).visible?
|
54
|
+
end
|
55
|
+
def hide_method
|
56
|
+
feature_set(:fake_feature).visible?
|
57
|
+
end
|
58
|
+
end
|
59
|
+
FeatureSet.define :fake_feature do |f|
|
60
|
+
f.show :show_method, FakeContext
|
61
|
+
f.hide :hide_method, FakeContext
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
should 'be visible for FakeContext#show' do
|
66
|
+
assert FakeContext.new.show_method
|
67
|
+
end
|
68
|
+
|
69
|
+
should 'be hidden for FakeContext#hide' do
|
70
|
+
deny FakeContext.new.hide_method
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Anthony Navarre
|
@@ -15,12 +15,27 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-13 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
name:
|
22
|
+
name: cancan
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - "="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 1
|
30
|
+
- 5
|
31
|
+
- 1
|
32
|
+
version: 1.5.1
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: shoulda
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
24
39
|
none: false
|
25
40
|
requirements:
|
26
41
|
- - ">="
|
@@ -30,10 +45,10 @@ dependencies:
|
|
30
45
|
version: "0"
|
31
46
|
type: :development
|
32
47
|
prerelease: false
|
33
|
-
version_requirements: *
|
48
|
+
version_requirements: *id002
|
34
49
|
- !ruby/object:Gem::Dependency
|
35
50
|
name: bundler
|
36
|
-
requirement: &
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
37
52
|
none: false
|
38
53
|
requirements:
|
39
54
|
- - ~>
|
@@ -45,10 +60,10 @@ dependencies:
|
|
45
60
|
version: 1.0.0
|
46
61
|
type: :development
|
47
62
|
prerelease: false
|
48
|
-
version_requirements: *
|
63
|
+
version_requirements: *id003
|
49
64
|
- !ruby/object:Gem::Dependency
|
50
65
|
name: jeweler
|
51
|
-
requirement: &
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
67
|
none: false
|
53
68
|
requirements:
|
54
69
|
- - ~>
|
@@ -60,10 +75,10 @@ dependencies:
|
|
60
75
|
version: 1.5.2
|
61
76
|
type: :development
|
62
77
|
prerelease: false
|
63
|
-
version_requirements: *
|
78
|
+
version_requirements: *id004
|
64
79
|
- !ruby/object:Gem::Dependency
|
65
80
|
name: rcov
|
66
|
-
requirement: &
|
81
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
67
82
|
none: false
|
68
83
|
requirements:
|
69
84
|
- - ">="
|
@@ -73,7 +88,37 @@ dependencies:
|
|
73
88
|
version: "0"
|
74
89
|
type: :development
|
75
90
|
prerelease: false
|
76
|
-
version_requirements: *
|
91
|
+
version_requirements: *id005
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: redgreen
|
94
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - "="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
segments:
|
100
|
+
- 1
|
101
|
+
- 2
|
102
|
+
- 2
|
103
|
+
version: 1.2.2
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: *id006
|
107
|
+
- !ruby/object:Gem::Dependency
|
108
|
+
name: test-unit
|
109
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - "="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
segments:
|
115
|
+
- 2
|
116
|
+
- 1
|
117
|
+
- 2
|
118
|
+
version: 2.1.2
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: *id007
|
77
122
|
description: |-
|
78
123
|
Sheriff allows you to define "FeatureSets" and designate
|
79
124
|
under which contexts the FeatureSet should be visible (eg: a specific view or controller)
|
@@ -87,12 +132,13 @@ extra_rdoc_files:
|
|
87
132
|
- README.rdoc
|
88
133
|
files:
|
89
134
|
- .document
|
135
|
+
- .pairs
|
90
136
|
- CHANGELOG.txt
|
91
137
|
- Gemfile
|
92
138
|
- Gemfile.lock
|
93
139
|
- LICENSE.txt
|
94
140
|
- README.rdoc
|
95
|
-
- ROADMAP.
|
141
|
+
- ROADMAP.md
|
96
142
|
- Rakefile
|
97
143
|
- VERSION
|
98
144
|
- lib/sheriff.rb
|
@@ -100,8 +146,10 @@ files:
|
|
100
146
|
- lib/sheriff/context.rb
|
101
147
|
- lib/sheriff/errors.rb
|
102
148
|
- lib/sheriff/feature_set.rb
|
149
|
+
- lib/sheriff/jurisdiction.rb
|
150
|
+
- sheriff.gemspec
|
103
151
|
- test/helper.rb
|
104
|
-
- test/
|
152
|
+
- test/sheriff/test_feature_set.rb
|
105
153
|
has_rdoc: true
|
106
154
|
homepage: http://github.com/anthonynavarre/sheriff
|
107
155
|
licenses:
|
@@ -116,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
116
164
|
requirements:
|
117
165
|
- - ">="
|
118
166
|
- !ruby/object:Gem::Version
|
119
|
-
hash:
|
167
|
+
hash: 2942043483335471323
|
120
168
|
segments:
|
121
169
|
- 0
|
122
170
|
version: "0"
|
@@ -137,4 +185,4 @@ specification_version: 3
|
|
137
185
|
summary: Utility for hiding and showing features based on context
|
138
186
|
test_files:
|
139
187
|
- test/helper.rb
|
140
|
-
- test/
|
188
|
+
- test/sheriff/test_feature_set.rb
|
data/ROADMAP.txt
DELETED
File without changes
|
data/test/test_sheriff.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class SheriffTest < Test::Unit::TestCase
|
4
|
-
|
5
|
-
context 'delicious bacon-wrapped context of chocolatey goodness' do
|
6
|
-
|
7
|
-
setup do
|
8
|
-
Sheriff.defined_feature_sets.clear
|
9
|
-
end
|
10
|
-
|
11
|
-
should 'have no defined features' do
|
12
|
-
deny Sheriff.defined_feature_sets.any?
|
13
|
-
end
|
14
|
-
|
15
|
-
should 'be able to define a feature' do
|
16
|
-
Sheriff.define :share
|
17
|
-
assert Sheriff.defined_feature_sets.map(&:name).include? :share
|
18
|
-
end
|
19
|
-
|
20
|
-
context 'with a defined feature' do
|
21
|
-
setup do
|
22
|
-
Sheriff.define :share
|
23
|
-
end
|
24
|
-
|
25
|
-
should 'raise when redefining the same feature' do
|
26
|
-
assert_raise Sheriff::FeatureSet::AlreadyDefinedError do
|
27
|
-
Sheriff.define :share
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
should 'be able to find a feature set' do
|
32
|
-
assert Sheriff.find(:share),
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|