Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
gc -am "use rspec 3"
  • Loading branch information
phoet committed Jan 29, 2015
1 parent cce4fda commit da549ca
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 44 deletions.
42 changes: 24 additions & 18 deletions Gemfile.lock
Expand Up @@ -6,27 +6,33 @@ PATH
GEM
remote: https://rubygems.org/
specs:
coderay (1.0.6)
diff-lcs (1.1.3)
method_source (0.7.1)
pry (0.9.8.4)
coderay (~> 1.0.5)
method_source (~> 0.7.1)
slop (>= 2.4.4, < 3)
rspec (2.9.0)
rspec-core (~> 2.9.0)
rspec-expectations (~> 2.9.0)
rspec-mocks (~> 2.9.0)
rspec-core (2.9.0)
rspec-expectations (2.9.1)
diff-lcs (~> 1.1.3)
rspec-mocks (2.9.0)
slop (2.4.4)
coderay (1.1.0)
diff-lcs (1.2.5)
method_source (0.8.2)
pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rake (10.4.2)
rspec (3.1.0)
rspec-core (~> 3.1.0)
rspec-expectations (~> 3.1.0)
rspec-mocks (~> 3.1.0)
rspec-core (3.1.7)
rspec-support (~> 3.1.0)
rspec-expectations (3.1.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.1.0)
rspec-mocks (3.1.3)
rspec-support (~> 3.1.0)
rspec-support (3.1.2)
slop (3.6.0)

PLATFORMS
ruby

DEPENDENCIES
pry (~> 0.9)
rspec (~> 2.9)
pry (~> 0.10)
rake (~> 10.4)
rspec (~> 3.1)
whitelabel!
46 changes: 23 additions & 23 deletions spec/lib/whitelabel_spec.rb
Expand Up @@ -21,45 +21,45 @@
Whitelabel.from_file(path)
end

it "should have two different labels" do
Whitelabel.find_label('test')[:label_id].should eql('test')
Whitelabel.find_label('uschi')[:label_id].should eql('uschi')
Whitelabel.find_label('wrong').should be_nil
it "finds two different labels" do
expect(Whitelabel.find_label('test')[:label_id]).to eql('test')
expect(Whitelabel.find_label('uschi')[:label_id]).to eql('uschi')
expect(Whitelabel.find_label('wrong')).to be_nil
end

it "should work thread safe" do
it "works thread safe" do
Whitelabel.label = :bla
Thread.new { Whitelabel.label = nil }
Whitelabel.label.should_not be_nil
expect(Whitelabel.label).to_not be_nil
end

it "should find a label for a pattern" do
Whitelabel.label_for('uschi').should_not be_nil
Whitelabel.label.name.should eql('Uschi Müller')
it "finds a label for a pattern" do
expect(Whitelabel.label_for('uschi')).to_not be_nil
expect(Whitelabel.label.name).to eql('Uschi Müller')
end

it "should not find a label for a missing pattern" do
Whitelabel.label_for('').should be_nil
it "does not find a label for a missing pattern" do
expect(Whitelabel.label_for('')).to be_nil
end

it "should enable a temporary label" do
it "enables a temporary label" do
label = Whitelabel.label_for('uschi')
Whitelabel.label.should eql(label)
expect(Whitelabel.label).to eql(label)
tmp = Whitelabel.find_label('test')
Whitelabel.with_label(tmp) do
Whitelabel.label.should eql(tmp)
expect(Whitelabel.label).to eql(tmp)
end
Whitelabel.label.should eql(label)
expect(Whitelabel.label).to eql(label)
end

it "should throw a meaningfull error when no label is set" do
it "throws a meaningfull error when no label is set" do
expect { Whitelabel[:blame] }.to raise_error("set a label before calling 'blame'")
end

context "each_label" do
it "should iterate all labels" do
it "iterates all labels" do
names = Whitelabel.each_label { Whitelabel[:name] }
names.should eql(["bla", "Uschi Müller"])
expect(names).to eql(["bla", "Uschi Müller"])
end
end

Expand All @@ -69,16 +69,16 @@
end

context "resetting" do
it "should reset the current label" do
Whitelabel.label.should be(dummy)
it "resets the current label" do
expect(Whitelabel.label).to be(dummy)
Whitelabel.reset!
Whitelabel.label.should be_nil
expect(Whitelabel.label).to be_nil
end
end

context "accessing values" do
it "should access a label property via []" do
Whitelabel[:name].should eql('some_name')
it "accesses a label property via []" do
expect(Whitelabel[:name]).to eql('some_name')
end
end
end
Expand Down
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Expand Up @@ -3,7 +3,6 @@
require "pry"

RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.run_all_when_everything_filtered = true
config.filter_run :focus
end
Expand Down
5 changes: 3 additions & 2 deletions whitelabel.gemspec
Expand Up @@ -14,6 +14,7 @@ Gem::Specification.new do |gem|
gem.require_paths = ["lib"]
gem.version = Whitelabel::VERSION

gem.add_development_dependency('rspec', '~> 2.9')
gem.add_development_dependency('pry', '~> 0.9')
gem.add_development_dependency('rspec', '~> 3.1')
gem.add_development_dependency('pry', '~> 0.10')
gem.add_development_dependency('rake', '~> 10.4')
end

0 comments on commit da549ca

Please sign in to comment.