Sha256: 481b76a2d0bcd6bd617c9daffe9c834b433d167d920a3e8b37af3f3b47f278bb

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'

describe Facemock::FbGraph do
  let(:db_name) { ".test" }

  it 'should have a application class' do
    expect(Facemock::FbGraph::Application).to be_truthy
  end

  it 'should have a errors module' do
    expect(Facemock::FbGraph::Errors).to be_truthy
  end

  it 'should have a user module' do
    expect(Facemock::FbGraph::User).to be_truthy
  end

  before do
    stub_const("Facemock::Config::Database::DEFAULT_DB_NAME", db_name)
  end
  after  { Facemock::Config.database.drop }

  describe '#on' do
    subject { Facemock::FbGraph.on }
    it { is_expected.to be_truthy }

    context 'FbGraph' do
      before { Facemock::FbGraph.on }
      it { expect(::FbGraph).to eq Facemock::FbGraph }
      it { expect( lambda { Facemock::FbGraph.on } ).not_to raise_error }
    end
  end

  describe '#off' do
    subject { Facemock::FbGraph.off }
    it { is_expected.to be_truthy }

    context 'FbGraph' do
      before { Facemock::FbGraph.off }
      it { expect(FbGraph).to eq FbGraph }
      it { expect( lambda { Facemock::FbGraph.off } ).not_to raise_error }

      context 'when mock is on' do
        before do
          Facemock::FbGraph.on
          Facemock::FbGraph.off
        end

        subject { ::FbGraph }
        it { is_expected.to eq FbGraph }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facemock-0.0.2 spec/facemock/fb_graph_spec.rb