whitelabel 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
1
  --color
2
- --format progress
2
+ --format documentation
@@ -1,4 +1,4 @@
1
- script: "bundle exec rake"
1
+ script: "bundle exec rspec"
2
2
  rvm:
3
3
  - 1.8.7
4
4
  - 1.9.2
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- whitelabel (0.1.0)
4
+ whitelabel (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -37,7 +37,12 @@ module Whitelabel
37
37
  end
38
38
 
39
39
  def [](accessor)
40
+ raise "set a label before calling '#{accessor}'" if self.label.nil?
40
41
  self.label.send :"#{accessor}"
41
42
  end
43
+
44
+ def reset!
45
+ Thread.current[:whitelabel] = nil
46
+ end
42
47
  end
43
48
  end
@@ -1,3 +1,3 @@
1
1
  module Whitelabel
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -3,9 +3,11 @@ require 'spec_helper'
3
3
 
4
4
  describe Whitelabel do
5
5
  let(:path) { fixture_path("whitelabel.yml") }
6
+ let(:dummy) { Dummy.new('some_id', 'some_name') }
6
7
 
7
8
  before(:each) do
8
9
  Whitelabel.labels = []
10
+ Whitelabel.reset!
9
11
  end
10
12
 
11
13
  context "initialization" do
@@ -50,13 +52,27 @@ describe Whitelabel do
50
52
  Whitelabel.label.should eql(label)
51
53
  end
52
54
 
55
+ it "should throw a meaningfull error when no label is set" do
56
+ expect { Whitelabel[:blame] }.to raise_error("set a label before calling 'blame'")
57
+ end
58
+
53
59
  context "with current label" do
54
60
  before(:each) do
55
- Whitelabel.label = Dummy.new('some_id', 'some_name')
61
+ Whitelabel.label = dummy
62
+ end
63
+
64
+ context "resetting" do
65
+ it "should reset the current label" do
66
+ Whitelabel.label.should be(dummy)
67
+ Whitelabel.reset!
68
+ Whitelabel.label.should be_nil
69
+ end
56
70
  end
57
71
 
58
- it "should access a label property via []" do
59
- Whitelabel[:name].should eql('some_name')
72
+ context "accessing values" do
73
+ it "should access a label property via []" do
74
+ Whitelabel[:name].should eql('some_name')
75
+ end
60
76
  end
61
77
  end
62
78
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whitelabel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-07 00:00:00.000000000 Z
12
+ date: 2012-09-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70180733442420 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '2.9'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70180733442420
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '2.9'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: pry
27
- requirement: &70180733441920 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,7 +37,12 @@ dependencies:
32
37
  version: '0.9'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *70180733441920
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '0.9'
36
46
  description: This gem helps you providing whitelabel functionality in your application
37
47
  email:
38
48
  - phoetmail@googlemail.com
@@ -75,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
85
  version: '0'
76
86
  requirements: []
77
87
  rubyforge_project:
78
- rubygems_version: 1.8.17
88
+ rubygems_version: 1.8.24
79
89
  signing_key:
80
90
  specification_version: 3
81
91
  summary: This gem helps you providing whitelabel functionality in your application