summaryrefslogtreecommitdiff
path: root/spec/mspec/spec/runner/filters/profile_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/mspec/spec/runner/filters/profile_spec.rb')
-rw-r--r--spec/mspec/spec/runner/filters/profile_spec.rb70
1 files changed, 35 insertions, 35 deletions
diff --git a/spec/mspec/spec/runner/filters/profile_spec.rb b/spec/mspec/spec/runner/filters/profile_spec.rb
index 89d0ad1911..25f5e07aef 100644
--- a/spec/mspec/spec/runner/filters/profile_spec.rb
+++ b/spec/mspec/spec/runner/filters/profile_spec.rb
@@ -2,45 +2,45 @@ require File.dirname(__FILE__) + '/../../spec_helper'
require 'mspec/runner/mspec'
require 'mspec/runner/filters/profile'
-describe ProfileFilter, "#find" do
+RSpec.describe ProfileFilter, "#find" do
before :each do
@filter = ProfileFilter.new nil
- File.stub(:exist?).and_return(false)
+ allow(File).to receive(:exist?).and_return(false)
@file = "rails.yaml"
end
it "attempts to locate the file through the expanded path name" do
- File.should_receive(:expand_path).with(@file).and_return(@file)
- File.should_receive(:exist?).with(@file).and_return(true)
- @filter.find(@file).should == @file
+ expect(File).to receive(:expand_path).with(@file).and_return(@file)
+ expect(File).to receive(:exist?).with(@file).and_return(true)
+ expect(@filter.find(@file)).to eq(@file)
end
it "attempts to locate the file in 'spec/profiles'" do
path = File.join "spec/profiles", @file
- File.should_receive(:exist?).with(path).and_return(true)
- @filter.find(@file).should == path
+ expect(File).to receive(:exist?).with(path).and_return(true)
+ expect(@filter.find(@file)).to eq(path)
end
it "attempts to locate the file in 'spec'" do
path = File.join "spec", @file
- File.should_receive(:exist?).with(path).and_return(true)
- @filter.find(@file).should == path
+ expect(File).to receive(:exist?).with(path).and_return(true)
+ expect(@filter.find(@file)).to eq(path)
end
it "attempts to locate the file in 'profiles'" do
path = File.join "profiles", @file
- File.should_receive(:exist?).with(path).and_return(true)
- @filter.find(@file).should == path
+ expect(File).to receive(:exist?).with(path).and_return(true)
+ expect(@filter.find(@file)).to eq(path)
end
it "attempts to locate the file in '.'" do
path = File.join ".", @file
- File.should_receive(:exist?).with(path).and_return(true)
- @filter.find(@file).should == path
+ expect(File).to receive(:exist?).with(path).and_return(true)
+ expect(@filter.find(@file)).to eq(path)
end
end
-describe ProfileFilter, "#parse" do
+RSpec.describe ProfileFilter, "#parse" do
before :each do
@filter = ProfileFilter.new nil
@file = File.open(File.dirname(__FILE__) + "/b.yaml", "r")
@@ -51,14 +51,14 @@ describe ProfileFilter, "#parse" do
end
it "creates a Hash of the contents of the YAML file" do
- @filter.parse(@file).should == {
+ expect(@filter.parse(@file)).to eq({
"B." => ["b", "bb"],
"B::C#" => ["b!", "b=", "b?", "-", "[]", "[]="]
- }
+ })
end
end
-describe ProfileFilter, "#load" do
+RSpec.describe ProfileFilter, "#load" do
before :each do
@filter = ProfileFilter.new nil
@files = [
@@ -68,50 +68,50 @@ describe ProfileFilter, "#load" do
end
it "generates a composite hash from multiple YAML files" do
- @filter.load(*@files).should == {
+ expect(@filter.load(*@files)).to eq({
"A#" => ["a", "aa"],
"B." => ["b", "bb"],
"B::C#" => ["b!", "b=", "b?", "-", "[]", "[]="]
- }
+ })
end
end
-describe ProfileFilter, "#===" do
+RSpec.describe ProfileFilter, "#===" do
before :each do
@filter = ProfileFilter.new nil
- @filter.stub(:load).and_return({ "A#" => ["[]=", "a", "a!", "a?", "aa="]})
+ allow(@filter).to receive(:load).and_return({ "A#" => ["[]=", "a", "a!", "a?", "aa="]})
@filter.send :initialize, nil
end
it "returns true if the spec description is for a method in the profile" do
- @filter.===("The A#[]= method").should == true
- @filter.===("A#a returns").should == true
- @filter.===("A#a! replaces").should == true
- @filter.===("A#a? returns").should == true
- @filter.===("A#aa= raises").should == true
+ expect(@filter.===("The A#[]= method")).to eq(true)
+ expect(@filter.===("A#a returns")).to eq(true)
+ expect(@filter.===("A#a! replaces")).to eq(true)
+ expect(@filter.===("A#a? returns")).to eq(true)
+ expect(@filter.===("A#aa= raises")).to eq(true)
end
it "returns false if the spec description is for a method not in the profile" do
- @filter.===("The A#[] method").should == false
- @filter.===("B#a returns").should == false
- @filter.===("A.a! replaces").should == false
- @filter.===("AA#a? returns").should == false
- @filter.===("A#aa raises").should == false
+ expect(@filter.===("The A#[] method")).to eq(false)
+ expect(@filter.===("B#a returns")).to eq(false)
+ expect(@filter.===("A.a! replaces")).to eq(false)
+ expect(@filter.===("AA#a? returns")).to eq(false)
+ expect(@filter.===("A#aa raises")).to eq(false)
end
end
-describe ProfileFilter, "#register" do
+RSpec.describe ProfileFilter, "#register" do
it "registers itself with MSpec for the designated action list" do
filter = ProfileFilter.new :include
- MSpec.should_receive(:register).with(:include, filter)
+ expect(MSpec).to receive(:register).with(:include, filter)
filter.register
end
end
-describe ProfileFilter, "#unregister" do
+RSpec.describe ProfileFilter, "#unregister" do
it "unregisters itself with MSpec for the designated action list" do
filter = ProfileFilter.new :exclude
- MSpec.should_receive(:unregister).with(:exclude, filter)
+ expect(MSpec).to receive(:unregister).with(:exclude, filter)
filter.unregister
end
end