快捷搜索:

您的位置:澳门新葡4473网站 > 项目 > RubyMine 2019.2 发布,流行的 Ruby 开发工具

RubyMine 2019.2 发布,流行的 Ruby 开发工具

发布时间:2020-04-21 09:50编辑:项目浏览(95)

    图片 1

    intro

    • a library for setting up Ruby objects as test data.
    • factory_girl is a fixtures replacement with a straightforward definition syntax
    • build strategies (saved objs, unsaved objs, attribute hashes, and stubbed objs)
    • multiple factories, transient, lazy attributes, trait, inheritance
    • sequences, aliases, associations, callbacks, etc...

    RubyMine 2019.2 发布了,更新亮点如下:

    config in rails

    • add factory_girl_rails gem in development and test env
    • require 'factory_girl_rails' and 'support/factory_girl' to 'spec_helper'.

    Debugger

    • 调试器速度更快了
    • 使用 Smart Step Into 调查线路上的每个方法或块
    • 在块处设置断点

    lazy attributes

    • 'normal' attributes are evaluated when the factory is defined.
    • 'lazy' attributes are evaluated when the instance is initialised.
    • tips: provide static values as 'normal' attributes, like name, description, etc.
    • tips: provide associations and dynamically created values as 'lazy' attrs, e.g. Time.
    • tips: 'lazy' attributes can work with 'transient' attributes.

    图片 2

    play in rails console

    1. add factory_girl_rails gem in development and test env.
    2. rails console test --sandbox # go in console test env sandbox mode.
    3. include FactoryGirl::Syntax::Methods # call methods without FactoryGirl.
    4. user = build(:user) # initialize user instance from user factory.

    Ruby 2.7

    • 支持模式匹配
    • 支持有编号的块参数

    check validation

    1. FactoryGirl.factories get all 'FactoryGirl::Factory' instances
    2. FactoryGirl.factories.each { |f| puts f.name } # show all factory names
    3. target_factories = FactoryGirl.factories.select { |f| f.name =~ /^user_/ }
    4. FactoryGirl.lint target_factories; # FactoryGirl.lint check all factories

    图片 3

    Resources:

    • Github: factory_girl, factory_girl_rails
    • https://github.com/thoughtbot/factory_girl
    • http://www.rubydoc.info/gems/factory_girl *
    • http://stackoverflow.com/questions/tagged/factory-girl
    • https://ruby-china.org/topics/3777
    • https://ruby-china.org/topics/22003
    • http://code.tutsplus.com/articles/factory-girl-101--cms-25087
    • http://code.tutsplus.com/articles/factory-girl-201--cms-25171
    • http://arjanvandergaag.nl/blog/factory_girl_tips.html

    Rails 6

    • 支持行动邮箱
    • Enum 支持包含了新的负范围

    图片 4

    YARD

    • 支持 @overload 和 @yieldparam 标签
    • 全面改进

    图片 5

    Factory Bot

    • 重命名并安全删除 factories、序列(sequences)和 traits 的重构
    • 在“文件结构”视图和弹出窗口中添加 factories、sequences 和 traits

    图片 6

    Shell scripts

    • .sh 和 .bash 文件的完整代码洞察
    • 集成的 linting 和格式化工具
    • 运行配置

    图片 7

    发布公告

    (文/开源中国)    

    本文由澳门新葡4473网站发布于项目,转载请注明出处:RubyMine 2019.2 发布,流行的 Ruby 开发工具

    关键词:

上一篇:没有了

下一篇:没有了