Permalink
Browse files

added config specs pass

  • Loading branch information...
1 parent e85e594 commit d8cadec4b50f17b285ed774865ffbd153b723b6a @kristianmandrup committed Aug 23, 2012
Showing with 30 additions and 10 deletions.
  1. +1 −0 .rspec
  2. +2 −4 lib/social_buttons/engine.rb
  3. +27 −6 spec/social_buttons/config_spec.rb
View
1 .rspec
@@ -0,0 +1 @@
+--color
@@ -1,10 +1,8 @@
module SocialButtons
module Rails
class Engine < ::Rails::Engine
- initializer 'social buttons config' do
- SocialButtons.buttons.each do |name|
- ActionView::Base.send :include, SocialButtons::ViewHelper
- end
+ initializer 'social buttons config' do
+ ActionView::Base.send :include, SocialButtons::ViewHelper
end
end
end
@@ -1,13 +1,34 @@
require 'spec_helper'
describe SocialButtons do
- describe '#config' do
- pending
- end
- SocialButtons.names.each do |name|
- describe ".#{name}" do
- pending
+ # TODO: Generate for each!
+ # SocialButtons.names.each do |name|
+ context 'Tweet' do
+ subject { SocialButtons::Tweet }
+
+ describe 'Tweet' do
+ before :all do
+ SocialButtons::Tweet.default_options = {:via => "myself"}
+ end
+
+ its(:default_options) { should == {:via => "myself"} }
+ end
+
+ describe '#config' do
+ before :all do
+ SocialButtons.config(:tweet).default_options = {:via => "myself"}
+ end
+
+ its(:default_options) { should == {:via => "myself"} }
+ end
+
+ describe '#config &block' do
+ before :all do
+ SocialButtons.config(:tweet) {|c| c.default_options = {:via => "myself"} }
+ end
+
+ its(:default_options) { should == {:via => "myself"} }
end
end
end

0 comments on commit d8cadec

Please sign in to comment.