spec/rails/example/configuration_spec.rb in dchelimsky-rspec-rails-1.1.11 vs spec/rails/example/configuration_spec.rb in dchelimsky-rspec-rails-1.1.11.1

- old
+ new

@@ -1,83 +1,79 @@ require File.dirname(__FILE__) + '/../../spec_helper' module Spec module Example - describe Configuration, :shared => true do - before(:each) { @config = Configuration.new } - end + describe Configuration do - describe Configuration, "#use_transactional_fixtures" do - it_should_behave_like "Spec::Example::Configuration" - - it "should return Test::Unit::TestCase.use_transactional_fixtures" do - @config.use_transactional_fixtures.should == Test::Unit::TestCase.use_transactional_fixtures + def config + @config ||= Configuration.new end - it "should set Test::Unit::TestCase.use_transactional_fixtures to false" do - Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group| - example_group.should_receive(:use_transactional_fixtures=).with(false) + describe "#use_transactional_fixtures" do + it "should return Test::Unit::TestCase.use_transactional_fixtures" do + config.use_transactional_fixtures.should == Test::Unit::TestCase.use_transactional_fixtures end - @config.use_transactional_fixtures = false - end - it "should set Test::Unit::TestCase.use_transactional_fixtures to true" do - Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group| - example_group.should_receive(:use_transactional_fixtures=).with(true) + it "should set Test::Unit::TestCase.use_transactional_fixtures to false" do + Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group| + example_group.should_receive(:use_transactional_fixtures=).with(false) + end + config.use_transactional_fixtures = false end - @config.use_transactional_fixtures = true - end - end - describe Configuration, "#use_instantiated_fixtures" do - it_should_behave_like "Spec::Example::Configuration" - - it "should return Test::Unit::TestCase.use_transactional_fixtures" do - @config.use_instantiated_fixtures.should == Test::Unit::TestCase.use_instantiated_fixtures + it "should set Test::Unit::TestCase.use_transactional_fixtures to true" do + Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group| + example_group.should_receive(:use_transactional_fixtures=).with(true) + end + config.use_transactional_fixtures = true + end end - it "should set Test::Unit::TestCase.use_instantiated_fixtures to false" do - Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group| - example_group.should_receive(:use_instantiated_fixtures=).with(false) + describe "#use_instantiated_fixtures" do + it "should return Test::Unit::TestCase.use_transactional_fixtures" do + config.use_instantiated_fixtures.should == Test::Unit::TestCase.use_instantiated_fixtures end - @config.use_instantiated_fixtures = false - end - it "should set Test::Unit::TestCase.use_instantiated_fixtures to true" do - Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group| - example_group.should_receive(:use_instantiated_fixtures=).with(true) + it "should set Test::Unit::TestCase.use_instantiated_fixtures to false" do + Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group| + example_group.should_receive(:use_instantiated_fixtures=).with(false) + end + config.use_instantiated_fixtures = false end - @config.use_instantiated_fixtures = true - end - end - describe Configuration, "#fixture_path" do - it_should_behave_like "Spec::Example::Configuration" - - it "should default to RAILS_ROOT + '/spec/fixtures'" do - @config.fixture_path.should == RAILS_ROOT + '/spec/fixtures' - Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group| - example_group.fixture_path.should == RAILS_ROOT + '/spec/fixtures' + it "should set Test::Unit::TestCase.use_instantiated_fixtures to true" do + Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group| + example_group.should_receive(:use_instantiated_fixtures=).with(true) + end + config.use_instantiated_fixtures = true end end - it "should set fixture_path" do - @config.fixture_path = "/new/path" - @config.fixture_path.should == "/new/path" - Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group| - example_group.fixture_path.should == "/new/path" + describe "#fixture_path" do + it "should default to RAILS_ROOT + '/spec/fixtures'" do + config.fixture_path.should == RAILS_ROOT + '/spec/fixtures' + Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group| + example_group.fixture_path.should == RAILS_ROOT + '/spec/fixtures' + end end + + it "should set fixture_path" do + config.fixture_path = "/new/path" + config.fixture_path.should == "/new/path" + Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group| + example_group.fixture_path.should == "/new/path" + end + end end - end - describe Configuration, "#global_fixtures" do - it_should_behave_like "Spec::Example::Configuration" - - it "should set fixtures on TestCase" do - Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group| - example_group.should_receive(:fixtures).with(:blah) + describe "#global_fixtures" do + it "should set fixtures on TestCase" do + Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group| + example_group.should_receive(:fixtures).with(:blah) + end + config.global_fixtures = [:blah] end - @config.global_fixtures = [:blah] end + end end end