diff options
| author | mo khan <mo@mokhan.ca> | 2015-05-07 21:10:53 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2015-05-07 21:10:53 -0600 |
| commit | fd715021c83ba0846cffeb625ffcf98683b0d29b (patch) | |
| tree | d45202a79a64fdaa858e146fe755aa1e7304447e /spec | |
| parent | d42b00b6b7be7bb702eac8040a0d2c02bf7cc36d (diff) | |
add build-essential and tests for postgres.
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/postgres_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/postgres_spec.rb b/spec/postgres_spec.rb new file mode 100644 index 0000000..bdef6a3 --- /dev/null +++ b/spec/postgres_spec.rb @@ -0,0 +1,33 @@ +describe "mokhan-myface::postgres" do + subject do + ChefSpec::SoloRunner.new do |node| + node.set["postgres"]["database"] = database_name + node.set["postgres"]["host"] = database_host + node.set["postgres"]["username"] = database_user + node.set["postgresql"]["password"]['postgres'] = database_password + node.set["postgresql"]["config"] = {} + end.converge(described_recipe) + end + + let(:database_name) { FFaker::Internet.user_name } + let(:database_host) { "localhost" } + let(:database_user) { FFaker::Internet.user_name } + let(:database_password) { "password" } + + before :each do + stub_command('ls /recovery.conf').and_return(true) + end + + it 'creates the specified database' do + expect(subject).to create_postgresql_database(database_name) + end + + it 'creates the database user' do + expect(subject).to create_postgresql_database_user(database_user) + end + + it 'grants all privileges to the database user' do + expect(subject).to grant_postgresql_database_user(database_user) + .with_privileges([:all]) + end +end |
