Sha256: 9230aa4b2e86cca703fb8c31548e7de97d6556d393288ed93b2b3a85e7ef90f1

Contents?: true

Size: 957 Bytes

Versions: 2

Compression:

Stored size: 957 Bytes

Contents

require 'spec_helper'
RSpec.describe 'app_kit/resources/_form.html.slim', :type => :view do
  let(:customer)  { FactoryGirl.create(:customer)}
  let(:resource) { AppKit::Resource.find(:customer)}
  before(:each) do
    allow(view).to receive(:resource).and_return(resource)
    assign(:record, customer)
  end
  it "should render form" do
    render
    expect(rendered).to have_selector('form')
  end
  describe "enum field" do
    let(:enum_field) {
      AppKit::Field.new(Customer,
                        :first_name,
                        enum: {open: 'Open', closed: 'Closed'})
    }
    it "should render enum field" do
      allow(resource).to receive(:editable_fields).and_return([enum_field])
      render
      expect(rendered).to have_selector('select')
      expect(rendered).to have_selector('select option[value=open]', text: 'Open')
      expect(rendered).to have_selector('select option[value=closed]', text: 'Closed')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
app_kit-0.0.2 spec/views/app_kit/resources/_form.html.slim_spec.rb
app_kit-0.0.1 spec/views/app_kit/resources/_form.html.slim_spec.rb