Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated specs to use 'name' instead of 'filename'.

Running specs: 521 examples, 246 failures. (As expected!)
  • Loading branch information...
commit 42852ec9c2451cbc3740db666c28f5ad1f22a321 1 parent d83cb7d
@nelstrom authored
View
14 spec/controllers/admin/text_asset_controller_spec.rb
@@ -158,7 +158,7 @@
post :new,
current_asset[:symbol] => send("#{current_asset[:name]}_params"),
:asset_type => current_asset[:name]
- @text_asset = current_asset[:class].find_by_filename('Test')
+ @text_asset = current_asset[:class].find_by_name('Test')
end
@@ -188,9 +188,9 @@
before :each do
post :new,
current_asset[:symbol] => send("#{current_asset[:name]}_params",
- :filename => nil),
+ :name => nil),
:asset_type => current_asset[:name]
- @text_asset = current_asset[:class].find_by_filename('Test')
+ @text_asset = current_asset[:class].find_by_name('Test')
end
@@ -219,10 +219,10 @@
before :each do
post :new,
current_asset[:symbol] => send("#{current_asset[:name]}_params",
- :filename => 'Test'),
+ :name => 'Test'),
:continue => 'Save and Continue Editing',
:asset_type => current_asset[:name]
- @text_asset = current_asset[:class].find_by_filename('Test')
+ @text_asset = current_asset[:class].find_by_name('Test')
end
@@ -314,7 +314,7 @@
post :edit,
:id => text_asset_id('main'),
current_asset[:symbol] => send("#{current_asset[:name]}_params",
- :filename => nil),
+ :name => nil),
:asset_type => current_asset[:name]
end
@@ -415,7 +415,7 @@
it "should destroy the #{current_asset[:name]}" do
- current_asset[:class].find_by_filename('main').should be_nil
+ current_asset[:class].find_by_name('main').should be_nil
end
View
8 spec/controllers/admin/text_asset_controller_upload_spec.rb
@@ -250,8 +250,8 @@
it "should create a new #{current_asset[:name]} based on the uploaded file" do
- # filename should be hypenated (where appropriate)
- current_asset[:class].find_by_filename('hello-world.txt').content.
+ # name should be hypenated (where appropriate)
+ current_asset[:class].find_by_name('hello-world.txt').content.
should eql("Hello World! (text file)")
end
@@ -269,9 +269,9 @@
private
def mock_uploader(file, type = 'text/plain', file_class = ActionController::UploadedStringIO)
- filename = "%s/%s" % [ File.dirname(__FILE__) + '/../../fixtures', file ]
+ name = "%s/%s" % [ File.dirname(__FILE__) + '/../../fixtures', file ]
uploader = file_class.new
- uploader.original_path = filename
+ uploader.original_path = name
uploader.content_type = type
def uploader.read
View
4 spec/controllers/site_controller_mixins_spec.rb
@@ -178,8 +178,8 @@
describe "with regard to Last-Modified date" do
before :each do
- @dependant = current_asset[:class].new(:filename => 'dependant')
- @dependency = current_asset[:class].new(:filename => 'dependency')
+ @dependant = current_asset[:class].new(:name => 'dependant')
+ @dependency = current_asset[:class].new(:name => 'dependency')
save_asset_at(@dependant, 1990)
end
View
20 spec/models/stylesheet_and_javascript_dependency_spec.rb
@@ -21,7 +21,7 @@
describe "During save, #{current_tag[:name].pluralize} containing <r:#{current_tag[:name]}> tags" do
before :each do
- @text_asset = current_tag[:class].new(:filename => 'dependant')
+ @text_asset = current_tag[:class].new(:name => 'dependant')
@text_asset.content = %{<r:#{current_tag[:name]} name="main" />}
end
@@ -67,7 +67,7 @@
describe "A saved #{current_tag[:name]}'s effectively_updated_at method" do
before :each do
- @dependant = current_tag[:class].new(:filename => 'dependant')
+ @dependant = current_tag[:class].new(:name => 'dependant')
save_asset_at(@dependant, 1990)
end
@@ -94,10 +94,10 @@
@dependant.content = %{<r:#{current_tag[:name]} name="dependency" />}
save_asset_at(@dependant, 1994)
- @dependency = current_tag[:class].new(:filename => 'dependency')
+ @dependency = current_tag[:class].new(:name => 'dependency')
save_asset_at(@dependency, 1995)
- @dependant = current_tag[:class].find_by_filename('dependant')
+ @dependant = current_tag[:class].find_by_name('dependant')
@dependant.dependencies.effectively_updated_at.should == Time.gm(1995)
end
@@ -106,18 +106,18 @@
@dependant.content = %{<r:#{current_tag[:name]} name="dependency" />}
save_asset_at(@dependant, 1991)
- @dependency = current_tag[:class].new(:filename => 'dependency')
+ @dependency = current_tag[:class].new(:name => 'dependency')
save_asset_at(@dependency, 1995)
save_asset_at(@dependant, 1999)
- @dependant = current_tag[:class].find_by_filename('dependant')
+ @dependant = current_tag[:class].find_by_name('dependant')
@dependant.dependencies.effectively_updated_at.should == Time.gm(1999)
end
it "should reflect a dependency's change date/time once that dependency is updated" do
- @dependency = current_tag[:class].new(:filename => 'dependency')
+ @dependency = current_tag[:class].new(:name => 'dependency')
save_asset_at(@dependency, 1990)
@dependant.content = %{<r:#{current_tag[:name]} name="dependency" />}
@@ -125,13 +125,13 @@
save_asset_at(@dependency, 1993)
- @dependant = current_tag[:class].find_by_filename('dependant')
+ @dependant = current_tag[:class].find_by_name('dependant')
@dependant.dependencies.effectively_updated_at.should == Time.gm(1993)
end
it "should reflect a dependency's deletion date/time when that dependency file is removed" do
- @dependency = current_tag[:class].new(:filename => 'dependency')
+ @dependency = current_tag[:class].new(:name => 'dependency')
save_asset_at(@dependency, 1996)
@dependant.content = %{<r:#{current_tag[:name]} name="dependency" />}
@@ -140,7 +140,7 @@
Time.stub!(:now).and_return(Time.gm(1998))
@dependency.destroy
- @dependant = current_tag[:class].find_by_filename('dependant')
+ @dependant = current_tag[:class].find_by_name('dependant')
@dependant.dependencies.effectively_updated_at.should == Time.gm(1998)
end
View
62 spec/models/stylesheet_and_javascript_spec.rb
@@ -16,65 +16,65 @@
end
- it 'should limit the filename to 100 characters' do
- @record.filename = 'a' * 100
+ it 'should limit the name to 100 characters' do
+ @record.name = 'a' * 100
@record.should be_valid
- @record.filename = 'a' * 101
+ @record.name = 'a' * 101
@record.should_not be_valid
end
- it 'should not allow an empty filename' do
- @record.filename = ''
+ it 'should not allow an empty name' do
+ @record.name = ''
@record.should_not be_valid
end
- it 'should require unique filenames (within same subclass)' do
- @record.filename = 'abc.123'
+ it 'should require unique names (within same subclass)' do
+ @record.name = 'abc.123'
@record.save!
- @invalid_record = current_asset.new(:filename => 'abc.123')
+ @invalid_record = current_asset.new(:name => 'abc.123')
@invalid_record.should_not be_valid
- @invalid_record.should have(1).error_on(:filename)
- @invalid_record.errors.on(:filename).should == 'filename already in use'
+ @invalid_record.should have(1).error_on(:name)
+ @invalid_record.errors.on(:name).should == 'name already in use'
end
- it 'should permit the same filename as a stylesheet and javascript' do
- @record.filename = 'abc.123'
+ it 'should permit the same name as a stylesheet and javascript' do
+ @record.name = 'abc.123'
@record.save!
if current_asset == Stylesheet
- @record_of_other_subclass = Javascript.new(:filename => 'abc.123')
+ @record_of_other_subclass = Javascript.new(:name => 'abc.123')
elsif current_asset == Javascript
- @record_of_other_subclass = Stylesheet.new(:filename => 'abc.123')
+ @record_of_other_subclass = Stylesheet.new(:name => 'abc.123')
end
@record_of_other_subclass.should be_valid
end
- it 'should allow filenames with alphanumeric chars, underscores, periods, & hyphens' do
- @record.filename = 'abc'
+ it 'should allow names with alphanumeric chars, underscores, periods, & hyphens' do
+ @record.name = 'abc'
@record.should be_valid
- @record.filename = 'ABC'
+ @record.name = 'ABC'
@record.should be_valid
- @record.filename = 'Abc123'
+ @record.name = 'Abc123'
@record.should be_valid
- @record.filename = 'aBc.123'
+ @record.name = 'aBc.123'
@record.should be_valid
- @record.filename = 'aBc_123'
+ @record.name = 'aBc_123'
@record.should be_valid
- @record.filename = 'aBc-123'
+ @record.name = 'aBc-123'
@record.should be_valid
- @record.filename = 'a.B-c.1_2-3'
+ @record.name = 'a.B-c.1_2-3'
@record.should be_valid
end
@@ -84,28 +84,28 @@
%w[! @ # $ % ^ & * ( ) { } \ / < > + = ? , : ; ' "] +
[' ', "\t", "\n", "\r", '[', ']']
).each do |invalid_char|
- it "should not allow filenames with invalid characters (#{invalid_char.inspect})" do
- @record.filename = "abc#{invalid_char}123"
+ it "should not allow names with invalid characters (#{invalid_char.inspect})" do
+ @record.name = "abc#{invalid_char}123"
@record.should_not be_valid
- @record.should have(1).error_on(:filename)
- @record.errors.on(:filename).should == 'invalid format'
+ @record.should have(1).error_on(:name)
+ @record.errors.on(:name).should == 'invalid format'
end
end
- it 'should automatically sort by filename' do
- @record.filename = 'a_is_for_apple'
+ it 'should automatically sort by name' do
+ @record.name = 'a_is_for_apple'
@record.save!
@record = current_asset.new
- @record.filename = 'j_is_for_jacks'
+ @record.name = 'j_is_for_jacks'
@record.save!
@record = current_asset.new
- @record.filename = 'c_is_for_chocolate_frosted_sugar_bombs'
+ @record.name = 'c_is_for_chocolate_frosted_sugar_bombs'
@record.save!
- current_asset.find(:all).should == current_asset.find(:all).sort_by { |item| item[:filename] }
+ current_asset.find(:all).should == current_asset.find(:all).sort_by { |item| item[:name] }
end
end
View
4 spec/models/stylesheet_and_javascript_tags_spec.rb
@@ -36,7 +36,7 @@
end
- it "should render an error when the 'name' attribute calls out an invalid filename" do
+ it "should render an error when the 'name' attribute calls out an invalid name" do
@page.should render(%{<r:#{current_tag[:name]} name="bogus asset name" />}).with_error(
"#{current_tag[:name]} not found")
end
@@ -201,7 +201,7 @@
end
- it "should render an error when the 'name' attribute calls out an invalid filename" do
+ it "should render an error when the 'name' attribute calls out an invalid name" do
@text_asset.content = %{<r:#{current_tag[:name]} name="bogus asset name" />}
lambda{@text_asset.render}.should raise_error(
current_tag[:asset_class]::TagError,
View
4 spec/models/text_asset_response_cache_spec.rb
@@ -111,8 +111,8 @@ def initialize(body = '', headers = {})
private
- def file(filename)
- open(filename) { |f| f.read } rescue ''
+ def file(name)
+ open(name) { |f| f.read } rescue ''
end
View
4 spec/models/user_action_observer_spec.rb
@@ -23,7 +23,7 @@
it 'should observe stylesheet update' do
- model = Stylesheet.find_by_filename('main')
+ model = Stylesheet.find_by_name('main')
model.attributes = model.attributes.dup
model.save.should == true
model.updated_by.should == @user
@@ -31,7 +31,7 @@
it 'should observe javascript update' do
- model = Javascript.find_by_filename('main')
+ model = Javascript.find_by_name('main')
model.attributes = model.attributes.dup
model.save.should == true
model.updated_by.should == @user
View
20 spec/scenarios/javascripts_scenario.rb
@@ -7,19 +7,19 @@ def load
helpers do
- def create_javascript(filename, attributes={})
+ def create_javascript(name, attributes={})
create_model :javascript,
- filename.symbolize,
+ name.symbolize,
javascript_params(
- attributes.reverse_merge(:filename => filename) )
+ attributes.reverse_merge(:name => name) )
end
def javascript_params(attributes={})
- filename = attributes[:filename] || unique_javascript_filename
+ name = attributes[:name] || unique_javascript_name
{
- :filename => filename,
- :content => "javascript content for #{filename}"
+ :name => name,
+ :content => "javascript content for #{name}"
}.merge(attributes)
end
@@ -42,11 +42,11 @@ def javascript_id(symbolic_name)
private
- @@unique_javascript_filename_call_count = 0
+ @@unique_javascript_name_call_count = 0
- def unique_javascript_filename
- @@unique_javascript_filename_call_count += 1
- "javascript-#{@@unique_javascript_filename_call_count}.js"
+ def unique_javascript_name
+ @@unique_javascript_name_call_count += 1
+ "javascript-#{@@unique_javascript_name_call_count}.js"
end
end
View
20 spec/scenarios/stylesheets_scenario.rb
@@ -7,19 +7,19 @@ def load
helpers do
- def create_stylesheet(filename, attributes={})
+ def create_stylesheet(name, attributes={})
create_model :stylesheet,
- filename.symbolize,
+ name.symbolize,
stylesheet_params(
- attributes.reverse_merge(:filename => filename) )
+ attributes.reverse_merge(:name => name) )
end
def stylesheet_params(attributes={})
- filename = attributes[:filename] || unique_stylesheet_filename
+ name = attributes[:name] || unique_stylesheet_name
{
- :filename => filename,
- :content => "stylesheet content for #{filename}"
+ :name => name,
+ :content => "stylesheet content for #{name}"
}.merge(attributes)
end
@@ -42,11 +42,11 @@ def stylesheet_id(symbolic_name)
private
- @@unique_stylesheet_filename_call_count = 0
+ @@unique_stylesheet_name_call_count = 0
- def unique_stylesheet_filename
- @@unique_stylesheet_filename_call_count += 1
- "stylesheet-#{@@unique_stylesheet_filename_call_count}.css"
+ def unique_stylesheet_name
+ @@unique_stylesheet_name_call_count += 1
+ "stylesheet-#{@@unique_stylesheet_name_call_count}.css"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.