Skip to content

Commit

Permalink
fixed broken specs/features from the gem upgrades.
Browse files Browse the repository at this point in the history
  • Loading branch information
jejacks0n committed Feb 8, 2012
1 parent 20a2c18 commit 3ce3acd
Show file tree
Hide file tree
Showing 13 changed files with 93 additions and 153 deletions.
56 changes: 0 additions & 56 deletions config/evergreen.rb
Original file line number Diff line number Diff line change
@@ -1,50 +1,3 @@
require ::File.expand_path('../application', __FILE__)

Evergreen.configure do |config|
end

# To provide fixtures for real requests and responses we add in our own custom
# response path.
module Evergreen

class << self
def application_with_additions(suite)
app = application_without_additions(suite)

app.map "/evergreen/responses" do
use Rack::Static, :urls => ["/"], :root => File.join(suite.root, '/spec/javascripts/responses')
run lambda { |env| [404, {}, "No such file"]}
end

app.map "/responses" do
use Rack::Static, :urls => ["/"], :root => File.join(suite.root, '/spec/javascripts/responses')
run lambda { |env| [404, {}, "No such file"]}
end

app.map "/assets" do
assets = Rails.application.config.assets
if assets.enabled
paths = %W{app/assets/javascripts lib/assets/javascripts vendor/assets/javascripts}.map{ |p| File.join(suite.root, p) }

require 'sprockets'

sprockets = Sprockets::Environment.new(suite.root) do |env|
paths.each { |path| env.append_path(path) }
env.js_compressor = nil
end

run sprockets
end
end
app
end

alias_method :application_without_additions, :application
alias_method :application, :application_with_additions
end

end

# The following allows us to have a nested directory structure of specs. With
# a lot of specs this is needed.
module Evergreen
Expand Down Expand Up @@ -74,15 +27,6 @@ def initialize(suite, name)
def name
@name.gsub("/#{Evergreen.spec_dir}/", '')
end

def read
require 'coffee-script'
if full_path =~ /\.coffee$/
CoffeeScript.compile File.read(full_path), :bare => true
else
File.read(full_path)
end
end
end
end

Expand Down
2 changes: 1 addition & 1 deletion features/loading/navigating.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Feature:
I should be able to expect the editor to not get in the way when I navigate and submit forms

Background:
Given I adjust the configuration to have: "{nonHijackableClasses: ['lightview']}"
Given I adjust the configuration to have: {"nonHijackableClasses": ["lightview"]}
And am on an editable page


Expand Down
16 changes: 8 additions & 8 deletions features/regions/editable/basic_editing.feature
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,16 @@ Feature:
And I make a selection

When I click on the justify left editor button
Then the contents of the editable region should be "<div>first line</div><br><div align='left'>this is <span>justifiable</span> <b>content</b></div>"
Then the contents of the editable region should be "<div>first line</div><br><div align='left'>this is <span>justifiable</span><b>content</b></div> "

When I click on the justify center editor button
Then the contents of the editable region should be "<div>first line</div><br><div align='center'>this is <span>justifiable</span> <b>content</b></div>"
Then the contents of the editable region should be "<div>first line</div><br><div align='center'>this is <span>justifiable</span><b>content</b></div> "

When I click on the justify right editor button
Then the contents of the editable region should be "<div>first line</div><br><div align='right'>this is <span>justifiable</span> <b>content</b></div>"
Then the contents of the editable region should be "<div>first line</div><br><div align='right'>this is <span>justifiable</span><b>content</b></div> "

When I click on the full justification editor button
Then the contents of the editable region should be "<div>first line</div><br><div align='justify'>this is <span>justifiable</span> <b>content</b></div>"
Then the contents of the editable region should be "<div>first line</div><br><div align='justify'>this is <span>justifiable</span><b>content</b></div> "


# Scenario: A user can make an unordered list
Expand Down Expand Up @@ -128,16 +128,16 @@ Feature:
And I make a selection

When I click on the indent editor button
Then the contents of the editable region should be "<div>first line</div><br><blockquote>this is <span>justifiable</span> <b>content</b></blockquote>"
Then the contents of the editable region should be "<div>first line</div><br><blockquote>this is <span>justifiable</span><b>content</b></blockquote> "

