Sha256: df5754b35af2bd2ddb093e33eb4fd8d3d7544dd2c5dd42e86cc260ce91691309

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'
require 'generators/haml/enquiry_controller/enquiry_controller_generator'

describe Haml::Generators::EnquiryControllerGenerator, :type => :generator do
  it "creates the view with defaults" do
    gen = generator %w(list_something)
    expect(gen).to receive(:create_template_file)
    capture(:stdout) { gen.invoke_all }
  end

  it "creates the view with specified action name" do
    gen = generator %w(list_something list)
    expect(gen).to receive(:create_template_file)
    capture(:stdout) { gen.invoke_all }
  end

  it "creates the view with specified action name and attributes" do
    gen = generator %w(list_something list name:string:required active:boolean other)
    expect(gen).to receive(:create_template_file)
    capture(:stdout) { gen.invoke_all }
  end

  describe "the generated files" do
    before do
      run_generator %w(list_something list name:string:required active:boolean other)
    end

    describe "the view" do
      subject { file('app/views/list_something_enquiry/list.html.haml') }

      it { should exist }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
riveter-0.0.1 spec/generators/haml/enquiry_controller/enquiry_controller_generator_spec.rb