Skip to content

Commit

Permalink
Fix rspec deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonblalock committed Apr 23, 2015
1 parent 92f6284 commit 1da6413
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 27 deletions.
1 change: 1 addition & 0 deletions flip.gemspec
Expand Up @@ -22,5 +22,6 @@ Gem::Specification.new do |s|
s.add_dependency("i18n")

s.add_development_dependency("rspec", "~> 2.5")
s.add_development_dependency("rspec-its")
s.add_development_dependency("rake")
end
2 changes: 1 addition & 1 deletion lib/flip/version.rb
@@ -1,3 +1,3 @@
module Flip
VERSION = "1.0.1"
VERSION = "1.0.2"
end
22 changes: 11 additions & 11 deletions spec/cookie_strategy_spec.rb
Expand Up @@ -26,47 +26,47 @@ def cookies; []; end
describe "cookie interrogration" do
context "enabled feature" do
specify "#knows? is true" do
strategy.knows?(:one).should be_true
strategy.knows?(:one).should be true
end
specify "#on? is true" do
strategy.on?(:one).should be_true
strategy.on?(:one).should be true
end
end
context "disabled feature" do
specify "#knows? is true" do
strategy.knows?(:two).should be_true
strategy.knows?(:two).should be true
end
specify "#on? is false" do
strategy.on?(:two).should be_false
strategy.on?(:two).should be false
end
end
context "feature with no cookie present" do
specify "#knows? is false" do
strategy.knows?(:three).should be_false
strategy.knows?(:three).should be false
end
specify "#on? is false" do
strategy.on?(:three).should be_false
strategy.on?(:three).should be false
end
end
end

describe "cookie manipulation" do
it "can switch known features on" do
strategy.switch! :one, true
strategy.on?(:one).should be_true
strategy.on?(:one).should be true
end
it "can switch unknown features on" do
strategy.switch! :three, true
strategy.on?(:three).should be_true
strategy.on?(:three).should be true
end
it "can switch features off" do
strategy.switch! :two, false
strategy.on?(:two).should be_false
strategy.on?(:two).should be false
end
it "can delete knowledge of a feature" do
strategy.delete! :one
strategy.on?(:one).should be_false
strategy.knows?(:one).should be_false
strategy.on?(:one).should be false
strategy.knows?(:one).should be false
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/database_strategy_spec.rb
Expand Up @@ -17,7 +17,7 @@

subject { strategy }

its(:switchable?) { should be_true }
its(:switchable?) { should be true }
its(:description) { should be_present }

let(:db_result) { [] }
Expand Down
8 changes: 4 additions & 4 deletions spec/declaration_strategy_spec.rb
Expand Up @@ -8,16 +8,16 @@ def definition(default)

describe "#knows?" do
it "does not know definition with no default specified" do
subject.knows?(Flip::Definition.new :feature).should be_false
subject.knows?(Flip::Definition.new :feature).should be false
end
it "does not know definition with default of nil" do
subject.knows?(definition(nil)).should be_false
subject.knows?(definition(nil)).should be false
end
it "knows definition with default set to true" do
subject.knows?(definition(true)).should be_true
subject.knows?(definition(true)).should be true
end
it "knows definition with default set to false" do
subject.knows?(definition(false)).should be_true
subject.knows?(definition(false)).should be true
end
end

Expand Down
10 changes: 5 additions & 5 deletions spec/feature_set_spec.rb
Expand Up @@ -41,26 +41,26 @@ def on?(d); true; end
describe "#default= and #on? with null strategy" do
subject { feature_set_with_null_strategy }
it "defaults to false" do
subject.on?(:feature).should be_false
subject.on?(:feature).should be false
end
it "can default to true" do
subject.default = true
subject.on?(:feature).should be_true
subject.on?(:feature).should be true
end
it "accepts a proc returning true" do
subject.default = proc { true }
subject.on?(:feature).should be_true
subject.on?(:feature).should be true
end
it "accepts a proc returning false" do
subject.default = proc { false }
subject.on?(:feature).should be_false
subject.on?(:feature).should be false
end
end

describe "feature set with null strategy then always-true strategy" do
subject { feature_set_with_null_then_true_strategies }
it "returns true due to second strategy" do
subject.on?(:feature).should be_true
subject.on?(:feature).should be true
end
end

Expand Down
8 changes: 4 additions & 4 deletions spec/flip_spec.rb
Expand Up @@ -18,16 +18,16 @@

describe ".on?" do
it "returns true for enabled features" do
Flip.on?(:one).should be_true
Flip.on?(:one).should be true
end
it "returns false for disabled features" do
Flip.on?(:two).should be_false
Flip.on?(:two).should be false
end
end

describe "dynamic predicate methods" do
its(:one?) { should be_true }
its(:two?) { should be_false }
its(:one?) { should be true }
its(:two?) { should be false }
end

end
3 changes: 2 additions & 1 deletion spec/spec_helper.rb
@@ -1 +1,2 @@
require "flip"
require 'flip'
require 'rspec/its'

0 comments on commit 1da6413

Please sign in to comment.