Sha256: 0739c5be020bb83389d53ac0dcb80a2f0d55eda1ae3aadc756a898705e2d54db

Contents?: true

Size: 1.48 KB

Versions: 8

Compression:

Stored size: 1.48 KB

Contents

require 'spec_helper'

module FakeFS
  describe SpecHelpers do
    before do
      @rspec_example_group = Class.new do
        def self.before(sym = :each)
          yield if block_given?
        end

        def self.after(sym = :each)
          yield if block_given?
        end
      end
    end

    describe "when extending" do
      context "before each" do
        it "should call it" do
          @rspec_example_group.should_receive(:before).with(:each)
          @rspec_example_group.extend FakeFS::SpecHelpers
        end

        it "should call FakeFS.activate!" do
          FakeFS.should_receive(:activate!)
          @rspec_example_group.extend FakeFS::SpecHelpers
        end
      end

      context "after each" do
        it "should call it" do
          @rspec_example_group.should_receive(:after).with(:each)
          @rspec_example_group.extend FakeFS::SpecHelpers
        end

        it "should deactivate fakefs" do
          FakeFS.should_receive(:deactivate!)
          @rspec_example_group.extend FakeFS::SpecHelpers
        end

        it "should clear the fakefs filesystem for the next run" do
          FakeFS::FileSystem.should_receive(:clear)
          @rspec_example_group.extend FakeFS::SpecHelpers
        end
      end
    end

    describe "when including" do
      it "should call before :each" do
        @rspec_example_group.should_receive(:before)
        @rspec_example_group.class_eval do
          include FakeFS::SpecHelpers
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
vim-jar-0.1.2.0001 bundler/ruby/1.8/gems/fakefs-0.2.1/spec/fakefs/spec_helpers_spec.rb
vim-jar-0.1.2 bundler/ruby/1.8/gems/fakefs-0.2.1/spec/fakefs/spec_helpers_spec.rb
vim-jar-0.1.1 bundler/ruby/1.8/gems/fakefs-0.2.1/spec/fakefs/spec_helpers_spec.rb
vim-jar-0.1.0 bundler/ruby/1.8/gems/fakefs-0.2.1/spec/fakefs/spec_helpers_spec.rb
vim-jar-0.0.3 bundler/ruby/1.8/gems/fakefs-0.2.1/spec/fakefs/spec_helpers_spec.rb
vim-jar-0.0.2 bundler/ruby/1.8/gems/fakefs-0.2.1/spec/fakefs/spec_helpers_spec.rb
vim-jar-0.0.1 bundler/ruby/1.8/gems/fakefs-0.2.1/spec/fakefs/spec_helpers_spec.rb
fakefs-0.2.1 spec/fakefs/spec_helpers_spec.rb