eployday 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,8 @@
1
1
  module Eployday
2
2
  module PermissionChecker
3
3
  class << self
4
- def allowed?(nick, list=load_whitelist)
5
- list.include?(nick)
4
+ def allowed?(user, list=load_whitelist)
5
+ list.include?(user.nick) and user.authed?
6
6
  end
7
7
 
8
8
  def load_whitelist
@@ -1,3 +1,3 @@
1
1
  module Eployday
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -3,14 +3,23 @@ require 'eployday/permission_checker'
3
3
  describe Eployday::PermissionChecker do
4
4
  it "loads the whitelist" do
5
5
  Eployday::PermissionChecker.should_receive(:load_whitelist).and_return([])
6
- Eployday::PermissionChecker.allowed?("steveklabnik")
6
+ Eployday::PermissionChecker.allowed?(stub.as_null_object)
7
7
  end
8
8
 
9
9
  it "allows people on the list" do
10
- Eployday::PermissionChecker.allowed?("imgood", ["imgood"]).should be_true
10
+ user = stub(:nick => "imgood", :authed? => true)
11
+ Eployday::PermissionChecker.allowed?(user, ["imgood"]).should be_true
11
12
  end
12
13
 
13
14
  it "disallows people not on the list" do
14
- Eployday::PermissionChecker.allowed?("imnot", []).should_not be_true
15
+ Eployday::PermissionChecker.allowed?(stub(:nick => "imnot"), []).should_not be_true
16
+ end
17
+
18
+ it "ensures that the nick is registered" do
19
+ authed_user = stub(:nick => "nick", :authed? => true)
20
+ unauthed_user = stub(:nick => "nick", :authed? => false)
21
+ whitelist = ["nick"]
22
+ Eployday::PermissionChecker.allowed?( authed_user, whitelist).should be_true
23
+ Eployday::PermissionChecker.allowed?(unauthed_user, whitelist).should_not be_true
15
24
  end
16
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eployday
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-09-16 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &2157647800 !ruby/object:Gem::Requirement
16
+ requirement: &2153705460 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2157647800
24
+ version_requirements: *2153705460
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: cinch
27
- requirement: &2157647380 !ruby/object:Gem::Requirement
27
+ requirement: &2153705040 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2157647380
35
+ version_requirements: *2153705040
36
36
  description: An IRC bot that allows whitelisted users to deploy your code to production.
37
37
  email:
38
38
  - steve@steveklabnik.com
@@ -47,7 +47,6 @@ files:
47
47
  - Rakefile
48
48
  - bin/eployday
49
49
  - eployday.gemspec
50
- - lib/eployday.rb
51
50
  - lib/eployday/cli.rb
52
51
  - lib/eployday/deploy.rb
53
52
  - lib/eployday/permission_checker.rb
data/lib/eployday.rb DELETED
@@ -1,5 +0,0 @@
1
- require "eployday/version"
2
-
3
- module Eployday
4
- # Your code goes here...
5
- end