Sha256: 9372214ec2bfe22dc93851bdfab1cdb5dd17060adba03ee90912e73d630dd901

Contents?: true

Size: 1.55 KB

Versions: 6

Compression:

Stored size: 1.55 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")

require 'shenandoah/rails/locator'

describe Shenandoah::Rails::Locator do
  include Shenandoah::Spec::Tmpfile
  
  before do
    RAILS_ROOT = tmpdir('rails-root')
  end
  
  after do
    Object.instance_eval { remove_const :RAILS_ROOT }
  end
  
  def loc(*args)
    Shenandoah::Rails::Locator.new(*args)
  end
  
  describe "#main_path" do
    it "uses public/javascripts by default" do
      loc.main_path.should == "#{tmpdir}/rails-root/public/javascripts"
    end
    
    it "accepts an override relative to root" do
      loc(:main_path => "app/javascript").main_path.
        should == "#{tmpdir}/rails-root/app/javascript"
    end
  end
  
  describe "#spec_path" do
    it "uses test/javascript for spec by default" do
      loc.spec_path.should == "#{tmpdir}/rails-root/test/javascript"
    end

    it "uses spec/javascript for spec if spec/ already exists" do
      tmpdir('rails-root/spec')
      loc.spec_path.should == "#{tmpdir}/rails-root/spec/javascript"
    end

    it "uses examples/javascript for spec if examples/ already exists" do
      tmpdir('rails-root/examples')
      loc.spec_path.should == "#{tmpdir}/rails-root/examples/javascript"
    end
    
    it "accepts an override relative to root" do
      loc(:spec_path => "features/javascript").spec_path.
        should == "#{tmpdir}/rails-root/features/javascript"
    end
  end
  
  describe "#tmp_path" do
    it "uses the rails tmp directory" do
      loc.tmp_path.should == "#{tmpdir}/rails-root/tmp/shenandoah"
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
rsutphin-shenandoah-0.1.0 spec/shenandoah/rails/locator_spec.rb
rsutphin-shenandoah-0.1.1 spec/shenandoah/rails/locator_spec.rb
rsutphin-shenandoah-0.1.2 spec/shenandoah/rails/locator_spec.rb
shenandoah-0.1.0 spec/shenandoah/rails/locator_spec.rb
shenandoah-0.1.1 spec/shenandoah/rails/locator_spec.rb
shenandoah-0.1.2 spec/shenandoah/rails/locator_spec.rb