Sha256: 174949dc72278a56eea4f153d41f61cea604e51ea2e7e08f82047e1deec36424

Contents?: true

Size: 1.36 KB

Versions: 5

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'


require 'generator_spec/test_case'
require 'generators/on_the_spot/install/install_generator'

require 'rspec/mocks'

describe OnTheSpot::Generators::InstallGenerator do
  include GeneratorSpec::TestCase

  destination File.expand_path("../../tmp", __FILE__)


  context "in rails 3.0" do
    context "with no arguments" do
      before(:each) do
        Rails.stub(:version) { '3.0.8' }
        prepare_destination
        run_generator
      end

      it "stubs the version correctly" do
        Rails.version[0..2].should == "3.0"
      end

      it "stubs the version correctly" do
        test_version = (Rails.version[0..2].to_f >= 3.1)
        test_version.should be_false
      end

      ['on_the_spot.js', 'jquery.jeditable.mini.js', 'jquery.jeditable.checkbox.js'].each do |js_file|
        it "copies #{js_file} to the correct folder" do
          assert_file "public/javascripts/#{js_file}"
        end
      end
    end
  end

  context "in rails 3.1" do
    context "with no arguments" do
      before(:each) do
        Rails.stub(:version) { '3.1.0' }
        prepare_destination
        run_generator
      end

      ['on_the_spot.js', 'jquery.jeditable.mini.js', 'jquery.jeditable.checkbox.js'].each do |js_file|
        it "does not copy #{js_file}" do
          assert_no_file "public/javascripts/#{js_file}"
        end
      end
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
on_the_spot-1.0.1 spec/generators/install_generator_spec.rb
on_the_spot-1.0.0 spec/generators/install_generator_spec.rb
on_the_spot-0.0.18 spec/generators/install_generator_spec.rb
on_the_spot-0.0.17 spec/generators/install_generator_spec.rb
on_the_spot-0.0.16 spec/generators/install_generator_spec.rb