Sha256: db8f7843c24fb2616323d1b259dc8e5caebe37104aba50a6337c8f7cb771e79b
Contents?: true
Size: 1.47 KB
Versions: 16
Compression:
Stored size: 1.47 KB
Contents
require_relative "../../test_helper" module Unit module API class TestInstance < MiniTest::Test class Foo include MagnumPI::API::Instance end describe MagnumPI::API::Instance do describe ".initialize" do it "defines @api and @resources" do api = mock api.expects(:finalize).returns(api) resources = mock resources.expects(:to_hash).returns(resources) Foo.expects(:api).returns api Foo.expects(:resources).returns resources foo = Foo.new assert_equal api, foo.instance_variable_get(:@api) assert_equal resources, foo.instance_variable_get(:@resources) end end describe "instances" do before do api = mock api.expects(:finalize).returns(api) Foo.expects(:api).returns api Foo.expects(:resources).returns Hash.new end describe "#api" do it "returns @api" do foo, api = Foo.new, api foo.instance_variable_set :@api, api assert_equal api, foo.api end end describe "#resources" do it "returns @resources" do foo, resources = Foo.new, resources foo.instance_variable_set :@resources, resources assert_equal resources, foo.resources end end end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems