Sha256: fa3daafaf048940782188658f989e914fc1422fec8dad0bc3af1e1130f8fcfc6

Contents?: true

Size: 1.15 KB

Versions: 19

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'
require 'rspec/mocks'
require 'rspec/rails/mocks'

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

describe Cocoon::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

      it "copies cocoon.js to the correct folder" do
        assert_file "public/javascripts/cocoon.js"
      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

      it "does not copy cocoon.js" do
        assert_no_file "public/javascripts/cocoon.js"
      end
    end
  end

end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/cocoon-1.2.6/spec/generators/install_generator_spec.rb
cocoon-1.2.6 spec/generators/install_generator_spec.rb
cocoon-1.2.5 spec/generators/install_generator_spec.rb
cocoon-1.2.4 spec/generators/install_generator_spec.rb
cocoon-1.2.3 spec/generators/install_generator_spec.rb
cocoon-1.2.2 spec/generators/install_generator_spec.rb
cocoon-1.2.1 spec/generators/install_generator_spec.rb
cocoon-1.2.0 spec/generators/install_generator_spec.rb
cocoon-1.1.2 spec/generators/install_generator_spec.rb
cocoon-1.1.1 spec/generators/install_generator_spec.rb
cocoon-1.1.0 spec/generators/install_generator_spec.rb
cocoon-1.0.22 spec/generators/install_generator_spec.rb
cocoon-1.0.21 spec/generators/install_generator_spec.rb
cocoon-1.0.20 spec/generators/install_generator_spec.rb
cocoon-1.0.19 spec/generators/install_generator_spec.rb
cocoon-1.0.18 spec/generators/install_generator_spec.rb
cocoon-1.0.17 spec/generators/install_generator_spec.rb
cocoon-1.0.16 spec/generators/install_generator_spec.rb
cocoon-1.0.15 spec/generators/install_generator_spec.rb