Sha256: 5a0840f87e4c333d2331a4f58e9c628b8f699978e2bd69e8f55e7fc944b4d601

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'
require "generator_spec/test_case"
require 'generators/search_context/search_context_generator'
describe SearchContextGenerator do
  include GeneratorSpec::TestCase
  destination File.expand_path("../../tmp", __FILE__)
  arguments %w(foos)

  before do
    prepare_destination
  end

  it "creates a search_context with a count" do
    run_generator %w(foos --dynamic)
    assert_file "app/models/foo.rb", /:count/
  end
  it "creates a search_context with w/o count" do
    run_generator %w(foos --skip-dynamic)
    assert_file "app/models/foo.rb", /attr_accessible  :name$/
  end

  after do
    assert_file "app/models/foo.rb", /class Foo/
    assert_file "app/models/foo_alias.rb", /class FooAlias/
    assert_migration "db/migrate/install_trigram_extension.rb"
    assert_migration "db/migrate/create_foos.rb"
    assert_migration "db/migrate/add_trigram_index_to_foos.rb"
    assert_migration "db/migrate/add_foos_search_config.rb"
    assert_migration "db/migrate/create_foo_aliases.rb"
    assert_migration "db/migrate/add_foo_aliases_trigger.rb"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
search_steroids-0.0.1 spec/dummy/spec/generators/search_context_generator_spec.rb