Sha256: e911f983d090ff25aef0cb552968c5ced54a82b29ff94c72005f74dc698200aa

Contents?: true

Size: 1.33 KB

Versions: 23

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

shared_examples_for "a generator with locale file output" do |file_name|
  describe "the generated files" do
    describe "the #{file_name}.en.yml" do
      describe "creates when missing" do
        before do
          run_generator %w(foo_bar)
        end

        subject { file("config/locales/#{file_name}.en.yml") }

        it { should exist }
        it { should contain("#{file_name}:") }
      end

      describe "skips when exists" do
        before do
          FileUtils.mkdir_p(file('config/locales'))
          File.open(file("config/locales/#{file_name}.en.yml"), 'w') {|f| f.write 'untouched' }
          run_generator %w(foo_bar)
        end

        subject { file("config/locales/#{file_name}.en.yml") }

        it { should exist }
        it { should contain('untouched')}
      end
    end
  end
end

shared_examples_for "a generator with output to routes" do |route|
  describe "the generated files" do
    describe "the route" do
      before do
        run_generator %w(foo_bar)
      end

      subject { file('config/routes.rb') }

      it { should contain(route) }
    end
  end
end

shared_examples_for "a generator with a module" do |path|
  describe "the module" do
    before do
      run_generator %w(test_ns/foo_bar)
    end

    subject { file("#{path}/test_ns.rb") }

    it { should exist }
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
riveter-0.8.3 spec/examples/generator_examples.rb
riveter-0.8.2 spec/examples/generator_examples.rb
riveter-0.8.1 spec/examples/generator_examples.rb
riveter-0.8.0 spec/examples/generator_examples.rb
riveter-0.7.0 spec/examples/generator_examples.rb
riveter-0.6.0 spec/examples/generator_examples.rb
riveter-0.3.0 spec/examples/generator_examples.rb
riveter-0.2.1 spec/examples/generator_examples.rb
riveter-0.2.0 spec/examples/generator_examples.rb
riveter-0.1.1 spec/examples/generator_examples.rb
riveter-0.0.15 spec/examples/generator_examples.rb
riveter-0.0.14 spec/examples/generator_examples.rb
riveter-0.0.13 spec/examples/generator_examples.rb
riveter-0.0.12 spec/examples/generator_examples.rb
riveter-0.0.11 spec/examples/generator_examples.rb
riveter-0.0.10 spec/examples/generator_examples.rb
riveter-0.0.9 spec/examples/generator_examples.rb
riveter-0.0.8 spec/examples/generator_examples.rb
riveter-0.0.7 spec/examples/generator_examples.rb
riveter-0.0.6 spec/examples/generator_examples.rb