summaryrefslogtreecommitdiff
path: root/spec/mspec/spec/helpers/fixture_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/mspec/spec/helpers/fixture_spec.rb')
-rw-r--r--spec/mspec/spec/helpers/fixture_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/mspec/spec/helpers/fixture_spec.rb b/spec/mspec/spec/helpers/fixture_spec.rb
new file mode 100644
index 0000000000..4dbdd092f1
--- /dev/null
+++ b/spec/mspec/spec/helpers/fixture_spec.rb
@@ -0,0 +1,25 @@
+require 'spec_helper'
+require 'mspec/guards'
+require 'mspec/helpers'
+
+describe Object, "#fixture" do
+ before :each do
+ @dir = File.realpath("..", __FILE__)
+ end
+
+ it "returns the expanded path to a fixture file" do
+ name = fixture(__FILE__, "subdir", "file.txt")
+ name.should == "#{@dir}/fixtures/subdir/file.txt"
+ end
+
+ it "omits '/shared' if it is the suffix of the directory string" do
+ name = fixture("#{@dir}/shared/file.rb", "subdir", "file.txt")
+ name.should == "#{@dir}/fixtures/subdir/file.txt"
+ end
+
+ it "does not append '/fixtures' if it is the suffix of the directory string" do
+ commands_dir = "#{File.dirname(@dir)}/commands"
+ name = fixture("#{commands_dir}/fixtures/file.rb", "subdir", "file.txt")
+ name.should == "#{commands_dir}/fixtures/subdir/file.txt"
+ end
+end