Sha256: 6d1a3e446f1fd645577f2689df230015ca08b2e2b6451e20af5ec6fc2420a795

Contents?: true

Size: 663 Bytes

Versions: 1

Compression:

Stored size: 663 Bytes

Contents

require 'katapult/parser'

describe Katapult::Parser do

  describe '#crud' do
    it 'creates a model plus a web UI with crud actions' do
      model = <<-MODEL
crud 'user' do |user|
  user.attr :age
end
      MODEL

      parsed_model = subject.parse(model)
      expect(parsed_model.models.count).to be 1
      user = parsed_model.models.first
      expect(user.name).to eq 'user'
      expect(user.attrs.count).to be 1
      expect(user.attrs.first.name).to eq 'age'

      expect(parsed_model.web_uis.count).to be 1
      web_ui = parsed_model.web_uis.first
      expect(web_ui.actions.map(&:name)).to match Katapult::WebUI::RAILS_ACTIONS
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
katapult-0.3.0 spec/parser_spec.rb