whitelabel 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 558aca5d0964d9a442e15e4a19631ea087fefcdf
4
+ data.tar.gz: 1d564809f2bbab30e5db725f02ed1471658a8db3
5
+ SHA512:
6
+ metadata.gz: 98640bee5706135bd032cb3825b6d0728356357e006f4e03198f4127f89636ca345240dd7512b96fc26e278576738e8792829e0cf1d0d4f3805630092ec2caa3
7
+ data.tar.gz: 2485b18754f36456dbce445619ec61a7154e7a0dd726d1db5f45d8d21cdf8cff5b6f273b989915174580e694cd70a4772baa0b4968fd685411631212400593f1
@@ -0,0 +1 @@
1
+ 2.2.0
@@ -1,10 +1,7 @@
1
1
  script: "bundle exec rspec"
2
2
  rvm:
3
- - 1.8.7
4
- - 1.9.2
5
3
  - 1.9.3
4
+ - 2.2.0
6
5
  - rbx
7
- - rbx-2.0
8
- - ree
9
6
  - ruby-head
10
7
  - jruby
@@ -6,27 +6,33 @@ PATH
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- coderay (1.0.6)
10
- diff-lcs (1.1.3)
11
- method_source (0.7.1)
12
- pry (0.9.8.4)
13
- coderay (~> 1.0.5)
14
- method_source (~> 0.7.1)
15
- slop (>= 2.4.4, < 3)
16
- rspec (2.9.0)
17
- rspec-core (~> 2.9.0)
18
- rspec-expectations (~> 2.9.0)
19
- rspec-mocks (~> 2.9.0)
20
- rspec-core (2.9.0)
21
- rspec-expectations (2.9.1)
22
- diff-lcs (~> 1.1.3)
23
- rspec-mocks (2.9.0)
24
- slop (2.4.4)
9
+ coderay (1.1.0)
10
+ diff-lcs (1.2.5)
11
+ method_source (0.8.2)
12
+ pry (0.10.1)
13
+ coderay (~> 1.1.0)
14
+ method_source (~> 0.8.1)
15
+ slop (~> 3.4)
16
+ rake (10.4.2)
17
+ rspec (3.1.0)
18
+ rspec-core (~> 3.1.0)
19
+ rspec-expectations (~> 3.1.0)
20
+ rspec-mocks (~> 3.1.0)
21
+ rspec-core (3.1.7)
22
+ rspec-support (~> 3.1.0)
23
+ rspec-expectations (3.1.2)
24
+ diff-lcs (>= 1.2.0, < 2.0)
25
+ rspec-support (~> 3.1.0)
26
+ rspec-mocks (3.1.3)
27
+ rspec-support (~> 3.1.0)
28
+ rspec-support (3.1.2)
29
+ slop (3.6.0)
25
30
 
26
31
  PLATFORMS
27
32
  ruby
28
33
 
29
34
  DEPENDENCIES
30
- pry (~> 0.9)
31
- rspec (~> 2.9)
35
+ pry (~> 0.10)
36
+ rake (~> 10.4)
37
+ rspec (~> 3.1)
32
38
  whitelabel!
data/README.md CHANGED
@@ -41,7 +41,7 @@ Whitelabel works the same way I18n does, just set it up in your ApplicationContr
41
41
 
42
42
  def switch_label
43
43
  unless Whitelabel.label_for(request.subdomains.first)
44
- redirect_to(labels_url(subdomain: false), alert: "Please select a Label!") and return
44
+ redirect_to(labels_url(subdomain: false), alert: "Please select a Label!")
45
45
  end
46
46
  end
47
47
 
@@ -36,6 +36,10 @@ module Whitelabel
36
36
  self.label = current_label if current_label
37
37
  end
38
38
 
39
+ def each_label(&block)
40
+ labels.map { |label| with_label(label, &block) }
41
+ end
42
+
39
43
  def [](accessor)
40
44
  raise "set a label before calling '#{accessor}'" if self.label.nil?
41
45
  self.label.send :"#{accessor}"
@@ -1,3 +1,3 @@
1
1
  module Whitelabel
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -21,57 +21,64 @@ describe Whitelabel do
21
21
  Whitelabel.from_file(path)
22
22
  end
23
23
 
24
- it "should have two different labels" do
25
- Whitelabel.find_label('test')[:label_id].should eql('test')
26
- Whitelabel.find_label('uschi')[:label_id].should eql('uschi')
27
- Whitelabel.find_label('wrong').should be_nil
24
+ it "finds two different labels" do
25
+ expect(Whitelabel.find_label('test')[:label_id]).to eql('test')
26
+ expect(Whitelabel.find_label('uschi')[:label_id]).to eql('uschi')
27
+ expect(Whitelabel.find_label('wrong')).to be_nil
28
28
  end
29
29
 
30
- it "should work thread safe" do
30
+ it "works thread safe" do
31
31
  Whitelabel.label = :bla
32
32
  Thread.new { Whitelabel.label = nil }
33
- Whitelabel.label.should_not be_nil
33
+ expect(Whitelabel.label).to_not be_nil
34
34
  end
35
35
 
36
- it "should find a label for a pattern" do
37
- Whitelabel.label_for('uschi').should_not be_nil
38
- Whitelabel.label.name.should eql('Uschi Müller')
36
+ it "finds a label for a pattern" do
37
+ expect(Whitelabel.label_for('uschi')).to_not be_nil
38
+ expect(Whitelabel.label.name).to eql('Uschi Müller')
39
39
  end
40
40
 
41
- it "should not find a label for a missing pattern" do
42
- Whitelabel.label_for('').should be_nil
41
+ it "does not find a label for a missing pattern" do
42
+ expect(Whitelabel.label_for('')).to be_nil
43
43
  end
