mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
few components with rspec3 syntax
This commit is contained in:
@@ -6,33 +6,33 @@ describe Enum do
|
||||
|
||||
describe ".[]" do
|
||||
it "looks up a number by symbol" do
|
||||
enum[:princess_bubblegum].should == 3
|
||||
expect(enum[:princess_bubblegum]).to eq(3)
|
||||
end
|
||||
|
||||
it "looks up a symbol by number" do
|
||||
enum[2].should == :finn
|
||||
expect(enum[2]).to eq(:finn)
|
||||
end
|
||||
end
|
||||
|
||||
describe ".valid?" do
|
||||
it "returns true if a key exists" do
|
||||
enum.valid?(:finn).should == true
|
||||
expect(enum.valid?(:finn)).to eq(true)
|
||||
end
|
||||
|
||||
it "returns false if a key does not exist" do
|
||||
enum.valid?(:obama).should == false
|
||||
expect(enum.valid?(:obama)).to eq(false)
|
||||
end
|
||||
end
|
||||
|
||||
describe ".only" do
|
||||
it "returns only the values we ask for" do
|
||||
enum.only(:jake, :princess_bubblegum).should == { jake: 1, princess_bubblegum: 3 }
|
||||
expect(enum.only(:jake, :princess_bubblegum)).to eq({ jake: 1, princess_bubblegum: 3 })
|
||||
end
|
||||
end
|
||||
|
||||
describe ".except" do
|
||||
it "returns everything but the values we ask to delete" do
|
||||
enum.except(:jake, :princess_bubblegum).should == { finn: 2, peppermint_butler: 4 }
|
||||
expect(enum.except(:jake, :princess_bubblegum)).to eq({ finn: 2, peppermint_butler: 4 })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user