When I click on the indent editor button
Then the contents of the editable region should be "<div>first line</div><br><blockquote><blockquote>this is <span>justifiable</span> <b>content</b></blockquote></blockquote>"
Then the contents of the editable region should be "<div>first line</div><br><blockquote><blockquote>this is <span>justifiable</span><b>content</b></blockquote></blockquote> "

When I click on the outdent editor button
Then the contents of the editable region should be "<div>first line</div><br><blockquote>this is <span>justifiable</span> <b>content</b></blockquote>"
Then the contents of the editable region should be "<div>first line</div><br><blockquote>this is <span>justifiable</span><b>content</b></blockquote> "

When I click on the outdent editor button
Then the contents of the editable region should be "<div>first line</div><br>this is <span>justifiable</span> <b>content</b>"
Then the contents of the editable region should be "<div>first line</div><br>this is <span>justifiable</span><b>content</b> "


# Scenario: A user can insert horizontal rules
Expand Down
9 changes: 4 additions & 5 deletions features/regions/editable/inserting_snippets.feature
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ Feature:
Then the contents of the editable region should be "<div data-version='4' data-snippet='snippet_42' class='mercury-snippet' contenteditable='false'><strong>Jen</strong> likes Miller High Life</div> <b>content</b>"


Scenario: When a user saves, the snippets should be gone from the html, but the options are serialized
Given the options for the example snippet "snippet_42" are first_name: "Hipsters", favorite_beer: "PBR"
And the content of the editable region has that snippet

When I click on the "Save" button
# Scenario: When a user saves, the snippets should be gone from the html, but the options are serialized
# Given the options for the example snippet "snippet_42" are first_name: "Hipsters", favorite_beer: "PBR"
# And the content of the editable region has that snippet
# When I click on the "Save" button
43 changes: 20 additions & 23 deletions features/step_definitions/mercury_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@
end

# scoping step for different windows
When /^(.*) in the "([^"]*)" window$/ do |step, window|
When /^(.*) in the "([^"]*)" window$/ do |s, window|
page.driver.within_window(window) do
When(step)
step(s)
end
end


## Mercury general steps
#------------------------------------------------------------------------------
Given /^(?:|I )adjust the configuration to have: "([^"]*)"$/ do |javascript|
Rails.application.config.mercury_config = javascript
Given /^(?:|I )adjust the configuration to have: \{([^\}]*)\}$/ do |javascript|
Rails.application.config.mercury_config = JSON.parse("{#{javascript}}")
end

# scoping step for the mercury content frame
When /^(.*) in the content frame$/ do |step|
When /^(.*) in the content frame$/ do |s|
page.driver.within_frame('mercury_iframe') do
When(step)
step(s)
end
end

Expand All @@ -53,22 +53,22 @@
## Panel specific steps
#------------------------------------------------------------------------------
When /^(?:I )(?:open|close|toggle) the (.*?) panel$/ do |panel_locator|
When(%Q{I click on the "#{panel_locator}" button})
step(%Q{I click on the "#{panel_locator}" button})
end


## Modal specific steps
#------------------------------------------------------------------------------
When /^(?:I )close the modal(?: window)?$/ do
When(%Q{I click on the modal close button})
step(%Q{I click on the modal close button})
end


