Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecated messages from rspec mock and any_number_of_time. #387

Merged
merged 2 commits into from
Dec 10, 2013
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion awestruct.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require 'awestruct/version'
spec = Gem::Specification.new do |s|
s.name = 'awestruct'
s.version = Awestruct::VERSION
s.date = '2013-12-03'
s.date = '2013-12-04'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we need this change, I think it's auto generated. Really not sure why this would have changed.


s.authors = ['Bob McWhirter', 'Jason Porter', 'Lance Ball', 'Dan Allen', 'Torsten Curdt', 'other contributors']
s.email = ['bob@mcwhirter.org', 'lightguard.jp@gmail.com', 'lball@redhat.com', 'dan.j.allen@gmail.com', 'tcurdt@vafer.org']
Expand Down
16 changes: 8 additions & 8 deletions spec/deploy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
end

it "should gzip if deploy['gzip'] is true" do
site_config = mock
site_config = double
site_config.stub(:output_dir).and_return '_site'

deploy_config = mock
deploy_config = double
deploy_config.stub(:[]).with('gzip').and_return true
deploy_config.stub(:[]).with('gzip_level')
deploy_config.stub(:[]).with('source_dir').and_return '.'
Expand All @@ -60,10 +60,10 @@
FileUtils.cp_r(site_src_dir, site_tmp_dir)
site_dir = "#{site_tmp_dir}/gzip"

site_config = mock
site_config = double
site_config.stub(:output_dir).and_return "#{site_dir}"

deploy_config = mock
deploy_config = double
deploy_config.stub(:[]).with('gzip').and_return true
deploy_config.stub(:[]).with('gzip_level')
deploy_config.stub(:[]).with('source_dir').and_return '.'
Expand All @@ -85,10 +85,10 @@
FileUtils.cp_r(site_src_dir, site_tmp_dir)
site_dir = "#{site_tmp_dir}/gzip"

site_config = mock
site_config = double
site_config.stub(:output_dir).and_return "#{site_dir}"

deploy_config = mock
deploy_config = double
deploy_config.stub(:[]).with('gzip').and_return true
deploy_config.stub(:[]).with('gzip_level')
deploy_config.stub(:[]).with('source_dir').and_return '.'
Expand All @@ -112,10 +112,10 @@
FileUtils.cp_r(site_src_dir, site_tmp_dir)
site_dir = "#{site_tmp_dir}/gzip"

site_config = mock
site_config = double
site_config.stub(:output_dir).and_return "#{site_dir}"

deploy_config = mock
deploy_config = double
deploy_config.stub(:[]).with('gzip').and_return true
deploy_config.stub(:[]).with('gzip_level').and_return 6
deploy_config.stub(:[]).with('source_dir').and_return '.'
Expand Down
2 changes: 1 addition & 1 deletion spec/engine_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
end

def compass_config
config = mock
config = double
config.stub(:project_type=)
config.stub(:project_path=)
config.stub(:sass_dir=)
Expand Down
12 changes: 6 additions & 6 deletions spec/github_pages_deploy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
describe Awestruct::Deploy::GitHubPagesDeploy do

before :each do
site_config = mock
site_config = double
site_config.stub(:output_dir).and_return '_site'

@deploy_config = mock
@deploy_config = double
@deploy_config.stub(:[]).with('branch').and_return('the-branch')
@deploy_config.stub(:[]).with('repository').and_return('the-repo')
@deploy_config.stub(:[]).with('gzip').and_return('false')
Expand All @@ -17,7 +17,7 @@
@deploy_config.stub(:[]).with('uncommitted').and_return('false')
@deployer = Awestruct::Deploy::GitHubPagesDeploy.new( site_config, @deploy_config )

@git = mock
@git = double
@git.stub_chain(:status, :changed, :empty?).and_return true
::Git.stub(:open).with('.').and_return @git
end
Expand All @@ -27,15 +27,15 @@
end

it "should warn and noop if no changes have been committed" do
git_scm = mock()
git_scm = double()
git_scm.stub(:uncommitted_changes?).with('.').and_return true
@deployer.instance_variable_set('@scm', git_scm)
$LOG.should_receive(:error).with(Awestruct::Deploy::Base::UNCOMMITTED_CHANGES)
@deployer.run
end