44
44
 
45
- it "should enable a temporary label" do
45
+ it "enables a temporary label" do
46
46
  label = Whitelabel.label_for('uschi')
47
- Whitelabel.label.should eql(label)
47
+ expect(Whitelabel.label).to eql(label)
48
48
  tmp = Whitelabel.find_label('test')
49
49
  Whitelabel.with_label(tmp) do
50
- Whitelabel.label.should eql(tmp)
50
+ expect(Whitelabel.label).to eql(tmp)
51
51
  end
52
- Whitelabel.label.should eql(label)
52
+ expect(Whitelabel.label).to eql(label)
53
53
  end
54
54
 
55
- it "should throw a meaningfull error when no label is set" do
55
+ it "throws a meaningfull error when no label is set" do
56
56
  expect { Whitelabel[:blame] }.to raise_error("set a label before calling 'blame'")
57
57
  end
58
58
 
59
+ context "each_label" do
60
+ it "iterates all labels" do
61
+ names = Whitelabel.each_label { Whitelabel[:name] }
62
+ expect(names).to eql(["bla", "Uschi Müller"])
63
+ end
64
+ end
65
+
59
66
  context "with current label" do
60
67
  before(:each) do
61
68
  Whitelabel.label = dummy
62
69
  end
63
70
 
64
71
  context "resetting" do
65
- it "should reset the current label" do
66
- Whitelabel.label.should be(dummy)
72
+ it "resets the current label" do
73
+ expect(Whitelabel.label).to be(dummy)
67
74
  Whitelabel.reset!
68
- Whitelabel.label.should be_nil
75
+ expect(Whitelabel.label).to be_nil
69
76
  end
70
77
  end
71
78
 
72
79
  context "accessing values" do
73
- it "should access a label property via []" do
74
- Whitelabel[:name].should eql('some_name')
80
+ it "accesses a label property via []" do
81
+ expect(Whitelabel[:name]).to eql('some_name')
75
82
  end
76
83
  end
77
84
  end
@@ -3,7 +3,6 @@ require "whitelabel"
3
3
  require "pry"
4
4
 
5
5
  RSpec.configure do |config|
6
- config.treat_symbols_as_metadata_keys_with_true_values = true
7
6
  config.run_all_when_everything_filtered = true
8
7
  config.filter_run :focus
9
8
  end
@@ -2,7 +2,7 @@
2
2
  require File.expand_path('../lib/whitelabel/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
- gem.authors = ["Peter Schröder"]
5
+ gem.authors = ["Peter Schröder"]
6
6
  gem.email = ["phoetmail@googlemail.com"]
7
7
  gem.description = gem.summary = %q{This gem helps you providing whitelabel functionality in your application}
8
8
  gem.homepage = "https://github.com/phoet/whitelabel"
@@ -14,6 +14,7 @@ Gem::Specification.new do |gem|
14
14
  gem.require_paths = ["lib"]
15
15
  gem.version = Whitelabel::VERSION
16
16
 
17
- gem.add_development_dependency('rspec', '~> 2.9')
18
- gem.add_development_dependency('pry', '~> 0.9')
17
+ gem.add_development_dependency('rspec', '~> 3.1')
18
+ gem.add_development_dependency('pry', '~> 0.10')
19
+ gem.add_development_dependency('rake', '~> 10.4')
19
20
  end
metadata CHANGED
@@ -1,48 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whitelabel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
5
- prerelease:
4
+ version: 0.3.0
6
5
  platform: ruby
7
6
  authors:
8
- - Peter Schröder
7
+ - Peter Schröder
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-09-23 00:00:00.000000000 Z
11
+ date: 2015-01-29 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: '2.9'
19
+ version: '3.1'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '2.9'
26
+ version: '3.1'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: pry
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
- version: '0.9'
33
+ version: '0.10'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
- version: '0.9'
40
+ version: '0.10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.4'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.4'
46
55
  description: This gem helps you providing whitelabel functionality in your application
47
56
  email:
48
57
  - phoetmail@googlemail.com
@@ -50,11 +59,11 @@ executables: []
50
59
  extensions: []
51
60
  extra_rdoc_files: []
52
61
  files:
53
- - .document
54
- - .gitignore
55
- - .rspec
56
- - .rvmrc
57
- - .travis.yml
62
+ - ".document"
63
+ - ".gitignore"
64
+ - ".rspec"
65
+ - ".ruby-version"
66
+ - ".travis.yml"
58
67
  - Gemfile
59
68
  - Gemfile.lock
60
69
  - README.md
@@ -67,27 +76,26 @@ files:
67
76
  - whitelabel.gemspec
68
77
  homepage: https://github.com/phoet/whitelabel
69
78
  licenses: []
79
+ metadata: {}
70
80
  post_install_message:
71
81
  rdoc_options: []
72
82
  require_paths:
73
83
  - lib
74
84
  required_ruby_version: !ruby/object:Gem::Requirement
75
- none: false
76
85
  requirements:
77
- - - ! '>='
86
+ - - ">="
78
87
  - !ruby/object:Gem::Version
79
88
  version: '0'
80
89
  required_rubygems_version: !ruby/object:Gem::Requirement
81
- none: false
82
90
  requirements:
83
- - - ! '>='
91
+ - - ">="
84
92
  - !ruby/object:Gem::Version
85
93
  version: '0'
86
94
  requirements: []
87
95
  rubyforge_project:
88
- rubygems_version: 1.8.24
96
+ rubygems_version: 2.4.5
89
97
  signing_key:
90
- specification_version: 3
98
+ specification_version: 4
91
99
  summary: This gem helps you providing whitelabel functionality in your application
92
100
  test_files:
93
101
  - spec/fixtures/whitelabel.yml
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use 1.9.3@whitelabel --create