changelog shortlog tags changeset manifest revisions annotate raw

vendor/plugins/rspec_on_rails/spec/rails/example/configuration_spec.rb

changeset 16: 01fd3f10ae84
author: moriq@moriq.com
date: Mon Mar 10 10:13:18 2008 +0900 (16 years ago)
permissions: -rw-r--r--
description: add plugins rspec_on_rails
1require File.dirname(__FILE__) + '/../../spec_helper'
2
3module Spec
4 module Example
5 describe Configuration, :shared => true do
6 before(:each) { @config = Configuration.new }
7 end
8
9 describe Configuration, "#use_transactional_fixtures" do
10 it_should_behave_like "Spec::Example::Configuration"
11
12 it "should return Test::Unit::TestCase.use_transactional_fixtures" do
13 @config.use_transactional_fixtures.should == Test::Unit::TestCase.use_transactional_fixtures
14 end
15
16 it "should set Test::Unit::TestCase.use_transactional_fixtures to false" do
17 Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
18 example_group.should_receive(:use_transactional_fixtures=).with(false)
19 end
20 @config.use_transactional_fixtures = false
21 end
22
23 it "should set Test::Unit::TestCase.use_transactional_fixtures to true" do
24 Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
25 example_group.should_receive(:use_transactional_fixtures=).with(true)
26 end
27 @config.use_transactional_fixtures = true
28 end
29 end
30
31 describe Configuration, "#use_instantiated_fixtures" do
32 it_should_behave_like "Spec::Example::Configuration"
33
34 it "should return Test::Unit::TestCase.use_transactional_fixtures" do
35 @config.use_instantiated_fixtures.should == Test::Unit::TestCase.use_instantiated_fixtures
36 end
37
38 it "should set Test::Unit::TestCase.use_instantiated_fixtures to false" do
39 Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
40 example_group.should_receive(:use_instantiated_fixtures=).with(false)
41 end
42 @config.use_instantiated_fixtures = false
43 end
44
45 it "should set Test::Unit::TestCase.use_instantiated_fixtures to true" do
46 Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
47 example_group.should_receive(:use_instantiated_fixtures=).with(true)
48 end
49 @config.use_instantiated_fixtures = true
50 end
51 end
52
53 describe Configuration, "#fixture_path" do
54 it_should_behave_like "Spec::Example::Configuration"
55
56 it "should default to RAILS_ROOT + '/spec/fixtures'" do
57 @config.fixture_path.should == RAILS_ROOT + '/spec/fixtures'
58 Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
59 example_group.fixture_path.should == RAILS_ROOT + '/spec/fixtures'
60 end
61 end
62
63 it "should set fixture_path" do
64 @config.fixture_path = "/new/path"
65 @config.fixture_path.should == "/new/path"
66 Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
67 example_group.fixture_path.should == "/new/path"
68 end
69 end
70 end
71
72 describe Configuration, "#global_fixtures" do
73 it_should_behave_like "Spec::Example::Configuration"
74
75 it "should set fixtures on TestCase" do
76 Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
77 example_group.should_receive(:fixtures).with(:blah)
78 end
79 @config.global_fixtures = [:blah]
80 end
81 end
82 end
83end