Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ether-fly

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ether-fly

  • 0.0.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Introduction

EtherFly is a Ethereum smart contract test framework in ruby.It provides two testing environments: testing in ruby EVM and testing in geth.You don't need to understand ruby grammar, just enjoy syntactic sugar.

Install

bundle install ether-fly

How to use

Help command:

$ ether-fly

Create a new Smart Contract application

$ ether-fly n project
$ cd project

Generate new Smart Contract and test file

$ ether-fly g game

Run tests

$ ether-fly t game

Unit tests

You can wirte fast, simple tests.

class TokenTest < Minitest::Test
  include Ethereum

  def setup
    @state = Tester::State.new
    @solidity_code = File.read('./contracts/Token.sol')
    @c = @state.abi_contract @solidity_code, language: :solidity
  end

  def test_issue_balance
    assert_equal 0, @c.getBalance(Tester::Fixture.accounts[2])
    @c.issue Tester::Fixture.accounts[2], 100
    assert_equal 100, @c.getBalance(Tester::Fixture.accounts[2])
  end

  def test_issue_exception
    assert_raises(TransactionFailed) { @c.issue Tester::Fixture.accounts[3], 100, sender: Tester::Fixture.keys[4] }
    assert_equal 0, @c.getBalance(Tester::Fixture.accounts[3])
  end

  def test_token_transfer
    @c.issue Tester::Fixture.accounts[2], 100
    @c.transfer Tester::Fixture.accounts[3], 90, sender: Tester::Fixture.keys[2]
    assert_equal 90, @c.getBalance(Tester::Fixture.accounts[3])

    assert_raises(TransactionFailed) { @c.transfer Tester::Fixture.accounts[3], 90, sender: Tester::Fixture.keys[2] }
  end
end

More details: https://github.com/seattlerb/minitest

TODO

  • Extract test file require and others
  • Save migrate address
  • Migrate ARGV
  • Script for preload
  • Easy way to load contract on chain
  • Easy way to test on chain
  • ES6

FAQs

Package last updated on 15 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc