Coder Social home page Coder Social logo

shoegaze's People

Contributors

atomicules avatar onyxrev avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shoegaze's Issues

Shoegaze doesn't support mock a class with argumented initializer

What is problem I'd like to solve?

For class with argumented initializer, shoegaze doesn't mock class initialize function, then instantiation like FakeClass.proxy.new(args) fails with following error:

  1) FakeTest works with customized initializer in shoegaze
     Failure/Error: subject { FakeTest.proxy.new("dummy") }

     ArgumentError:
       wrong number of arguments (given 1, expected 0)

How to reproduce

class TestClass
  def initialize(dummy)
  end
end

class FakeTest < Shoegaze::Mock
  mock "TestClass"

  implement_instance_method :initialize do
    default do
      datasource do |*arg|
        "instance method implementation doesn't help, \
        because `missing_method` wasn't hit at all."
      end
    end
  end
end

describe FakeTest do
  subject { FakeTest.proxy.new("dummy") }
  
  it "works with customized initializer in shoegaze" do
    expect(subject).to be_kind_of Shoegaze::Proxy::Template
  end
end

Feature: resettable orchestrations

We should be able to do something like:

FakeThing.reset

... to clear all the orchestrations. Right now the orchestrations can persist across tests.

Feature: orchestration of method chains

Currently you can orchestrate the top-level call with default scenarios underneath:

API::FakeAccountsClient::V2.class_call(:oauth_access_tokens).yields(:success)

API::FakeAccountsClient::V2.oauth_access_tokens.create
success!

But that would also make the following succeed:

API::FakeAccountsClient::V2.class_call(:oauth_access_tokens).yields(:success)

API::FakeAccountsClient::V2.oauth_access_tokens.destroy
success!

... which may not provide sufficiently fine-grained control.

I'd like to be able to do something like:

API::FakeAccountsClient::V2.class_call(:oauth_access_tokens, :create).yields(:success)

Or maybe even:

API::FakeAccountsClient::V2.class_call(:oauth_access_tokens, :create).yields(:success, :failure)

You get the idea. The syntax is up for discussion.

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.