it "should save and restore the current branch when publishing" do
git_scm = mock()
git_scm = double()
git_scm.stub(:uncommitted_changes?).with('.').and_return false
@deployer.instance_variable_set('@scm', git_scm)
@git.should_receive(:current_branch).and_return( 'bacon' )
Expand All @@ -48,7 +48,7 @@
end

it "should save and restore the current detached branch when publishing" do
git_scm = mock()
git_scm = double()
git_scm.stub(:uncommitted_changes?).with('.').and_return false
@deployer.instance_variable_set('@scm', git_scm)
@git.should_receive(:current_branch).and_return( '(no branch)' )
Expand Down
2 changes: 1 addition & 1 deletion spec/invoker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

it "should return false on failure" do
require 'awestruct/cli/generate'
generator = mock
generator = double
Awestruct::CLI::Generate.should_receive( :new ).and_return( generator )
generator.should_receive( :run ).and_return( false )
Awestruct::CLI::Invoker.new( '--generate' ).invoke!.should be_false
Expand Down
20 changes: 10 additions & 10 deletions spec/minify_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
describe Awestruct::Extensions::Minify do

it "should ignore files with no extension" do
site = mock
page = mock
site = double
page = double

site.should_receive(:minify).and_return true
page.should_receive(:output_path).and_return "CNAME"
Expand All @@ -16,12 +16,12 @@
end

it "should compress html files" do
site = mock
page = mock
site = double
page = double

site.should_receive(:minify).and_return true
site.should_receive(:minify_html_opts).and_return( {:remove_comments => false} )
page.should_receive(:output_path).any_number_of_times.and_return "test.html"
page.should_receive(:output_path).at_least(1).and_return "test.html"

input = "<html><a href='' /> \n</html><!--test-->"
expected_output = "<html><a href=''/> </html><!--test-->"
Expand All @@ -32,8 +32,8 @@

# Doing this if it's production now
#it "should compress css files" do
#site = mock
#page = mock
#site = double
#page = double

#site.should_receive(:minify).and_return true
#page.should_receive(:output_path).any_number_of_times.and_return "test.css"
Expand All @@ -46,11 +46,11 @@
#end

it "should compress js files" do
site = mock
page = mock
site = double
page = double

site.should_receive(:minify).and_return true
page.should_receive(:output_path).any_number_of_times.and_return "test.js"
page.should_receive(:output_path).at_least(1).and_return "test.js"

input = "function a (a, c) { \n a = \"a\";\n }"
# we're minifying so we're going to strip dead or unreferenced code
Expand Down
14 changes: 7 additions & 7 deletions spec/posts_archive_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@
it "should assign default layout if specified to post without layout" do
extension = Awestruct::Extensions::Posts.new( '/posts', :news, nil, nil, :default_layout => 'blog' )
site = Hashery::OpenCascade[ { :encoding=>false } ]
page = __create_page( 2012, 8, 9, '/posts/mock-post.md' )
page = __create_page( 2012, 8, 9, '/posts/double-post.md' )
page.stub(:layout).and_return(nil)
page.should_receive(:layout=).with('blog')
page.stub(:slug).and_return(nil, 'mock-post')
page.should_receive(:slug=).with('mock-post')
page.should_receive(:output_path=).with('/posts/2012/08/09/mock-post.html')
page.stub(:slug).and_return(nil, 'double-post')
page.should_receive(:slug=).with('double-post')
page.should_receive(:output_path=).with('/posts/2012/08/09/double-post.html')

site.pages = [page]
extension.execute(site)
Expand All @@ -81,8 +81,8 @@
end

it "should use the provided template when generating the archive" do
engine = mock("Engine")
template = mock("Template")
engine = double("Engine")
template = double("Template")
template.should_receive( :archive= ).with( @archive.posts[2012][8][9] )
template.should_receive( :output_path= ).with( '/archive/2012/8/9/index.html' )
engine.should_receive( :find_and_load_site_page ).with( '/archive/index' ).and_return( template )
Expand All @@ -92,7 +92,7 @@
end

def __create_page(year, month, day, path = nil)
page = mock( "Page for #{year}-#{month}-#{day}" )
page = double( "Page for #{year}-#{month}-#{day}" )
page.stub(:date?).and_return( true )
page.stub(:date=).with(anything())
page.stub_chain(:date, :year).and_return( year )
Expand Down