HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/src/ruby-3.0.2/spec/mspec/spec/helpers/fixture_spec.rb
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