Sha256: ae43853d90e420b373faedabcdf89f980e401019d46c5eff8ad5a024430cc22a

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require "spec_helper"

class TestClass
  
end

describe GeneratorSpec::TestCase do
  before do
    @klass = Class.new do
      include GeneratorSpec::TestCase
    end
    @klass.test_case_instance = mock
  end
  
  it "passes unknown messages on to test_case_instance" do
    @klass.test_case_instance.should_receive(:assert_file).with("test")
    @klass.new.assert_file("test")
  end
  
  it "handles respond_to accordingly" do
    @klass.test_case_instance.should_receive(:respond_to?).with(:assert_no_file).and_return(true)
    @klass.new.respond_to?(:assert_no_file).should be_true
  end
end

describe TestGenerator, "using normal assert methods" do
  include GeneratorSpec::TestCase
  tests TestGenerator
  destination File.expand_path("../../tmp", __FILE__)
  arguments %w(test)
  
  before(:all) do
    prepare_destination
    run_generator
  end

  it "creates a test initializer" do
    assert_file "config/initializers/test.rb", "# Initializer"
  end

  it "creates a migration" do
    assert_migration "db/migrate/create_tests.rb"
  end

  it "removes files" do
    assert_no_file ".gitignore"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
generator_spec-0.8.1 spec/generator_spec/test_case_spec.rb