{"id":22288358,"url":"https://github.com/unclebob/rubyslim","last_synced_at":"2025-07-28T22:32:38.921Z","repository":{"id":459817,"uuid":"83944","full_name":"unclebob/rubyslim","owner":"unclebob","description":"Slim port for Ruby","archived":false,"fork":false,"pushed_at":"2015-07-16T18:45:20.000Z","size":298,"stargazers_count":60,"open_issues_count":4,"forks_count":18,"subscribers_count":8,"default_branch":"master","last_synced_at":"2023-04-12T23:57:01.923Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"fitnesse.org","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unclebob.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2008-12-02T21:58:02.000Z","updated_at":"2022-02-13T16:31:37.000Z","dependencies_parsed_at":"2022-07-16T23:46:10.173Z","dependency_job_id":null,"html_url":"https://github.com/unclebob/rubyslim","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unclebob%2Frubyslim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unclebob%2Frubyslim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unclebob%2Frubyslim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unclebob%2Frubyslim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unclebob","download_url":"https://codeload.github.com/unclebob/rubyslim/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227961828,"owners_count":17847841,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-03T17:04:28.400Z","updated_at":"2024-12-03T17:04:29.153Z","avatar_url":"https://github.com/unclebob.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Ruby Slim\n=========\n\nThis package provides a SliM server implementing the [FitNesse](http://fitnesse.org)\n[SliM protocol](http://fitnesse.org/FitNesse.UserGuide.SliM.SlimProtocol). It allows\nyou to write test fixtures in Ruby, and invoke them from a FitNesse test.\n\n\nFixture names\n-------------\n\nRubyslim is very particular about how your modules and classes are named, and\nhow you import and use them in your FitNesse wiki:\n\n* Fixture folder must be `lowercase_and_underscore`\n* Fixture filenames must be `lowercase_and_underscore`\n* Ruby module name must be the `CamelCase` version of fixture folder name\n* Ruby class name must be the `CamelCase` version of the fixture file name\n\nFor example, this naming scheme is valid:\n\n* Folder: `ruby_fix`\n* Filename: `my_fixture.rb`\n* Module: `RubyFix`\n* Class: `MyFixture`\n\nIf you have `TwoWords` in CamelCase, then that would be `two_words` with\nunderscores. If you have only `oneword` in the lowercase version, then you must\nhave `Oneword` in the CamelCase version. If all of these naming conventions are\nnot exactly followed, you'll get mysterious errors like `Could not invoke\nconstructor` for your Slim tables.\n\n\nSetup\n-----\n\nPut these commands in a parent of the Ruby test pages.\n\n    !define TEST_SYSTEM {slim}\n    !define TEST_RUNNER {rubyslim}\n    !define COMMAND_PATTERN {rubyslim}\n    !path your/ruby/fixtures\n\nPaths can be relative. You should put the following in an appropriate SetUp page:\n\n    !|import|\n    |\u003cruby module of fixtures\u003e|\n\nYou can have as many rows in this table as you like, one for each module that\ncontains fixtures. Note that this needs to be the *name* of the module as\nwritten in the Ruby code, not the filename where the module is defined.\n\nRuby slim works a lot like Java slim. We tried to use ruby method naming\nconventions. So if you put this in a table:\n\n    |SomeDecisionTable|\n    |input|get output?|\n    |1    |2          |\n\nThen it will call the `set_input` and `get_output` functions of the\n`SomeDecisionTable` class.\n\nThe `SomeDecisionTable` class would be written in a file called\n`some_decision_table.rb`, like this (the file name must correspond to the class\nname defined within, and the module name must match the one you are importing):\n\n    module MyModule\n      class SomeDecisionTable\n        def set_input(input)\n          @x = input\n        end\n\n        def get_output\n          @x\n        end\n      end\n    end\n\nNote that there is no type information for the arguments of these functions, so\nthey will all be treated as strings. This is important to remember! All\narguments are strings. If you are expecting integers, you will have to convert\nthe strings to integers within your fixtures.\n\n\nHashes\n------\n\nThere is one exception to the above rule. If you pass a HashWidget in a table,\nthen the argument will be converted to a Hash.\n\nConsider, for example, this fixtures class:\n\n    module TestModule\n      class TestSlimWithArguments\n        def initialize(arg)\n          @arg = arg\n        end\n\n        def arg\n          @arg\n        end\n\n        def name\n          @arg[:name]\n        end\n\n        def addr\n          @arg[:addr]\n        end\n\n        def set_arg(hash)\n          @arg = hash\n        end\n      end\n    end\n\nThis corresponds to the following tables.\n\n    |script|test slim with arguments|!{name:bob addr:here}|\n    |check|name|bob|\n    |check|addr|here|\n\n    |script|test slim with arguments|gunk|\n    |check|arg|gunk|\n    |set arg|!{name:bob addr:here}|\n    |check|name|bob|\n    |check|addr|here|\n\nNote the use of the HashWidgets in the table cells. These get translated into\nHTML, which RubySlim recognizes and converts to a standard ruby `Hash`.\n\n\nSystem Under Test\n-----------------\n\nIf a fixture has a `sut` method that returns an object, then if a method called\nby a test is not found in the fixture itself, then if it exists in the object\nreturned by `sut` it will be called. For example:\n\n    !|script|my fixture|\n    |func|1|\n\n    class MySystem\n      def func(x)\n        #this is the function that will be called.\n      end\n    end\n\n    class MyFixture\n      attr_reader :sut\n\n      def initialize\n        @sut = MySystem.new\n      end\n    end\n\nSince the fixture `MyFixture` does not have a function named `func`, but it\n_does_ have a method named `sut`, RubySlim will try to call `func` on the\nobject returned by `sut`.\n\n\nLibrary Fixtures\n----------------\n\nRuby Slim supports the `|Library|` feature of FitNesse. If you declare certain\nclasses to be libraries, then if a test calls a method, and the specified\nfixture does not have it, and there is no specified `sut`, then the libraries\nwill be searched in reverse order (latest first). If the method is found, then\nit is called.\n\nFor example:\n\n    |Library|\n    |echo fixture|\n\n    |script|\n    |check|echo|a|a|\n\n    class EchoFixture\n      def echo(x)\n        x\n      end\n    end\n\nHere, even though no fixture was specified for the script table, since a\nlibrary was declared, functions will be called on it.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funclebob%2Frubyslim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funclebob%2Frubyslim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funclebob%2Frubyslim/lists"}