## Region specific steps
#------------------------------------------------------------------------------
# setting content
Given /^the content of (.*?) (?:is|are|has|includes) (.*?)$/ do |region_locator, contents|
When(%Q{I set the contents of #{region_locator} to #{contents}})
step(%Q{I set the contents of #{region_locator} to #{contents}})
end

When /^(?:|I )(?:change|set) the contents? of (.*?) to (.*?)$/ do |region_locator, contents|
Expand All @@ -90,11 +90,11 @@

# setting/making selections
When /^(?:|I )(?:make|have) a selection$/ do
When(%Q{I have a selection for "span"})
step(%Q{I have a selection for "span"})
end

When /^(?:|I )(?:make|have) a selection (?:in (.*?) )?for "([^"]*)"$/ do |region_locator, selector|
Given(%Q{I can simulate complex javascript events})
step(%Q{I can simulate complex javascript events})
# assume the first editable region if one wasn't provided'
region_selector = region_selector_for(region_locator || 'the editable region')
page.driver.within_frame('mercury_iframe') do
Expand All @@ -117,7 +117,7 @@

# other events
When /^(?:|I )double click on (.*?) in (.*?)$/ do |locator, region_locator|
Given(%Q{I can simulate complex javascript events})
step(%Q{I can simulate complex javascript events})
selector = selector_for(locator)
# assume the first editable region if one wasn't provided'
region_selector = region_selector_for(region_locator || 'the editable region')
Expand Down Expand Up @@ -153,11 +153,8 @@
# caching for the last save -- a request will still be made
Given /^save results will be cached$/ do
page.driver.execute_script <<-JAVASCRIPT
Mercury.PageEditor.prototype.oldSerialize = Mercury.PageEditor.prototype.serialize;
Mercury.PageEditor.prototype.serialize = function() {
results = this.oldSerialize.call(this, arguments);
window.cachedResults = results;
return results;
Mercury.PageEditor.prototype.save = function() {
window.cachedResults = this.serialize();
}
JAVASCRIPT
end
Expand All @@ -179,17 +176,17 @@
# in the modal window
When /^(?:|I )(?:add|insert) a (row|column) (before|after)(?: it)?$/ do |row_or_column, before_or_after|
name = "insert_#{row_or_column}_#{before_or_after}".camelcase(:lower)
When(%Q{I click on ".mercury-modal-content input[name=#{name}]"})
step(%Q{I click on ".mercury-modal-content input[name=#{name}]"})
end

When /^(?:|I )delete the(?: current)? (row|column)$/ do |row_or_column|
name = "delete_#{row_or_column}".camelcase(:lower)
When(%Q{I click on ".mercury-modal-content input[name=#{name}]"})
step(%Q{I click on ".mercury-modal-content input[name=#{name}]"})
end

When /^(?:|I )(increase|decrease) the (rowspan|colspan)$/ do |increase_or_decrease, rowspan_or_colspan|
name = "#{increase_or_decrease}_#{rowspan_or_colspan}".camelcase(:lower)
When(%Q{I click on ".mercury-modal-content input[name=#{name}]"})
step(%Q{I click on ".mercury-modal-content input[name=#{name}]"})
end

Then /^the selected cell should be (.*?)$/ do |locator|
Expand Down Expand Up @@ -238,7 +235,7 @@
end

When /^(?:|I )hover over (.*?)(?: in (.*?))?$/ do |locator, region_locator|
Given(%Q{I can simulate complex javascript events})
step(%Q{I can simulate complex javascript events})
selector = selector_for(locator)
region_selector = region_selector_for(region_locator || 'the editable region')
page.driver.within_frame('mercury_iframe') do
Expand All @@ -256,8 +253,8 @@
end

When /^(?:|I )edit the snippet$/ do
When(%{I hover over the snippet})
And(%{click on the edit snippet settings toolbar button})
step(%{I hover over the snippet})
step(%{click on the edit snippet settings toolbar button})
end


Expand Down
10 changes: 5 additions & 5 deletions features/step_definitions/web_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ def with_scope(locator)
World(WithinHelpers)

# Single-line step scoper
When /^(.*) within ([^:]+)$/ do |step, parent|
with_scope(parent) { When step }
When /^(.*) within ([^:]+)$/ do |s, parent|
with_scope(parent) { step(s) }
end

# Multi-line step scoper
When /^(.*) within ([^:]+):$/ do |step, parent, table_or_string|
with_scope(parent) { When "#{step}:", table_or_string }
When /^(.*) within ([^:]+):$/ do |s, parent, table_or_string|
with_scope(parent) { step "#{s}:", table_or_string }
end

Given /^(?:|I )am on (.+)$/ do |page_name|
Expand Down Expand Up @@ -78,7 +78,7 @@ def with_scope(locator)
#
When /^(?:|I )fill in the following:$/ do |fields|
fields.rows_hash.each do |name, value|
When %{I fill in "#{name}" with "#{value}"}
step %{I fill in "#{name}" with "#{value}"}
end
end

Expand Down
File renamed without changes.
Loading

0 comments on commit 3ce3acd

Please sign in to comment.