fixing tests (wip) + sync javascript objects when updating an entry in a has_many relationship
This commit is contained in:
parent
c6e1276974
commit
520b68104b
1
.gitignore
vendored
1
.gitignore
vendored
@ -41,4 +41,5 @@ spec/dummy/public/sites
|
|||||||
/spec/dummy/tmp/**/*
|
/spec/dummy/tmp/**/*
|
||||||
app/assets/javascripts/old/
|
app/assets/javascripts/old/
|
||||||
app/assets/stylesheets/old/
|
app/assets/stylesheets/old/
|
||||||
|
.rbenv-gemsets
|
||||||
|
|
||||||
|
39
Gemfile.lock
39
Gemfile.lock
@ -1,10 +1,9 @@
|
|||||||
GIT
|
GIT
|
||||||
remote: git://github.com/Compass/compass-rails.git
|
remote: git://github.com/Compass/compass-rails.git
|
||||||
revision: c2d47fb846b6fd48272e56ef21ea91fab8fc8510
|
revision: 47d889ad8dabdab1e9f44da4447f94846c089c50
|
||||||
specs:
|
specs:
|
||||||
compass-rails (1.0.0.rc.1)
|
compass-rails (1.0.0.rc.3)
|
||||||
compass (~> 0.12.rc.0)
|
compass (~> 0.12.rc.0)
|
||||||
rails
|
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/chriseppstein/compass.git
|
remote: git://github.com/chriseppstein/compass.git
|
||||||
@ -94,8 +93,8 @@ GEM
|
|||||||
activesupport (3.2.1)
|
activesupport (3.2.1)
|
||||||
i18n (~> 0.6)
|
i18n (~> 0.6)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
addressable (2.2.6)
|
addressable (2.2.7)
|
||||||
arel (3.0.0)
|
arel (3.0.1)
|
||||||
bcrypt-ruby (3.0.1)
|
bcrypt-ruby (3.0.1)
|
||||||
bson (1.5.2)
|
bson (1.5.2)
|
||||||
bson_ext (1.5.2)
|
bson_ext (1.5.2)
|
||||||
@ -114,10 +113,10 @@ GEM
|
|||||||
carrierwave-mongoid (0.1.3)
|
carrierwave-mongoid (0.1.3)
|
||||||
carrierwave (>= 0.5.6)
|
carrierwave (>= 0.5.6)
|
||||||
mongoid (~> 2.1)
|
mongoid (~> 2.1)
|
||||||
cells (3.8.0)
|
cells (3.8.2)
|
||||||
actionpack (~> 3.0)
|
actionpack (~> 3.0)
|
||||||
railties (~> 3.0)
|
railties (~> 3.0)
|
||||||
childprocess (0.3.0)
|
childprocess (0.3.1)
|
||||||
ffi (~> 1.0.6)
|
ffi (~> 1.0.6)
|
||||||
chunky_png (1.2.5)
|
chunky_png (1.2.5)
|
||||||
codemirror-rails (2.21.1)
|
codemirror-rails (2.21.1)
|
||||||
@ -129,15 +128,15 @@ GEM
|
|||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.2.0)
|
coffee-script-source (1.2.0)
|
||||||
cucumber (1.1.4)
|
cucumber (1.1.8)
|
||||||
builder (>= 2.1.2)
|
builder (>= 2.1.2)
|
||||||
diff-lcs (>= 1.1.2)
|
diff-lcs (>= 1.1.2)
|
||||||
gherkin (~> 2.7.1)
|
gherkin (~> 2.8.0)
|
||||||
json (>= 1.4.6)
|
json (>= 1.4.6)
|
||||||
term-ansicolor (>= 1.0.6)
|
term-ansicolor (>= 1.0.6)
|
||||||
cucumber-rails (1.2.1)
|
cucumber-rails (1.3.0)
|
||||||
capybara (>= 1.1.2)
|
capybara (>= 1.1.2)
|
||||||
cucumber (>= 1.1.3)
|
cucumber (>= 1.1.8)
|
||||||
nokogiri (>= 1.5.0)
|
nokogiri (>= 1.5.0)
|
||||||
database_cleaner (0.7.1)
|
database_cleaner (0.7.1)
|
||||||
devise (1.5.3)
|
devise (1.5.3)
|
||||||
@ -158,7 +157,7 @@ GEM
|
|||||||
factory_girl (~> 2.5.0)
|
factory_girl (~> 2.5.0)
|
||||||
railties (>= 3.0.0)
|
railties (>= 3.0.0)
|
||||||
ffi (1.0.11)
|
ffi (1.0.11)
|
||||||
flash_cookie_session (1.1.1)
|
flash_cookie_session (1.1.2)
|
||||||
rails (~> 3.0)
|
rails (~> 3.0)
|
||||||
fog (1.1.2)
|
fog (1.1.2)
|
||||||
builder
|
builder
|
||||||
@ -174,7 +173,7 @@ GEM
|
|||||||
formtastic (2.0.2)
|
formtastic (2.0.2)
|
||||||
rails (~> 3.0)
|
rails (~> 3.0)
|
||||||
fssm (0.2.8.1)
|
fssm (0.2.8.1)
|
||||||
gherkin (2.7.6)
|
gherkin (2.8.0)
|
||||||
json (>= 1.4.6)
|
json (>= 1.4.6)
|
||||||
haml (3.1.4)
|
haml (3.1.4)
|
||||||
highline (1.6.11)
|
highline (1.6.11)
|
||||||
@ -183,7 +182,7 @@ GEM
|
|||||||
multi_json
|
multi_json
|
||||||
multi_xml
|
multi_xml
|
||||||
i18n (0.6.0)
|
i18n (0.6.0)
|
||||||
journey (1.0.1)
|
journey (1.0.2)
|
||||||
jquery-rails (1.0.19)
|
jquery-rails (1.0.19)
|
||||||
railties (~> 3.0)
|
railties (~> 3.0)
|
||||||
thor (~> 0.14)
|
thor (~> 0.14)
|
||||||
@ -211,7 +210,7 @@ GEM
|
|||||||
mocha (0.9.12)
|
mocha (0.9.12)
|
||||||
mongo (1.5.2)
|
mongo (1.5.2)
|
||||||
bson (= 1.5.2)
|
bson (= 1.5.2)
|
||||||
mongoid (2.4.3)
|
mongoid (2.4.4)
|
||||||
activemodel (~> 3.1)
|
activemodel (~> 3.1)
|
||||||
mongo (~> 1.3)
|
mongo (~> 1.3)
|
||||||
tzinfo (~> 0.3.22)
|
tzinfo (~> 0.3.22)
|
||||||
@ -219,7 +218,7 @@ GEM
|
|||||||
multi_xml (0.4.1)
|
multi_xml (0.4.1)
|
||||||
net-scp (1.0.4)
|
net-scp (1.0.4)
|
||||||
net-ssh (>= 1.99.1)
|
net-ssh (>= 1.99.1)
|
||||||
net-ssh (2.2.2)
|
net-ssh (2.3.0)
|
||||||
nokogiri (1.5.0)
|
nokogiri (1.5.0)
|
||||||
orm_adapter (0.0.6)
|
orm_adapter (0.0.6)
|
||||||
pickle (0.4.10)
|
pickle (0.4.10)
|
||||||
@ -276,15 +275,15 @@ GEM
|
|||||||
railties (>= 3.0)
|
railties (>= 3.0)
|
||||||
rspec (~> 2.8.0)
|
rspec (~> 2.8.0)
|
||||||
ruby-hmac (0.4.0)
|
ruby-hmac (0.4.0)
|
||||||
rubyzip (0.9.5)
|
rubyzip (0.9.6.1)
|
||||||
sanitize (2.0.3)
|
sanitize (2.0.3)
|
||||||
nokogiri (>= 1.4.4, < 1.6)
|
nokogiri (>= 1.4.4, < 1.6)
|
||||||
sass (3.1.12)
|
sass (3.1.15)
|
||||||
sass-rails (3.2.4)
|
sass-rails (3.2.4)
|
||||||
railties (~> 3.2.0)
|
railties (~> 3.2.0)
|
||||||
sass (>= 3.1.10)
|
sass (>= 3.1.10)
|
||||||
tilt (~> 1.3)
|
tilt (~> 1.3)
|
||||||
selenium-webdriver (2.18.0)
|
selenium-webdriver (2.19.0)
|
||||||
childprocess (>= 0.2.5)
|
childprocess (>= 0.2.5)
|
||||||
ffi (~> 1.0.9)
|
ffi (~> 1.0.9)
|
||||||
multi_json (~> 1.0.4)
|
multi_json (~> 1.0.4)
|
||||||
@ -308,7 +307,7 @@ GEM
|
|||||||
kgio (~> 2.6)
|
kgio (~> 2.6)
|
||||||
rack
|
rack
|
||||||
raindrops (~> 0.7)
|
raindrops (~> 0.7)
|
||||||
warden (1.1.0)
|
warden (1.1.1)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
xpath (0.1.4)
|
xpath (0.1.4)
|
||||||
nokogiri (~> 1.3)
|
nokogiri (~> 1.3)
|
||||||
|
@ -81,6 +81,8 @@ class Locomotive.Views.Shared.Fields.HasManyView extends Backbone.View
|
|||||||
update_entry: (entry) ->
|
update_entry: (entry) ->
|
||||||
entry_html = $(_.detect @$('> ul > li'), (_entry_html) -> $(_entry_html).data('data-entry-id') == entry.id)
|
entry_html = $(_.detect @$('> ul > li'), (_entry_html) -> $(_entry_html).data('data-entry-id') == entry.id)
|
||||||
|
|
||||||
|
@collection.get(entry.id).set(entry.attributes) # sync
|
||||||
|
|
||||||
new_entry_html = $(@entry_template()(label: entry.get('_label')))
|
new_entry_html = $(@entry_template()(label: entry.get('_label')))
|
||||||
new_entry_html.data('data-entry-id', entry.id)
|
new_entry_html.data('data-entry-id', entry.id)
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ module Locomotive
|
|||||||
mount_uploader :source, ThemeAssetUploader, :mount_on => :source_filename
|
mount_uploader :source, ThemeAssetUploader, :mount_on => :source_filename
|
||||||
|
|
||||||
## associations ##
|
## associations ##
|
||||||
referenced_in :site, :class_name => 'Locomotive::Site'
|
belongs_to :site, :class_name => 'Locomotive::Site'
|
||||||
|
|
||||||
## indexes ##
|
## indexes ##
|
||||||
index :site_id
|
index :site_id
|
||||||
|
@ -94,7 +94,7 @@ en:
|
|||||||
|
|
||||||
sessions:
|
sessions:
|
||||||
new:
|
new:
|
||||||
title: Login
|
title: Log in
|
||||||
link: "I forgot my password"
|
link: "I forgot my password"
|
||||||
email: "Email"
|
email: "Email"
|
||||||
password: "Password"
|
password: "Password"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Feature: Login
|
Feature: Log in
|
||||||
In order to access locomotive admin panel
|
In order to access locomotive admin panel
|
||||||
As an administrator
|
As an administrator
|
||||||
I want to log in
|
I want to log in
|
||||||
|
@ -27,8 +27,8 @@ Scenario: Creating a valid page
|
|||||||
Scenario: Updating a valid page
|
Scenario: Updating a valid page
|
||||||
When I go to pages
|
When I go to pages
|
||||||
And I follow "Home page"
|
And I follow "Home page"
|
||||||
And I change the page title with "Home page !"
|
And I change the page title to "Home page !"
|
||||||
And I change the page template with "My new content is here"
|
And I change the page template to "My new content is here"
|
||||||
And I press "Save"
|
And I press "Save"
|
||||||
Then I should see "Page was successfully updated."
|
Then I should see "Page was successfully updated."
|
||||||
And I should have "My new content is here" in the index page
|
And I should have "My new content is here" in the index page
|
||||||
|
@ -30,10 +30,11 @@ Scenario: Uploading a stylesheet
|
|||||||
And I should see "Code"
|
And I should see "Code"
|
||||||
And I should see "stylesheets/main.css"
|
And I should see "stylesheets/main.css"
|
||||||
|
|
||||||
|
@javascript
|
||||||
Scenario: Updating a stylesheet
|
Scenario: Updating a stylesheet
|
||||||
Given a stylesheet asset named "application"
|
Given a stylesheet asset named "application"
|
||||||
When I go to theme assets
|
When I go to theme assets
|
||||||
And I follow "stylesheets/application.css"
|
And I follow "application.css"
|
||||||
And I fill in "theme_asset[plain_text]" with "Lorem ipsum (updated)"
|
And I fill in "theme_asset[plain_text]" with "Lorem ipsum (updated)"
|
||||||
And I press "Save"
|
And I press "Save"
|
||||||
Then I should see "File was successfully updated."
|
Then I should see "File was successfully updated."
|
||||||
@ -51,13 +52,15 @@ Scenario: Uploading a javascript
|
|||||||
And I should see "Code"
|
And I should see "Code"
|
||||||
And I should see "javascripts/test/application.js"
|
And I should see "javascripts/test/application.js"
|
||||||
|
|
||||||
Scenario: Updating a javascript
|
# @javascript
|
||||||
Given a javascript asset named "application"
|
# Scenario: Updating a javascript
|
||||||
When I go to theme assets
|
# Given a javascript asset named "application"
|
||||||
And I follow "javascripts/application.js"
|
# When I go to theme assets
|
||||||
And I fill in "theme_asset[plain_text]" with "Lorem ipsum (updated)"
|
# And I follow "application.js"
|
||||||
And I press "Save"
|
# And I change the asset code with
|
||||||
Then I should see "File was successfully updated."
|
# And I fill in "theme_asset[plain_text]" with "Lorem ipsum (updated)"
|
||||||
|
# And I press "Save"
|
||||||
|
# Then I should see "File was successfully updated."
|
||||||
|
|
||||||
Scenario: Uploading an image which already exists
|
Scenario: Uploading an image which already exists
|
||||||
When I go to theme assets
|
When I go to theme assets
|
||||||
|
@ -18,13 +18,13 @@ Given /^a page named "([^"]*)" with the template:$/ do |page_slug, template|
|
|||||||
end
|
end
|
||||||
|
|
||||||
# change the title
|
# change the title
|
||||||
When /^I change the page title with "([^"]*)"$/ do |page_title|
|
When /^I change the page title to "([^"]*)"$/ do |page_title|
|
||||||
page.evaluate_script "window.prompt = function() { return '#{page_title}'; }"
|
page.evaluate_script "window.prompt = function() { return '#{page_title}'; }"
|
||||||
page.find('h2 a.editable').click
|
page.find('h2 a.editable').click
|
||||||
end
|
end
|
||||||
|
|
||||||
# change the template
|
# change the template
|
||||||
When /^I change the page template with "([^"]*)"$/ do |page_template|
|
When /^I change the page template to "([^"]*)"$/ do |page_template|
|
||||||
page.evaluate_script "window.application_view.view.model.set({ 'raw_template': '#{page_template}' })"
|
page.evaluate_script "window.application_view.view.model.set({ 'raw_template': '#{page_template}' })"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -9,9 +9,9 @@ def create_plain_text_asset(name, type)
|
|||||||
:plain_text_type => type,
|
:plain_text_type => type,
|
||||||
:performing_plain_text => true
|
:performing_plain_text => true
|
||||||
})
|
})
|
||||||
|
|
||||||
# asset.should be_valid
|
# asset.should be_valid
|
||||||
asset.save!
|
asset.save!
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# creates various theme assets
|
# creates various theme assets
|
||||||
@ -33,6 +33,12 @@ end
|
|||||||
|
|
||||||
# other stuff
|
# other stuff
|
||||||
|
|
||||||
|
# change the template
|
||||||
|
# When /^I change the theme asset code to "([^"]*)"$/ do |page_template|
|
||||||
|
# page.evaluate_script "window.application_view.view.model.set({ 'raw_template': '#{page_template}' })"
|
||||||
|
# end
|
||||||
|
|
||||||
|
|
||||||
Then /^I should see "([^"]*)" as theme asset code$/ do |code|
|
Then /^I should see "([^"]*)" as theme asset code$/ do |code|
|
||||||
find(:css, "#theme_asset_plain_text").text.should == code
|
find(:css, "#theme_asset_plain_text").text.should == code
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user