GithubHelp home page GithubHelp logo

microform's People

Contributors

jackjennings avatar skwak avatar

Watchers

 avatar  avatar  avatar

microform's Issues

Test the generated form?

Seems like the generated files should be tested somehow, though not sure at this point how that might work (especially testing the test file)โ€ฆ

Shared functionality: ApplicationForm? Mixin? Boilerplate?

Should microform also have an "install" generator that adds an ApplicationForm class to your project?

Or, taking a step back, how can some of the generic functionality like the respond_to? and other delegation method. This could either be a parent class, or a mix-in module, or simply repeated in each form class.

The next question is, if functionality is shared in either of those way, does that mean that the instance variable needs to get more generic:

def initialize project
  @project = project
end
# vs
def initialize record
  @record = record
end

Or, is there some way that the instance variable is configured. This could be too clever:

class ProjectForm
  include Micrform::Form[:project]
end

Or, the instance variable could be inferred from the form name, e.g. ProjectForm assumes there will be a @project instance variable assigned in the initializer.

Do these "solutions" jump trough too many hoops to just avoid renaming the attribute to the more generic record?

Logo

Of course, the project NEEDS a logo.

Add a testing section to README

Since using plain ruby objects is a big benefit to how easy it is to test, there should be a brief section about testing included.

Write README

Add:

  • Sample controller (where to use it)
  • Explanation of the form duck type
  • Installation instructions
  • TravisCI badge
  • Rubygems badge
  • Logo

Anything else?

Submit stub swallows arguments without raising an error

Writing a test with the test helper for the following test will pass, while executing the code in the controller will actually raise an exception:

class FooController
  def create
    submit FooForm, Foo.new, params, extra_argument
  end
end

class FooControllerTest
  def test_should_create
    assert_submits OrderForm, stub: order_double do
      post foos_url
    end
  end
end

The stub that replaces the submit method verifies that the first argument is the correct form, but not that the second and third arguments are present (and no more than that).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.