test/functional/test_application.rb in spontaneous-0.2.0.beta4 vs test/functional/test_application.rb in spontaneous-0.2.0.beta5
- old
+ new
@@ -16,22 +16,13 @@
Spontaneous.init(:root => site_root, :mode => :back, :environment => :development)
let(:site_root) { site_root }
end
finish do
- Object.send :remove_const, :Page
- Object.send :remove_const, :Piece
- Object.send :remove_const, :Project
- Object.send :remove_const, :ProjectImage
- Object.send :remove_const, :ProjectsPage
- Object.send :remove_const, :Text
- Object.send :remove_const, :HomePage
- Object.send :remove_const, :InfoPage
- Object.send :remove_const, :ClientProject
- Object.send :remove_const, :ClientProjects
- Object.send :remove_const, :InlineImage
-
+ [:Page, :Piece, :Project, :ProjectImage, :ProjectsPage, :Text, :HomePage, :InfoPage, :ClientProject, :ClientProjects, :InlineImage].each do |klass|
+ Object.send :remove_const, klass rescue nil
+ end
teardown_site(true)
end
before do
end
@@ -46,26 +37,31 @@
end
end
describe "Site" do
before do
- Spontaneous.init(:root => site_root, :mode => :back, :environment => :development)
+ @site = Spontaneous.init(:root => site_root, :mode => :back, :environment => :development)
end
+
+ it "returns an instance of the site from Spontaneous.init" do
+ @site.must_be_instance_of Spontaneous::Site
+ end
+
it "have the same config as Spontaneous" do
- Site.config.must_equal Spontaneous.config
+ @site.config.must_equal Spontaneous.config
end
it "enable setting config vars on Site" do
- Site.config.butter = "yummy"
- Site.config.butter.must_equal "yummy"
+ @site.config.butter = "yummy"
+ @site.config.butter.must_equal "yummy"
end
end
describe "back, development" do
before do
- Spontaneous.init(:root => site_root, :mode => :back, :environment => :development)
+ @site = Spontaneous.init(:root => site_root, :mode => :back, :environment => :development)
Sequel::Migrator.apply(Spontaneous.database, 'db/migrations')
end
it "have the right mode setting" do
Spontaneous.mode.must_equal :back
@@ -86,12 +82,12 @@
it "have correct schema dir" do
Spontaneous.schema_root.must_equal Spontaneous.root / "schema"
end
it "have correct db settings" do
- Site.config.db[:adapter].must_equal "postgres"
- Site.config.db[:database].must_equal "spontaneous2_test"
+ @site.config.db[:adapter].must_equal "postgres"
+ @site.config.db[:database].must_equal "spontaneous2_test"
# Site.config.db[:user].must_equal "root"
# Site.config.db[:password].should be_nil
# Site.config.db[:host].must_equal "localhost"
end
@@ -137,11 +133,11 @@
end
end
describe "back, production" do
before do
- Spontaneous.init(:root => site_root, :mode => :back, :environment => :production)
+ @site = Spontaneous.init(:root => site_root, :mode => :back, :environment => :production)
end
it "have the right mode setting" do
Spontaneous.mode.must_equal :back
assert Spontaneous.back?
@@ -154,13 +150,13 @@
assert Spontaneous.production?
# Site.config.environment.must_equal :production
end
it "have correct db settings" do
- Site.config.db[:adapter].must_equal "postgres"
- Site.config.db[:database].must_equal "spontaneous_example_production"
- Site.config.db[:user].must_equal "spontaneous_prod"
- Site.config.db[:password].must_equal "Passw0rd"
+ @site.config.db[:adapter].must_equal "postgres"
+ @site.config.db[:database].must_equal "spontaneous_example_production"
+ @site.config.db[:user].must_equal "spontaneous_prod"
+ @site.config.db[:password].must_equal "Passw0rd"
# Site.config.db[:host].must_equal "localhost"
end
it "have the right rack port" do
Spontaneous::Rack.port.must_equal 3001